30 inline void alloc(
size_t nl,
size_t nc,
size_t nz);
31 inline void destroy();
39 inline size_t nlin()
const ;
40 inline size_t ncol()
const ;
41 inline void write(std::ostream& f)
const;
42 inline void read(std::istream& f);
44 inline double operator()(
size_t i,
size_t j)
const;
45 inline double& operator()(
size_t i,
size_t j);
51 inline void info()
const;
58 f << M.
nlin() <<
" " << M.
ncol() << std::endl;
60 for(
size_t i=0;i<M.
nlin();i++)
64 f<<(
long unsigned int)i<<
"\t"<<(
long unsigned int)M.
js[j]<<
"\t"<<M.
tank[j]<<std::endl;
71 if ((
nlin() == 0) && (
ncol() == 0)) {
72 std::cout <<
"Matrix Empty" << std::endl;
76 std::cout <<
"Dimensions : " <<
nlin() <<
" x " <<
ncol() << std::endl;
110 size_t current_line = (size_t)-1;
111 for( it = M.
begin(); it != M.
end(); ++it) {
112 size_t i = it->first.first;
113 size_t j = it->first.second;
114 double val = it->second;
117 if(i != current_line) {
118 for(
size_t k = current_line+1; k <= i; ++k) {
126 for(
size_t k = current_line+1; k <= M.
nlin(); ++k) {
135 f.write((
const char*)&
m_nlin,(std::streamsize)
sizeof(
size_t));
136 f.write((
const char*)&
m_ncol,(std::streamsize)
sizeof(
size_t));
137 f.write((
const char*)&nz,(std::streamsize)
sizeof(
size_t));
138 f.write((
const char*)
tank,(std::streamsize)(
sizeof(
double)*nz));
139 f.write((
const char*)
js,(std::streamsize)(
sizeof(
size_t)*nz));
140 f.write((
const char*)
rowindex,(std::streamsize)(
sizeof(
size_t)*
m_nlin));
147 f.read((
char*)&
m_nlin,(std::streamsize)
sizeof(
size_t));
148 f.read((
char*)&
m_ncol,(std::streamsize)
sizeof(
size_t));
149 f.read((
char*)&nz,(std::streamsize)
sizeof(
size_t));
151 f.read((
char*)
tank,(std::streamsize)(
sizeof(
double)*nz));
152 f.read((
char*)
js,(std::streamsize)(
sizeof(
size_t)*nz));
189 if(
js[k]<j)
continue;
190 else if(
js[k]==j)
return tank[k];
201 if(
js[k]<j)
continue;
202 else if(
js[k]==j)
return tank[k];
206 throw OpenMEEG::maths::BadSparseOperation(
"FastSparseMatrix : double& operator()(size_t i,size_t j) can't add element");
212 double *pt_result=&result(0);
214 double *pt_vect=&(*_v)(0);
216 for(
size_t i=0;i<
m_nlin;i++)
218 double& total=pt_result[i];
220 total+=
tank[j]*pt_vect[
js[j]];
double & operator[](size_t i)
void write(std::ostream &f) const
Vector operator*(const Vector &v) const
double operator()(size_t i, size_t j) const
void alloc(size_t nl, size_t nc, size_t nz)
void operator=(const FastSparseMatrix &M)
void read(std::istream &f)
virtual Dimension ncol() const
Tank::const_iterator const_iterator
const_iterator end() const
const_iterator begin() const
std::ostream & operator<<(std::ostream &os, const Conductivity< REP > &m)