aboutsummaryrefslogtreecommitdiff
path: root/doc/special_examples
diff options
context:
space:
mode:
Diffstat (limited to 'doc/special_examples')
-rw-r--r--doc/special_examples/CMakeLists.txt5
-rw-r--r--doc/special_examples/Tutorial_sparse_example.cpp8
2 files changed, 8 insertions, 5 deletions
diff --git a/doc/special_examples/CMakeLists.txt b/doc/special_examples/CMakeLists.txt
index 101fbc5f9..5b00e8b1a 100644
--- a/doc/special_examples/CMakeLists.txt
+++ b/doc/special_examples/CMakeLists.txt
@@ -3,7 +3,7 @@ if(NOT EIGEN_TEST_NOQT)
if(QT4_FOUND)
include(${QT_USE_FILE})
endif()
-endif(NOT EIGEN_TEST_NOQT)
+endif()
if(QT4_FOUND)
add_executable(Tutorial_sparse_example Tutorial_sparse_example.cpp Tutorial_sparse_example_details.cpp)
@@ -17,9 +17,8 @@ if(QT4_FOUND)
)
add_dependencies(all_examples Tutorial_sparse_example)
-endif(QT4_FOUND)
+endif()
-check_cxx_compiler_flag("-std=c++11" EIGEN_COMPILER_SUPPORT_CPP11)
if(EIGEN_COMPILER_SUPPORT_CPP11)
add_executable(random_cpp11 random_cpp11.cpp)
target_link_libraries(random_cpp11 ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})
diff --git a/doc/special_examples/Tutorial_sparse_example.cpp b/doc/special_examples/Tutorial_sparse_example.cpp
index 830e196ea..8850db052 100644
--- a/doc/special_examples/Tutorial_sparse_example.cpp
+++ b/doc/special_examples/Tutorial_sparse_example.cpp
@@ -1,5 +1,6 @@
#include <Eigen/Sparse>
#include <vector>
+#include <iostream>
typedef Eigen::SparseMatrix<double> SpMat; // declares a column-major sparse matrix type of double
typedef Eigen::Triplet<double> T;
@@ -9,10 +10,13 @@ void saveAsBitmap(const Eigen::VectorXd& x, int n, const char* filename);
int main(int argc, char** argv)
{
- assert(argc==2);
+ if(argc!=2) {
+ std::cerr << "Error: expected one and only one argument.\n";
+ return -1;
+ }
int n = 300; // size of the image
- int m = n*n; // number of unknows (=number of pixels)
+ int m = n*n; // number of unknowns (=number of pixels)
// Assembly:
std::vector<T> coefficients; // list of non-zeros coefficients