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