|
numerics
|
Banded matrix with efficient storage for direct solvers. More...
#include <banded.hpp>
Public Member Functions | |
| BandedMatrix (idx n, idx kl, idx ku) | |
| Construct a banded matrix. | |
| BandedMatrix (idx n, idx kl, idx ku, real val) | |
| Construct with initial value. | |
| ~BandedMatrix () | |
| BandedMatrix (const BandedMatrix &) | |
| BandedMatrix (BandedMatrix &&) noexcept | |
| BandedMatrix & | operator= (const BandedMatrix &) |
| BandedMatrix & | operator= (BandedMatrix &&) noexcept |
| idx | size () const |
| Matrix dimension. | |
| idx | rows () const |
| idx | cols () const |
| idx | kl () const |
| Number of lower diagonals. | |
| idx | ku () const |
| Number of upper diagonals. | |
| idx | bandwidth () const |
| Total bandwidth (kl + ku + 1) | |
| idx | ldab () const |
| Leading dimension of band storage (2*kl + ku + 1) | |
| real & | operator() (idx i, idx j) |
| Access element at (row, col) in original matrix coordinates. | |
| real | operator() (idx i, idx j) const |
| real & | band (idx band_row, idx col) |
| Direct access to band storage. | |
| real | band (idx band_row, idx col) const |
| real * | data () |
| Raw pointer to band storage (column-major) | |
| const real * | data () const |
| bool | in_band (idx i, idx j) const |
| Check if (i,j) is within the band. | |
| void | to_gpu () |
| void | to_cpu () |
| real * | gpu_data () |
| const real * | gpu_data () const |
| bool | on_gpu () const |
Banded matrix with efficient storage for direct solvers.
Uses LAPACK-style band storage format optimized for LU factorization. For a matrix with kl lower diagonals and ku upper diagonals, storage layout is:
Element A(i,j) is stored at band(kl + ku + i - j, j) for max(0,j-ku) <= i <= min(n-1,j+kl)
This format enables:
Definition at line 32 of file banded.hpp.
Construct a banded matrix.
| n | Matrix dimension (n x n) |
| kl | Number of lower diagonals |
| ku | Number of upper diagonals |
Definition at line 20 of file banded.cpp.
| num::BandedMatrix::~BandedMatrix | ( | ) |
Definition at line 31 of file banded.cpp.
References num::cuda::free().
| num::BandedMatrix::BandedMatrix | ( | const BandedMatrix & | other | ) |
Definition at line 37 of file banded.cpp.
References num::ipow().
|
noexcept |
Definition at line 44 of file banded.cpp.
References num::ipow().
Direct access to band storage.
| band_row | Row in band storage (0 to ldab-1) |
| col | Column index (0 to n-1) |
Definition at line 84 of file banded.cpp.
References num::ipow().
Definition at line 88 of file banded.cpp.
References num::ipow().
|
inline |
Total bandwidth (kl + ku + 1)
Definition at line 63 of file banded.hpp.
|
inline |
Definition at line 54 of file banded.hpp.
|
inline |
Raw pointer to band storage (column-major)
Definition at line 82 of file banded.hpp.
Definition at line 83 of file banded.hpp.
|
inline |
Definition at line 91 of file banded.hpp.
Definition at line 92 of file banded.hpp.
Check if (i,j) is within the band.
Definition at line 92 of file banded.cpp.
References num::ipow().
|
inline |
Number of lower diagonals.
Definition at line 57 of file banded.hpp.
|
inline |
Number of upper diagonals.
Definition at line 60 of file banded.hpp.
|
inline |
Leading dimension of band storage (2*kl + ku + 1)
Definition at line 66 of file banded.hpp.
|
inline |
Definition at line 93 of file banded.hpp.
Access element at (row, col) in original matrix coordinates.
| i | Row index (0-based) |
| j | Column index (0-based) |
Definition at line 76 of file banded.cpp.
References num::ipow().
Definition at line 80 of file banded.cpp.
References num::ipow().
|
noexcept |
Definition at line 63 of file banded.cpp.
References num::cuda::free(), and num::ipow().
| BandedMatrix & num::BandedMatrix::operator= | ( | const BandedMatrix & | other | ) |
Definition at line 51 of file banded.cpp.
References num::cuda::free(), and num::ipow().
|
inline |
Definition at line 53 of file banded.hpp.
|
inline |
Matrix dimension.
Definition at line 52 of file banded.hpp.
| void num::BandedMatrix::to_cpu | ( | ) |
Definition at line 103 of file banded.cpp.
References num::cuda::to_host().
| void num::BandedMatrix::to_gpu | ( | ) |
Definition at line 96 of file banded.cpp.
References num::cuda::alloc(), and num::cuda::to_device().