![]() |
Dune-Fufem 2.11-git
|
Loading...
Searching...
No Matches
Dune::Fufem::NumPyCSRMatrix< T > Struct Template Reference
Struct providing raw storage for a flat CSR matrix using numpy arrays. More...
#include <dune/fufem/backends/numpybackend.hh>
Public Types | |
| using | size_type = std::size_t |
| using | field_type = T |
Public Member Functions | |
| auto | asTuple () |
| auto | asTuple () const |
Public Attributes | |
| pybind11::array_t< T > | entries |
| pybind11::array_t< size_type > | colIndices |
| pybind11::array_t< size_type > | rowPtrs |
| std::array< size_type, 2 > | shape |
Detailed Description
template<class T = double>
struct Dune::Fufem::NumPyCSRMatrix< T >
struct Dune::Fufem::NumPyCSRMatrix< T >
Struct providing raw storage for a flat CSR matrix using numpy arrays.
Since there's no C/C++ API for scipy.sparse.csr_matrix, we cannot directly implement a MatrixBackend for this. However, the csr_matrix uses a simple triple of numpy arrays as storage and can be constructed from one. Thus we can almost rely on automatic pybind11 conversion to create a csr_matrix. To this end we let pybind11 auto-convert asTuple() to Python which results in a nested tuple of numpy arrays. The result can be used to construct a csr_matrix in Python using csr_matrix(data[0], shape=data[1]).
Member Typedef Documentation
◆ field_type
template<class T = double>
| using Dune::Fufem::NumPyCSRMatrix< T >::field_type = T |
◆ size_type
template<class T = double>
| using Dune::Fufem::NumPyCSRMatrix< T >::size_type = std::size_t |
Member Function Documentation
◆ asTuple() [1/2]
template<class T = double>
|
inline |
◆ asTuple() [2/2]
template<class T = double>
|
inline |
Member Data Documentation
◆ colIndices
template<class T = double>
| pybind11::array_t<size_type> Dune::Fufem::NumPyCSRMatrix< T >::colIndices |
◆ entries
template<class T = double>
| pybind11::array_t<T> Dune::Fufem::NumPyCSRMatrix< T >::entries |
◆ rowPtrs
template<class T = double>
| pybind11::array_t<size_type> Dune::Fufem::NumPyCSRMatrix< T >::rowPtrs |
◆ shape
template<class T = double>
| std::array<size_type, 2> Dune::Fufem::NumPyCSRMatrix< T >::shape |
The documentation for this struct was generated from the following file:
