13 #define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET
23 #include <ecl/linear_algebra/sparse.hpp>
29 using ecl::linear_algebra::SparseMatrix;
30 using ecl::linear_algebra::DynamicSparseMatrix;
31 using ecl::linear_algebra::MatrixXd;
40 DynamicSparseMatrix<double> hh(20,
LM);
44 for(
int i=0; i<20; i++ )
45 for(
int j=0; j<3; j++ )
48 for(
int i=0; i<10; i++)
50 for(
int j=0; j<2; j++ )
52 for(
int k=0; k<3; k++ )
54 hh.coeffRef( i*2+j, (i*4)+k ) = 1;
59 SparseMatrix<double> H(hh);
61 for(
int i=0; i<num; i++ )
63 MatrixXd S = H*P*H.transpose();
66 std::cout << time.elapsed();
75 for(
int i=0; i<20; i++ )
76 for(
int j=0; j<3; j++ )
79 for(
int i=0; i<10; i++)
81 for(
int j=0; j<2; j++ )
83 for(
int k=0; k<3; k++ )
85 H( i*2+j, (i*4)+k ) = 1;
91 for(
int i=0; i<num; i++ )
93 MatrixXd S = H*P*H.transpose();
96 std::cout << time.elapsed();
101 std::cout <<
"==========================" << std::endl;
102 std::cout <<
"S=H P T'" << std::endl;
103 std::cout <<
"Start sparse: ";
105 std::cout << std::endl;
107 std::cout <<
"Start dense: ";
109 std::cout << std::endl;
110 std::cout <<
"==========================" << std::endl;
116 DynamicSparseMatrix<double> hh(20,
LM);
117 for(
int i=0; i<num; i++)
119 for(
int j=0; j<20; j++ )
120 for(
int k=0; k<
LM; k++ )
121 hh.coeffRef(j,k) = (double)j*k;
124 std::cout << time.elapsed();
131 for(
int i=0; i<num; i++ )
133 for(
int j=0; j<20; j++ )
134 for(
int k=0; k<
LM; k++ )
135 hh(j,k) = (double)j*k;
138 std::cout << time.elapsed();
143 std::cout <<
"==========================" << std::endl;
144 std::cout <<
"Filling " << std::endl;
145 std::cout <<
"fill sparse: ";
147 std::cout << std::endl;
148 std::cout <<
"fill dense: ";
150 std::cout << std::endl;
151 std::cout <<
"==========================" << std::endl;
154 int main(
int argc,
char **argv) {