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);
51 inline void info()
const;
57 size_t nz =
M.rowindex[
M.nlin()];
58 f <<
M.nlin() <<
" " <<
M.ncol() << std::endl;
60 for(
size_t i=0;
i<
M.nlin();
i++)
62 for(
size_t j=
M.rowindex[
i];
j<
M.rowindex[
i+1];
j++)
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;
93 alloc(
M.m_nlin,
M.m_ncol,
M.rowindex[
M.m_nlin]);
95 memcpy(
js,
M.js,
sizeof(
size_t)*
M.rowindex[
M.m_nlin]);
101 tank=
new double[
M.size()];
102 js=
new size_t[
M.size()];
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;
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;
201 if(
js[
k]<
j)
continue;
206 throw OpenMEEG::maths::BadSparseOperation(
"FastSparseMatrix : double& operator()(size_t i,size_t j) can't add element");
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)
Vector operator()(const Vector &g) const
Tank::const_iterator const_iterator
Vect3 operator*(const double d, const Vect3 &V)
std::ostream & operator<<(std::ostream &os, const Conductivity< REP > &m)