aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/snippets
diff options
context:
space:
mode:
Diffstat (limited to 'doc/snippets')
-rw-r--r--doc/snippets/CMakeLists.txt2
-rw-r--r--doc/snippets/Cwise_erf.cpp2
-rw-r--r--doc/snippets/Cwise_erfc.cpp2
-rw-r--r--doc/snippets/Cwise_lgamma.cpp2
-rw-r--r--doc/snippets/SparseMatrix_coeffs.cpp9
-rw-r--r--doc/snippets/compile_snippet.cpp.in5
6 files changed, 13 insertions, 9 deletions
diff --git a/doc/snippets/CMakeLists.txt b/doc/snippets/CMakeLists.txt
index 1135900cf..1baf32fba 100644
--- a/doc/snippets/CMakeLists.txt
+++ b/doc/snippets/CMakeLists.txt
@@ -24,5 +24,3 @@ foreach(snippet_src ${snippets_SRCS})
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src}
PROPERTIES OBJECT_DEPENDS ${snippet_src})
endforeach(snippet_src)
-
-ei_add_target_property(compile_tut_arithmetic_transpose_aliasing COMPILE_FLAGS -DEIGEN_NO_DEBUG)
diff --git a/doc/snippets/Cwise_erf.cpp b/doc/snippets/Cwise_erf.cpp
deleted file mode 100644
index 7f51c1b6a..000000000
--- a/doc/snippets/Cwise_erf.cpp
+++ /dev/null
@@ -1,2 +0,0 @@
-Array4d v(-0.5,2,0,-7);
-cout << v.erf() << endl;
diff --git a/doc/snippets/Cwise_erfc.cpp b/doc/snippets/Cwise_erfc.cpp
deleted file mode 100644
index f0453d4b1..000000000
--- a/doc/snippets/Cwise_erfc.cpp
+++ /dev/null
@@ -1,2 +0,0 @@
-Array4d v(-0.5,2,0,-7);
-cout << v.erfc() << endl;
diff --git a/doc/snippets/Cwise_lgamma.cpp b/doc/snippets/Cwise_lgamma.cpp
deleted file mode 100644
index cbc69b989..000000000
--- a/doc/snippets/Cwise_lgamma.cpp
+++ /dev/null
@@ -1,2 +0,0 @@
-Array4d v(0.5,10,0,-1);
-cout << v.lgamma() << endl; \ No newline at end of file
diff --git a/doc/snippets/SparseMatrix_coeffs.cpp b/doc/snippets/SparseMatrix_coeffs.cpp
new file mode 100644
index 000000000..f71a69b07
--- /dev/null
+++ b/doc/snippets/SparseMatrix_coeffs.cpp
@@ -0,0 +1,9 @@
+SparseMatrix<double> A(3,3);
+A.insert(1,2) = 0;
+A.insert(0,1) = 1;
+A.insert(2,0) = 2;
+A.makeCompressed();
+cout << "The matrix A is:" << endl << MatrixXd(A) << endl;
+cout << "it has " << A.nonZeros() << " stored non zero coefficients that are: " << A.coeffs().transpose() << endl;
+A.coeffs() += 10;
+cout << "After adding 10 to every stored non zero coefficient, the matrix A is:" << endl << MatrixXd(A) << endl;
diff --git a/doc/snippets/compile_snippet.cpp.in b/doc/snippets/compile_snippet.cpp.in
index fdae39bcf..d63f371a3 100644
--- a/doc/snippets/compile_snippet.cpp.in
+++ b/doc/snippets/compile_snippet.cpp.in
@@ -1,5 +1,8 @@
-#include <Eigen/Eigen>
+static bool eigen_did_assert = false;
+#define eigen_assert(X) if(!eigen_did_assert && !(X)){ std::cout << "### Assertion raised in " << __FILE__ << ":" << __LINE__ << ":\n" #X << "\n### The following would happen without assertions:\n"; eigen_did_assert = true;}
+
#include <iostream>
+#include <Eigen/Eigen>
#ifndef M_PI
#define M_PI 3.1415926535897932384626433832795