44 { 11., 0., 13., 0., 15. },
45 { 0., 22., 0., 24., 0. },
46 { 31., 0., 33., 0., 35. },
47 { 0., 42., 0., 44., 0. },
48 { 51., 0., 53., 0., 55. }
54 std::vector<integer> perm(5), invperm(5);
60 for (
int i = 0; i < 5; i++) {
69 for (
int r = 0; r < 5; r++) {
70 for (
int c = 0;
c < 5;
c++) {
71 if (
mat[r][
c] != 0.) {
72 fm(r + 1,
c + 1) =
mat[r][
c];
73 spm(r + 1,
c + 1) =
mat[r][
c];
74 nm(r + 1,
c + 1) =
mat[r][
c];
75 npm(r + 1,
c + 1) =
mat[r][
c];
80 std::cout <<
"matrix in full form: " << std::endl
83 std::cout <<
"matrix in sparse form: " << std::endl
86 std::cout <<
"matrix in naive form: " << std::endl
89 std::cout <<
"matrix in naive permuted form: " << std::endl
92 std::vector<doublereal> Ax0;
93 std::vector<integer> Ai0, Ap0;
98 std::cout <<
"matrix in cc<0> form: " << std::endl
101 std::cout <<
"matrix in cc<0> form again: " << std::endl;
103 for (
int ir = 1; ir <= 5; ir++) {
104 for (
int ic = 1; ic <= 5; ic++) {
105 std::cout << std::setw(16) << const_ccm0(ir, ic);
107 std::cout << std::endl;
110 std::vector<doublereal> Ax1;
111 std::vector<integer> Ai1, Ap1;
116 std::cout <<
"matrix in cc<1> form: " << std::endl
117 << ccm1 << std::endl;
119 std::cout <<
"matrix in cc<1> form again: " << std::endl;
121 for (
int ir = 1; ir <= 5; ir++) {
122 for (
int ic = 1; ic <= 5; ic++) {
123 std::cout << std::setw(16) << const_ccm1(ir, ic);
125 std::cout << std::endl;
129 std::cout <<
"matrix in dir<0> form: " << std::endl
130 << dirm0 << std::endl;
132 std::cout <<
"matrix in dir<0> form again: " << std::endl;
134 for (
int ir = 1; ir <= 5; ir++) {
135 for (
int ic = 1; ic <= 5; ic++) {
136 std::cout << std::setw(16) << const_dirm0(ir, ic);
138 std::cout << std::endl;
142 std::cout <<
"matrix in dir<1> form: " << std::endl
143 << dirm1 << std::endl;
145 std::cout <<
"matrix in dir<1> form again: " << std::endl;
147 for (
int ir = 1; ir <= 5; ir++) {
148 for (
int ic = 1; ic <= 5; ic++) {
149 std::cout << std::setw(16) << const_dirm1(ir, ic);
151 std::cout << std::endl;
154 std::cout <<
"***************************" << std::endl
155 <<
"full matrix handler:" << std::endl;
160 std::cout <<
"(" << i->iRow <<
", " << i->iCol <<
", " << i->dCoef <<
")" << std::endl;
161 if (
mat[i->iRow][i->iCol] != i->dCoef) {
162 std::cout <<
"==> failed!" << std::endl;
166 std::cout <<
"***************************" << std::endl
167 <<
"sparse map matrix handler:" << std::endl;
172 std::cout <<
"(" << i->iRow <<
", " << i->iCol <<
", " << i->dCoef <<
")" << std::endl;
173 if (
mat[i->iRow][i->iCol] != i->dCoef) {
174 std::cout <<
"==> failed!" << std::endl;
178 std::cout <<
"***************************" << std::endl
179 <<
"naive sparse matrix handler:" << std::endl;
183 std::cout <<
"(" << i->iRow <<
", " << i->iCol <<
", " << i->dCoef <<
")" << std::endl;
184 if (
mat[i->iRow][i->iCol] != i->dCoef) {
185 std::cout <<
"==> failed!" << std::endl;
189 std::cout <<
"***************************" << std::endl
190 <<
"naive permuted sparse matrix handler:" << std::endl;
194 std::cout <<
"(" << i->iRow <<
", " << i->iCol <<
", " << i->dCoef <<
")" << std::endl;
195 if (
mat[i->iRow][i->iCol] != i->dCoef) {
196 std::cout <<
"==> failed!" << std::endl;
200 std::cout <<
"***************************" << std::endl
201 <<
"column compressed <0> sparse matrix handler:" << std::endl;
203 i != ccm0.
end(); ++i)
205 std::cout <<
"(" << i->iRow <<
", " << i->iCol <<
", " << i->dCoef <<
")" << std::endl;
206 if (
mat[i->iRow][i->iCol] != i->dCoef) {
207 std::cout <<
"==> failed!" << std::endl;
211 std::cout <<
"***************************" << std::endl
212 <<
"column compressed <1> sparse matrix handler:" << std::endl;
214 i != ccm1.
end(); ++i)
216 std::cout <<
"(" << i->iRow <<
", " << i->iCol <<
", " << i->dCoef <<
")" << std::endl;
217 if (
mat[i->iRow][i->iCol] != i->dCoef) {
218 std::cout <<
"==> failed!" << std::endl;
222 std::cout <<
"***************************" << std::endl
223 <<
"dir column compressed <0> sparse matrix handler:" << std::endl;
225 i != dirm0.
end(); ++i)
227 std::cout <<
"(" << i->iRow <<
", " << i->iCol <<
", " << i->dCoef <<
")" << std::endl;
228 if (
mat[i->iRow][i->iCol] != i->dCoef) {
229 std::cout <<
"==> failed!" << std::endl;
233 std::cout <<
"***************************" << std::endl
234 <<
"dir column compressed <1> sparse matrix handler:" << std::endl;
236 i != dirm1.
end(); ++i)
238 std::cout <<
"(" << i->iRow <<
", " << i->iCol <<
", " << i->dCoef <<
")" << std::endl;
239 if (
mat[i->iRow][i->iCol] != i->dCoef) {
240 std::cout <<
"==> failed!" << std::endl;
NaiveMatrixHandler::const_iterator begin(void) const
integer MakeCompressedColumnForm(doublereal *const Ax, integer *const Ai, integer *const Ap, int offset=0) const
const NaiveMatrixHandler::const_iterator & end(void) const
const FullMatrixHandler::const_iterator & end(void) const
FullMatrixHandler::const_iterator begin(void) const
CompactSparseMatrixHandler_tpl< off >::const_iterator begin(void) const
const SpMapMatrixHandler::const_iterator & end(void) const
const NaivePermMatrixHandler::const_iterator & end(void) const
const CompactSparseMatrixHandler_tpl< off >::const_iterator & end(void) const
SpMapMatrixHandler::const_iterator begin(void) const
static std::stack< cleanup * > c
static doublereal mat[5][5]
NaivePermMatrixHandler::const_iterator begin(void) const