ergo
files_sparse.h
Go to the documentation of this file.
1/* Ergo, version 3.8.2, a program for linear scaling electronic structure
2 * calculations.
3 * Copyright (C) 2023 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
36
37
38#ifndef FILES_SPARSE_HEADER
39#define FILES_SPARSE_HEADER
40
41#include "realtype.h" // definitions of types (utilities_basic)
42
43#include <iostream>
44#include <fstream>
45#include <string.h>
46#include <assert.h>
47#include <vector>
48#include <sstream>
49#include <stdexcept>
50#include "mmio.h"
51
52
53using namespace std;
54
55typedef ergo_real real;
56
57
58/* READ SPARSE MATRIX FROM THE MATRIX MARKET FILE */
59int read_matrix_from_mtx(const char* filename, vector<int> &I, vector<int> &J, vector<real> &val, int &N, int &M);
60
61
62/* WRITE SPARSE MATRIX TO THE MATRIX MARKET FILE */
63int write_matrix_to_mtx(const char* filename, const vector<int> &I, const vector<int> &J, const vector<real> &val, const int &N);
64int write_matrix_to_mtx_nonsymm(const char* filename, const vector<int> &I, const vector<int> &J, const vector<real> &val, const int &N, const int &M);
65
66#endif //FILES_SPARSE_HEADER
67
68
69
70
ergo_real real
Definition test.cc:46
int write_matrix_to_mtx_nonsymm(const char *filename, const vector< int > &I, const vector< int > &J, const vector< real > &val, const int &N, const int &M)
Definition files_sparse.cc:192
int write_matrix_to_mtx(const char *filename, const vector< int > &I, const vector< int > &J, const vector< real > &val, const int &N)
Definition files_sparse.cc:151
int read_matrix_from_mtx(const char *filename, vector< int > &I, vector< int > &J, vector< real > &val, int &N, int &M)
Matrix Market I/O library for ANSI C.
Definition of the main floating-point datatype used; the ergo_real type.
double ergo_real
Definition realtype.h:69