ergo
files_sparse_bin.h
Go to the documentation of this file.
1 /* Ergo, version 3.8, a program for linear scaling electronic structure
2  * calculations.
3  * Copyright (C) 2019 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 
38 #ifndef FILES_SPARSE_BIN_HEADER
39 #define FILES_SPARSE_BIN_HEADER
40 
41 #include "realtype.h" // definitions of types (utilities_basic)
42 
43 #include <iostream>
44 #include <fstream>
45 #include <cstring>
46 #include <assert.h>
47 #include <vector>
48 #include <stdexcept>
49 
50 using namespace std;
51 
52 typedef ergo_real real;
53 
54 void write_matrix_to_bin(const char* filename, const vector<int> &I, const vector<int> &J, const vector<real> &val, const int &N);
55 
56 void read_matrix_from_bin_Elias_format(const char* filename, std::vector<int> &I, std::vector<int> &J, std::vector<real> &val);
57 
58 void read_matrix_from_bin(const char* filename, std::vector<int> &I, vector<int> &J, vector<real> &val, int &N, int &M);
59 
60 
61 #endif
write_matrix_to_bin
void write_matrix_to_bin(const char *filename, const std::vector< int > &I, const std::vector< int > &J, const std::vector< real > &val, const int &N)
Definition: files_sparse_bin.cc:43
realtype.h
Definition of the main floating-point datatype used; the ergo_real type.
write_matrix_to_bin
void write_matrix_to_bin(const char *filename, const vector< int > &I, const vector< int > &J, const vector< real > &val, const int &N)
ergo_real
double ergo_real
Definition: realtype.h:69
real
ergo_real real
Definition: test.cc:46
read_matrix_from_bin
void read_matrix_from_bin(const char *filename, std::vector< int > &I, vector< int > &J, vector< real > &val, int &N, int &M)
real
ergo_real real
Definition: files_sparse_bin.h:52
read_matrix_from_bin_Elias_format
void read_matrix_from_bin_Elias_format(const char *filename, std::vector< int > &I, std::vector< int > &J, std::vector< real > &val)
Read data from the binary file.
Definition: files_sparse_bin.cc:98
read_matrix_from_bin
void read_matrix_from_bin(const char *filename, std::vector< int > &I, std::vector< int > &J, std::vector< real > &val, int &N, int &M)
Read data from the binary file.
Definition: files_sparse_bin.cc:147
files_sparse_bin.h
File containing declaration of functions for reading/writing sparse matrices from/to binary files.
read_matrix_from_bin_Elias_format
void read_matrix_from_bin_Elias_format(const char *filename, std::vector< int > &I, std::vector< int > &J, std::vector< real > &val)
Read data from the binary file.
Definition: files_sparse_bin.cc:98