I want to add two sparse matrices together in C++?
If you use the boost::ublas library, then you can simply add them together, something like this.
#include <boost/numeric/ublas/matrix_sparse.hpp>
using namespace boost::numeric::ublas;
compressed_matrix<double > A(30000, 100, 30000 ),B(30000, 100, 30000 ),C(30000, 100, 30000 );
A(1,1) = 1.0;
B(99,99) = 10.0;
C = A + B;