This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Sparse Matrix - Matrix Products

Tags: None
(comma "," separated)
davidmckinnon
Registered Member
Posts
3
Karma
0

Sparse Matrix - Matrix Products

Thu Sep 04, 2014 2:21 am
Hi,

I am trying to work out the quickest way of doing a sparse matrix-matrix product for the purpose of forming the normal equations.

In the dense case I have done this previously which seems to be optimal.

Matrix<double, Dynamic, Dynamic> J; // some jacobian matrix
Matrix<double, Dynamic, Dynamic> N; // normal equations
N.selfadjointView<Eigen::Upper>().rankUpdate(J.transpose());

trying this also with Sparse seems to compile but I get a crash at runtime

SparseMatrix<double> J; // some sparse jacobian matrix
SparseMatrix<double> N; // sparse normal equations
N.selfadjointView<Eigen::Upper>().rankUpdate(J.transpose());

Firstly, is this possible for sparse?

Secondly, is this in fact the best way to go about this special case when I am transposing a matrix against itself?

I.e. I know the outcome will be symmetric and I really only want to be calculating the upper-triangular portion anyway.

Or should I just stick to this?

SparseMatrix<double> N = J.transpose() * J;

Many thanks,
David...


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]