Re: [eigen] row and col setZero in sparse matrices

[ Thread Index | Date Index | More Archives ]


sorry for late reply.. I agree this would be convenient, but this would also be pretty slow, especially if you fix several values this ways. If A is column major:


-> fine

-> fine if we keep the memory allocated for col(dof), otherwise all remaining columns have to be copied to keep a compact storage.

This is basically a O(nnz) operation, so pretty costly if you do it multiple times.

-> fine if we kept a non-compact storage

Since in most cases you want to fix several unkowns, I usually build a permutation matrix P, permute A in a symmetric fashion (A1 = A.twistedBy(P)), and then pick sub matrices to solve:

A1.topLeftCorner(....) * x1.head(...) = b.head(...) - A1.topRightCorner(...) * values

and then apply P.inverse() on x1 to get x.


Mail converted by MHonArc 2.6.19+