#include <SparseMatrixProduct.h>
Given two matrices, compute the product of both matrices. The first time the algorithm runs, it computes the "intersection" between both matrices. This intersection can be reused to compute the product. If, later, both input matrices changed their values, but not their sparsity pattern, the "intersection" remains valid. The same intersection can be used to compute the product as long as the sparsity pattern does not change. This strategy is faster than calling the regular matrix product algorithm (but not if the size of the intersection is huge).
To compute the product, the method computeProduct must be called.
Based on: Saupin, G., Duriez, C. and Grisoni, L., 2007, November. Embedded multigrid approach for real-time volumetric deformation. In International Symposium on Visual Computing (pp. 149-159). Springer, Berlin, Heidelberg. and Saupin, G., 2008. Vers la simulation interactive réaliste de corps déformables virtuels (Doctoral dissertation, Lille 1).
Classes | |
struct | Intersection |
Public Attributes | |
const LhsCleaned * | m_lhs { nullptr } |
Left side of the product A*B. More... | |
const RhsCleaned * | m_rhs { nullptr } |
Right side of the product A*B. More... | |
Protected Attributes | |
ProductResult | m_productResult |
bool | m_hasComputedIntersection { false } |
Result of LHS * RHS. More... | |
Intersection | m_intersectionAB |
Public Member Functions | |
void | computeProduct (bool forceComputeIntersection=false) |
void | computeRegularProduct () |
const ResultType & | getProductResult () const |
void | invalidateIntersection () |
SparseMatrixProduct (Lhs *lhs, Rhs *rhs) | |
SparseMatrixProduct ()=default | |
virtual | ~SparseMatrixProduct ()=default |
Protected Member Functions | |
void | computeIntersection () |
virtual void | computeProductFromIntersection () |
|
protected |
Result of LHS * RHS.
|
protected |
const LhsCleaned* sofa::linearalgebra::SparseMatrixProduct< Lhs, Rhs, ResultType >::m_lhs { nullptr } |
Left side of the product A*B.
|
protected |
const RhsCleaned* sofa::linearalgebra::SparseMatrixProduct< Lhs, Rhs, ResultType >::m_rhs { nullptr } |
Right side of the product A*B.
|
inline |
|
default |
|
virtualdefault |
|
protected |
void sofa::linearalgebra::SparseMatrixProduct< Lhs, Rhs, ResultType >::computeProduct | ( | bool | forceComputeIntersection = false | ) |
|
protectedvirtual |
Reimplemented in sofa::simulation::ParallelSparseMatrixProduct< Lhs, Rhs, ResultType >.
void sofa::linearalgebra::SparseMatrixProduct< Lhs, Rhs, ResultType >::computeRegularProduct |
|
inline |
void sofa::linearalgebra::SparseMatrixProduct< Lhs, Rhs, ResultType >::invalidateIntersection |