Psi4
matrix_base.h
Go to the documentation of this file.
1 /*
2  * @BEGIN LICENSE
3  *
4  * Psi4: an open-source quantum chemistry software package
5  *
6  * Copyright (c) 2007-2017 The Psi4 Developers.
7  *
8  * The copyrights for code used from other parties are included in
9  * the corresponding files.
10  *
11  * This file is part of Psi4.
12  *
13  * Psi4 is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU Lesser General Public License as published by
15  * the Free Software Foundation, version 3.
16  *
17  * Psi4 is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public License along
23  * with Psi4; if not, write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25  *
26  * @END LICENSE
27  */
28 
29 #ifndef _psi_src_lib_libmemtrix_matrix_base_h_
30 #define _psi_src_lib_libmemtrix_matrix_base_h_
31 
32 #include <cstring> // for size_t
33 
35 #include "vector_base.h"
36 
37 namespace psi{ namespace mcscf{
38 
40 {
41 public:
42  MatrixBase();
43  MatrixBase(size_t rows, size_t cols);
44  ~MatrixBase();
45 
46  //Inlines
47  size_t get_rows() {return(rows_);}
48  size_t get_cols() {return(cols_);}
49  size_t get_elements() {return(elements_);}
50  void set(size_t i, size_t j, double value) {matrix_[i][j] = value;}
51  void add(size_t i, size_t j, double value) {matrix_[i][j] += value;}
52  double get(size_t i, size_t j) {return(matrix_[i][j]);}
53  double** get_matrix() {return(matrix_);}
54 
55  void multiply(bool transpose_A, bool transpose_B, MatrixBase* A, MatrixBase* B);
56  void diagonalize(MatrixBase* eigenmatrix, VectorBase* eigenvalues);
57  void print();
58  void zero();
59  void zero_diagonal();
60  void scale(double factor);
61  void transpose();
62  MatrixBase& operator+=(const MatrixBase& rhs);
63  MatrixBase& operator-=(const MatrixBase& rhs);
64  friend double dot(MatrixBase* A, MatrixBase* B);
65 private:
66  // Matrix size
67  size_t rows_;
68  size_t cols_;
69  size_t elements_;
70 
71  // Matrix data
72  double** matrix_;
73 };
74 
75 }}
76 
77 #endif // _psi_src_lib_libmemtrix_matrix_base_h_
78 
79 /*
80 
81  int get_nirreps() {return(nirreps);}
82  int get_nirreps() const {return(nirreps);}
83  double*** get_matrix() {return(matrix);}
84  double** get_block(int h) {return(matrix[h]);}
85  const double** get_block(int h) const {return((const double**)matrix[h]);}
86  double get(int h, int i, int j) {return(matrix[h][i][j]);}
87  void set(int h, int i, int j, double value) {matrix[h][i][j] = value;}
88  void add(int h, int i, int j, double value) {matrix[h][i][j] += value;}
89  int get_block_size(int h) {return(block_size[h]);}
90  int get_block_size(int h) const {return(block_size[h]);}
91  void diagonalize(SBlockMatrix* eigenvectors, double* eigenvalues);
92  void DGEMM(bool transpose_A, bool transpose_B, SBlockMatrix* A, SBlockMatrix* B);
93  void minus(SBlockMatrix* B);
94 
95  friend double operator^(const SBlockMatrix& rhs,const SBlockMatrix& lhs);
96  SBlockMatrix& operator=(const SBlockMatrix& rhs);
97  SBlockMatrix& operator+=(const SBlockMatrix& lhs);
98 */
MatrixBase & operator+=(const MatrixBase &rhs)
Definition: matrix_base.cc:153
size_t get_elements()
Definition: matrix_base.h:49
void print()
Definition: matrix_base.cc:56
size_t elements_
Definition: matrix_base.h:69
size_t rows_
Definition: matrix_base.h:67
Definition: pointgrp.h:106
void set(size_t i, size_t j, double value)
Definition: matrix_base.h:50
MatrixBase & operator-=(const MatrixBase &rhs)
Definition: matrix_base.cc:163
size_t get_rows()
Definition: matrix_base.h:47
size_t get_cols()
Definition: matrix_base.h:48
void zero_diagonal()
Definition: matrix_base.cc:95
SharedWavefunction mcscf(SharedWavefunction, Options &)
Definition: mcscf.cc:73
void add(size_t i, size_t j, double value)
Definition: matrix_base.h:51
void diagonalize(MatrixBase *eigenmatrix, VectorBase *eigenvalues)
Definition: matrix_base.cc:128
friend double dot(MatrixBase *A, MatrixBase *B)
Definition: matrix_base.cc:142
void scale(double factor)
Definition: matrix_base.cc:66
Definition: vector_base.h:37
double ** get_matrix()
Definition: matrix_base.h:53
Definition: matrix_base.h:39
void zero()
Definition: matrix_base.cc:89
void transpose()
Definition: matrix_base.cc:75
void multiply(bool transpose_A, bool transpose_B, MatrixBase *A, MatrixBase *B)
Definition: matrix_base.cc:103
size_t cols_
Definition: matrix_base.h:68
Definition: PsiFileImpl.h:39
~MatrixBase()
Definition: matrix_base.cc:51
double ** matrix_
Definition: matrix_base.h:72