ergo
csr_matrix.h
Go to the documentation of this file.
1 /* Ergo, version 3.7, a program for linear scaling electronic structure
2  * calculations.
3  * Copyright (C) 2018 Elias Rudberg, Emanuel H. Rubensson, Pawel Salek,
4  * and Anastasia Kruchinina.
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  *
19  * Primary academic reference:
20  * Ergo: An open-source program for linear-scaling electronic structure
21  * calculations,
22  * Elias Rudberg, Emanuel H. Rubensson, Pawel Salek, and Anastasia
23  * Kruchinina,
24  * SoftwareX 7, 107 (2018),
25  * <http://dx.doi.org/10.1016/j.softx.2018.03.005>
26  *
27  * For further information about Ergo, see <http://www.ergoscf.org>.
28  */
29 
37 #ifndef CSR_MATRIX_HEADER
38 #define CSR_MATRIX_HEADER
39 
40 #include "realtype.h"
41 #include <vector>
42 
43 
44 typedef struct
45 {
49 
51 {
52  int n;
53  long nnz;
58 };
59 
60 
61 
63  int symmetryFlag,
64  int n,
65  long nnz,
66  const std::vector<int> & rowind,
67  const std::vector<int> & colind);
68 
70 
71 int ergo_CSR_copy(csr_matrix_struct* csrDest, const csr_matrix_struct* csrSource);
72 
74 
76  int row,
77  int col,
78  ergo_real value);
79 
81  int row,
82  int col);
83 
85 
87 
89  std::vector<int> & rowind,
90  std::vector<int> & colind,
91  std::vector<ergo_real> & values,
92  long nvalues);
93 
95  int row);
96 
98  int row,
99  std::vector<int> & colind,
100  std::vector<ergo_real> & values,
101  int nvalues);
102 
103 
104 
105 #endif
int n
Definition: csr_matrix.h:52
int ergo_CSR_copy(csr_matrix_struct *csrDest, const csr_matrix_struct *csrSource)
Definition: csr_matrix.cc:181
double ergo_real
Definition: realtype.h:69
ergo_real ergo_CSR_get_element(const csr_matrix_struct *csr, int row, int col)
Definition: csr_matrix.cc:278
int ergo_CSR_create(csr_matrix_struct *csr, int symmetryFlag, int n, long nnz, const std::vector< int > &rowind, const std::vector< int > &colind)
Definition: csr_matrix.cc:75
int ergo_CSR_get_values(const csr_matrix_struct *csr, std::vector< int > &rowind, std::vector< int > &colind, std::vector< ergo_real > &values, long nvalues)
Definition: csr_matrix.cc:321
ergo_real * elementList
Definition: csr_matrix.h:56
int * columnIndexList
Definition: csr_matrix.h:57
int ergo_CSR_get_values_singlerow(const csr_matrix_struct *csr, int row, std::vector< int > &colind, std::vector< ergo_real > &values, int nvalues)
Definition: csr_matrix.cc:358
Definition of the main floating-point datatype used; the ergo_real type.
int ergo_CSR_add_to_element(csr_matrix_struct *csr, int row, int col, ergo_real value)
Definition: csr_matrix.cc:252
Definition: csr_matrix.h:50
long ergo_CSR_get_nvalues(const csr_matrix_struct *csr)
Definition: csr_matrix.cc:314
long firstElementIndex
Definition: csr_matrix.h:47
long noOfElementsInRow
Definition: csr_matrix.h:46
ergo_real ergo_CSR_get_max_abs_element(const csr_matrix_struct *csr)
Definition: csr_matrix.cc:300
long nnz
Definition: csr_matrix.h:53
int symmetryFlag
Definition: csr_matrix.h:54
int ergo_CSR_get_nvalues_singlerow(const csr_matrix_struct *csr, int row)
Definition: csr_matrix.cc:351
Definition: csr_matrix.h:44
int ergo_CSR_add_equal_structure(csr_matrix_struct *csrDest, const csr_matrix_struct *csrSource)
Definition: csr_matrix.cc:202
csr_matrix_row_struct * rowList
Definition: csr_matrix.h:55
int ergo_CSR_destroy(csr_matrix_struct *csr)
Definition: csr_matrix.cc:171