Psi4
linear_algebra.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 
33 #ifndef _opt_linear_algebra_h_
34 #define _opt_linear_algebra_h_
35 
36 // C functions called by opt which use BLAS/LAPACK routines
37 extern "C" {
38 
39 // matrix multiplications
40 void opt_matrix_mult(double **A, bool tA, double **B, bool tB, double **C, bool tC,
41  int nr, int nl, int nc, bool add);
42 
43 // eigenvector/eigenvalues
44 bool opt_symm_matrix_eig(double **A, int dim, double *evals);
45 
46 bool opt_asymm_matrix_eig(double **A, int dim, double *evals);
47 
48 }
49 
50 namespace opt {
51 
52 // invert a symmetric matrix
53 double ** symm_matrix_inv(double **A, int dim, bool redundant=true);
54 
55 // allocate memory and return a copy of a matrix
56 double ** matrix_return_copy(double **A, int nr, int nc);
57 bool ** matrix_return_copy(bool **A, int nr, int nc);
58 
59 void matrix_copy(double **from, double **to, int nr, int nc);
60 
61 void array_copy(double *from, double *to, int n);
62 double array_dot(double *v1, double *v2, int n);
63 double array_norm(double *v1, int n);
64 void array_normalize(double *v1, int n);
65 void array_scm(double *v1, double a, int n);
66 double array_abs_max(double *v1, int n);
67 double array_max(double *v1, int n);
68 double array_rms(double *v1, int n);
69 // Compute matrix ^1/2 or ^-1/2 if inverse=true
70 void matrix_root(double **A, int dim, bool inverse);
71 
72 }
73 
74 #endif
double array_max(double *v1, int n)
Definition: linear_algebra.cc:326
void opt_matrix_mult(double **A, bool tA, double **B, bool tB, double **C, bool tC, int nr, int nl, int nc, bool add)
Definition: linear_algebra.cc:84
void matrix_copy(double **from, double **to, int nr, int nc)
Definition: linear_algebra.cc:291
double array_abs_max(double *v1, int n)
Definition: linear_algebra.cc:319
double ** matrix_return_copy(double **A, int nr, int nc)
Definition: linear_algebra.cc:267
bool opt_symm_matrix_eig(double **A, int dim, double *evals)
Definition: linear_algebra.cc:118
double array_norm(double *v1, int n)
Definition: linear_algebra.cc:310
void array_copy(double *v_from, double *v_to, int n)
Definition: linear_algebra.cc:286
bool opt_asymm_matrix_eig(double **A, int dim, double *evals)
Definition: linear_algebra.cc:145
double ** symm_matrix_inv(double **A, int dim, bool redundant)
Definition: linear_algebra.cc:223
double array_rms(double *v1, int n)
Definition: linear_algebra.cc:333
void array_normalize(double *v1, int n)
Definition: linear_algebra.cc:305
Definition: PsiFileImpl.h:39
void array_scm(double *v1, double a, int n)
Definition: linear_algebra.cc:314
void matrix_root(double **A, int dim, bool inverse)
Definition: linear_algebra.cc:340
double array_dot(double *v1, double *v2, int n)
Definition: linear_algebra.cc:298