aboutsummaryrefslogtreecommitdiff
path: root/doc/special_examples/Tutorial_sparse_example.cpp
diff options
context:
space:
mode:
authorYi Kong <yikong@google.com>2022-02-25 16:32:14 +0800
committerYi Kong <yikong@google.com>2022-02-25 15:08:55 +0000
commit2aab794c004027d008d6b0b64165bf1961d5d2bb (patch)
tree83bb8f19c67bcafdb2ca4a98414af1b17392ec36 /doc/special_examples/Tutorial_sparse_example.cpp
parentca5aa72016f062fd0712bcb86370478de332bca3 (diff)
downloadeigen-2aab794c004027d008d6b0b64165bf1961d5d2bb.tar.gz
Upgrade eigen to 3.4.0
Steps: * Removed common files between Android copy and the matching upstream copy * Obtained latest upstream tarball (see README.version) * Extracted over the directory Bug: 148287349 Test: presubmit Change-Id: Iee2744719075fdf000b315e973645923da766111
Diffstat (limited to 'doc/special_examples/Tutorial_sparse_example.cpp')
-rw-r--r--doc/special_examples/Tutorial_sparse_example.cpp8
1 files changed, 6 insertions, 2 deletions
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