|
| | ParallelSparseMatrix () |
| |
| | ParallelSparseMatrix (Eigen::Index nrow, Eigen::Index ncol, ValueArray_ x, IndexArray_ i, PointerArray_ p, bool column_major, int num_threads) |
| |
| Eigen::Index | rows () const |
| |
| Eigen::Index | cols () const |
| |
| const ValueArray_ & | get_values () const |
| |
| const IndexArray_ & | get_indices () const |
| |
| const PointerArray_ & | get_pointers () const |
| |
| const std::vector< Eigen::Index > & | get_primary_boundaries () const |
| |
| const std::vector< Eigen::Index > & | get_secondary_boundaries () const |
| |
| const std::vector< std::vector< PointerType > > & | get_secondary_nonzero_boundaries () const |
| |
| std::unique_ptr< Workspace< EigenVector_ > > | new_workspace () const |
| |
| std::unique_ptr< AdjointWorkspace< EigenVector_ > > | new_adjoint_workspace () const |
| |
| std::unique_ptr< RealizeWorkspace< EigenMatrix_ > > | new_realize_workspace () const |
| |
| std::unique_ptr< ParallelSparseWorkspace< EigenVector_, ValueArray_, IndexArray_, PointerArray_ > > | new_known_workspace () const |
| |
| std::unique_ptr< ParallelSparseAdjointWorkspace< EigenVector_, ValueArray_, IndexArray_, PointerArray_ > > | new_known_adjoint_workspace () const |
| |
| std::unique_ptr< ParallelSparseRealizeWorkspace< EigenMatrix_, ValueArray_, IndexArray_, PointerArray_ > > | new_known_realize_workspace () const |
| |
| std::unique_ptr< Workspace< EigenVector_ > > | new_known_workspace () const |
| |
| std::unique_ptr< AdjointWorkspace< EigenVector_ > > | new_known_adjoint_workspace () const |
| |
| std::unique_ptr< RealizeWorkspace< EigenMatrix_ > > | new_known_realize_workspace () const |
| |
template<class EigenVector_, class EigenMatrix_, class ValueArray_, class IndexArray_, class PointerArray_>
class irlba::ParallelSparseMatrix< EigenVector_, EigenMatrix_, ValueArray_, IndexArray_, PointerArray_ >
Sparse matrix with customizable parallelization.
This provides an alternative to Eigen::SparseMatrix for parallelized multiplication of compressed sparse matrices. Unlike Eigen's sparse matrix, this implementation is able to parallelize when the multiplication does not align well with the storage layout, e.g., multiplication of a compressed sparse column matrix by a dense vector on the right hand side. On construction, it also pre-allocates the rows and/or columns to each thread, aiming to balance the number of non-zero elements that each thread needs to process. All subsequent multiplications can then use these allocations, which is useful for compute() where the cost of pre-allocation is abrogated by repeated multiplication calls.
Some cursory testing indicates that the performance of this implementation is comparable to Eigen for OpenMP-based parallelization. However, the real purpose of this class is to support custom parallelization schemes in cases where OpenMP is not available. This is achieved by defining IRLBA_CUSTOM_PARALLEL macro to the name of a function implementing a custom scheme. Such a function should accept two arguments - an integer specifying the number of threads, and a lambda that accepts a thread number. It should then loop over the number of threads and launch one job for each thread via the lambda. Once all threads are complete, the function should return.
- Template Parameters
-
| EigenVector_ | A floating-point Eigen::Vector to be used as input/output of multiplication operations. |
| EigenMatrix_ | A dense floating-point Eigen::Matrix in which to store the realized matrix. Typically of the same scalar type as EigenVector_. |
| ValueArray_ | Array class containing numeric values for the non-zero values. Should support a read-only [] operator. |
| IndexArray_ | Array class containing integer values for the indices of the non-zero values. Should support a read-only [] operator. |
| PointerArray_ | Array class containing integer values for the pointers to the row/column boundaries. Should support a read-only [] operator. |