blob: f71a69b078d0f19a01ba678fe78ee3d32b7f83f1 [file] [log] [blame]
Austin Schuh189376f2018-12-20 22:11:15 +11001SparseMatrix<double> A(3,3);
2A.insert(1,2) = 0;
3A.insert(0,1) = 1;
4A.insert(2,0) = 2;
5A.makeCompressed();
6cout << "The matrix A is:" << endl << MatrixXd(A) << endl;
7cout << "it has " << A.nonZeros() << " stored non zero coefficients that are: " << A.coeffs().transpose() << endl;
8A.coeffs() += 10;
9cout << "After adding 10 to every stored non zero coefficient, the matrix A is:" << endl << MatrixXd(A) << endl;