22 #define MY_ZEROLIMIT 1e-10
60 for(
unsigned int k=
col[j];k<
col[j+1];k++)
105 this->
n = dense.
getn();
106 this->
m = dense.
getm();
114 for(
unsigned int j=0;j<
m;j++)
116 for(
unsigned int i=0;i<
n;i++)
119 data.push_back(dense(i,j));
136 unsigned int dn = dense.
getn();
137 unsigned int dm = dense.
getm();
139 assert(dn ==
n && dm ==
m);
141 for(
unsigned int i=0;i<
m;i++)
142 for(
unsigned int k=
col[i];k<
col[i+1];k++)
151 std::cout <<
n <<
" x " <<
m <<
" matrix" << std::endl;
152 std::cout <<
"Data(" <<
data.size() <<
"):" << std::endl;
153 for(
unsigned int i=0;i<
data.size();i++)
154 std::cout <<
data[i] <<
" ";
155 std::cout << std::endl;
157 std::cout <<
"Row indices:" << std::endl;
158 for(
unsigned int i=0;i<
row.size();i++)
159 std::cout <<
row[i] <<
" ";
160 std::cout << std::endl;
162 std::cout <<
"Col indices:" << std::endl;
163 for(
unsigned int i=0;i<
col.size();i++)
164 std::cout <<
col[i] <<
" ";
165 std::cout << std::endl;
176 for(
unsigned int i=0;i<matrix_p.
m;i++)
177 for(
unsigned int k=matrix_p.
row[i];k<matrix_p.
row[i+1];k++)
178 output << matrix_p.
row[k] <<
"\t" << i <<
"\t" << matrix_p.
data[k] << std::endl;
194 if(
row.empty() ||
row.back() < j ||
col.back() ==
row.size())
196 data.push_back(value);
201 unsigned int begin =
col.back();
202 for(
unsigned int i=begin;i<
row.size();i++)
206 row.insert(
row.begin() + i,j);
207 data.insert(
data.begin() + i,value);
209 }
else if (
row[i] == j)
216 row.erase(
row.begin() + i);
229 if(
col.size() == (
m+1))
243 return (
col[idx+1]-
col[idx]);
254 assert(col_index <
m);
255 assert((
col[col_index]+element_index) <
data.size());
256 return data[
col[col_index]+element_index];
267 assert((
col[col_index]+element_index) <
row.size());
268 return row[
col[col_index]+element_index];
281 assert(A.
getm() == B.
gn());
291 for(
int j=0;j<B.
gm();j++)
294 for(
int i=0;i<A.
getn();i++)