aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/BenchSparseUtil.h
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2008-10-19 17:06:11 +0000
committerGravatar Gael Guennebaud <g.gael@free.fr>2008-10-19 17:06:11 +0000
commit76fe2e1b34b4388ea3d9585bc840a0bab20ee5be (patch)
treea8d14974b78f46796a934a10b867286aaa88316d /bench/BenchSparseUtil.h
parentecc6c43dba2ca00d2f9d525dcd0d94941bea3fda (diff)
add/update some benchmark files used to test/compare sparse module features
Diffstat (limited to 'bench/BenchSparseUtil.h')
-rw-r--r--bench/BenchSparseUtil.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/bench/BenchSparseUtil.h b/bench/BenchSparseUtil.h
index 35c9a5263..26a2f47f2 100644
--- a/bench/BenchSparseUtil.h
+++ b/bench/BenchSparseUtil.h
@@ -72,3 +72,23 @@ void eiToMtl(const EigenSparseMatrix& src, MtlSparse& dst)
ins[it.index()][j] = it.value();
}
#endif
+
+#ifdef CSPARSE
+extern "C" {
+#include "cs.h"
+}
+void eiToCSparse(const EigenSparseMatrix& src, cs* &dst)
+{
+ cs* aux = cs_spalloc (0, 0, 1, 1, 1);
+ for (int j=0; j<src.cols(); ++j)
+ for (EigenSparseMatrix::InnerIterator it(src.derived(), j); it; ++it)
+ if (!cs_entry(aux, it.index(), j, it.value()))
+ {
+ std::cout << "cs_entry error\n";
+ exit(2);
+ }
+ dst = cs_compress(aux);
+// cs_spfree(aux);
+}
+
+#endif