IOMatrixMarket.hxx
1 // Copyright (C) 2001-2011 Vivien Mallet
2 // Copyright (C) 2001-2011 Marc Durufle
3 //
4 // This file is part of the linear-algebra library Seldon,
5 // http://seldon.sourceforge.net/.
6 //
7 // Seldon is free software; you can redistribute it and/or modify it under the
8 // terms of the GNU Lesser General Public License as published by the Free
9 // Software Foundation; either version 2.1 of the License, or (at your option)
10 // any later version.
11 //
12 // Seldon is distributed in the hope that it will be useful, but WITHOUT ANY
13 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
15 // more details.
16 //
17 // You should have received a copy of the GNU Lesser General Public License
18 // along with Seldon. If not, see http://www.gnu.org/licenses/.
19 
20 
21 #ifndef SELDON_FILE_MATRIX_SPARSE_IOMATRIXMARKET_HXX
22 
23 
24 namespace Seldon
25 {
26 
27  template<class T>
28  void ReadComplexValue(istream& FileStream, T& entry);
29 
30  template<class T>
31  void ReadComplexValue(istream& FileStream, complex<T>& entry);
32 
33  template<class T>
34  void WriteComplexValue(ostream& FileStream, const T& entry);
35 
36  template<class T>
37  void WriteComplexValue(ostream& FileStream, const complex<T>& entry);
38 
39  template<class Tint, class AllocInt, class T, class Allocator>
40  void ReadCoordinateMatrix(istream& FileStream,
41  Vector<Tint, VectFull, AllocInt>& row_numbers,
42  Vector<Tint, VectFull, AllocInt>& col_numbers,
43  Vector<T, VectFull, Allocator>& values,
44  bool cplx = false);
45 
46  template<class Matrix1, class T>
47  void ReadCoordinateMatrix(Matrix1& A, istream& FileStream, T& zero,
48  int index = 1, long nnz = -1, bool cplx = false);
49 
50  template<class Tint, class AllocInt, class T, class Allocator>
51  void WriteCoordinateMatrix(ostream& FileStream,
52  const Vector<Tint, VectFull, AllocInt>& row_numbers,
53  const Vector<Tint, VectFull, AllocInt>& col_numbers,
54  const Vector<T, VectFull, Allocator>& values,
55  bool cplx = false);
56 
57  template<class T0, class Prop0, class Storage0, class Alloc0, class T>
58  void WriteCoordinateMatrix(const Matrix<T0, Prop0, Storage0, Alloc0>& A,
59  ostream& FileStream, T& zero,
60  int index = 1, bool cplx = false);
61 
62  template <class T, class Prop, class Allocator>
63  void ReadHarwellBoeing(string filename,
64  Matrix<T, Prop, ColSparse, Allocator>& A);
65 
66 
67  template <class T, class Prop, class Allocator>
68  void ReadHarwellBoeing(string filename,
69  Matrix<complex<T>, Prop, ColSparse, Allocator>& A);
70 
71 
72  template <class T, class Prop, class Allocator>
73  void ReadHarwellBoeing(string filename,
74  Matrix<T, Prop, RowSymSparse, Allocator>& A);
75 
76 
77  template <class T, class Prop, class Allocator>
78  void ReadHarwellBoeing(string filename,
79  Matrix<complex<T>, Prop, RowSymSparse, Allocator>& A);
80 
81 
82  template <class T, class T2, class Storage, class Allocator>
83  void ReadHarwellBoeing(string filename, const T2& val,
84  Matrix<T, Symmetric, Storage, Allocator>& A);
85 
86 
87  template <class T, class T2, class Storage, class Allocator>
88  void ReadHarwellBoeing(string filename, const T2& val,
89  Matrix<T, General, Storage, Allocator>& A);
90 
91 
92  template <class T, class T2, class Storage, class Allocator>
93  void ReadHarwellBoeing(string filename, const complex<T2>& val,
94  Matrix<T, Symmetric, Storage, Allocator>& A);
95 
96 
97  template <class T, class T2, class Storage, class Allocator>
98  void ReadHarwellBoeing(string filename, const complex<T2>& val,
99  Matrix<T, General, Storage, Allocator>& A);
100 
101 
102  template <class T, class Prop, class Storage, class Allocator>
103  void ReadHarwellBoeing(string filename,
104  Matrix<T, Prop, Storage, Allocator>& A);
105 
106 
107  template<class T>
108  void ReadComplexValuesHarwell(long Nnonzero, int Nline_val, int line_width_val,
109  int element_width_val,
110  istream& input_stream, T* A_data);
111 
112 
113  template<class T>
114  void ReadComplexValuesHarwell(long Nnonzero, int Nline_val, int line_width_val,
115  int element_width_val,
116  istream& input_stream, complex<T>* A_data);
117 
118 
119  template <class T, class Prop, class Storage, class Allocator>
120  void ReadHarwellBoeing(string filename,
121  string value_type, string matrix_type,
122  Matrix<T, Prop, Storage, Allocator> & A);
123 
124 
125  template<class T>
126  void PrintComplexValuesHarwell(long nnz, const Vector<complex<T> >& Val,
127  ofstream& file_out);
128 
129 
130  template<class T>
131  void PrintComplexValuesHarwell(long nnz, const Vector<T>& Val,
132  ofstream& file_out);
133 
134 
135  template<class T, class Prop, class Storage, class Allocator>
136  void WriteHarwellBoeing(const Matrix<T, Prop, Storage, Allocator>& A,
137  const string& file_name);
138 
139 
140  template <class T, class Prop, class Storage, class Allocator>
141  void ReadMatrixMarket(string filename,
142  Matrix<T, Prop, Storage, Allocator>& A);
143 
144 
145  template<class T, class Prop, class Storage, class Allocator>
146  void WriteMatrixMarket(const Matrix<T, Prop, Storage, Allocator>& A,
147  const string& file_name);
148 
149 
150 }
151 
152 
153 #define SELDON_FILE_MATRIX_SPARSE_IOMATRIXMARKET_HXX
154 #endif
Seldon::WriteComplexValue
void WriteComplexValue(ostream &FileStream, const T &entry)
reads a real or complex value in a file
Definition: IOMatrixMarket.cxx:80
Seldon::ReadComplexValue
void ReadComplexValue(istream &FileStream, T &entry)
reads a real or complex value in a file
Definition: IOMatrixMarket.cxx:62
Seldon
Seldon namespace.
Definition: Array.cxx:24