guanaqo 1.0.0-alpha.26
Utilities for scientific software
Loading...
Searching...
No Matches
Linear Algebra Views

Detailed Description

Dense matrix views and Eigen interop adapters.

Collaboration diagram for Linear Algebra Views:

Files

file  span.hpp
 Conversions between Eigen vector views and std::span.
file  view.hpp
 Conversions between Eigen expressions, maps and refs, and guanaqo::MatrixView.
file  config.hpp
 Common linear algebra index types.
file  matrix-view.hpp
 Non-owning view over values plus sparsity description.
file  mat-view.hpp
 Non-owning matrix view.
file  matrix-view.hpp
 Conversion between guanaqo::MatrixView and NumPy arrays for nanobind bindings.

Classes

struct  guanaqo::linalg::MatrixView< T >
 Non-owning view of dense and various formats of sparse matrix. More...
struct  guanaqo::default_stride< S >
 Get the default stride value for a given integer type (primary template). More...
struct  guanaqo::default_stride< S >
 Get the default stride value for a run-time integer type. More...
struct  guanaqo::MatrixView< T, I, S, O >
 A lightweight view of a 2D matrix. More...
struct  nanobind::detail::type_caster< guanaqo::MatrixView< T, I, S, O > >
 Nanobind type caster for guanaqo::MatrixView. More...

Typedefs

using guanaqo::linalg::index_t = std::ptrdiff_t
using guanaqo::linalg::length_t = std::ptrdiff_t
template<class T, class I = ptrdiff_t, class S = std::integral_constant<I, 1>>
using guanaqo::MatrixViewRM = MatrixView<T, I, S, StorageOrder::RowMajor>
 Convenience alias for a row-major MatrixView.

Enumerations

enum class  guanaqo::StorageOrder : bool { guanaqo::StorageOrder::ColMajor , guanaqo::StorageOrder::RowMajor }
 Storage order of matrices. More...
enum class  guanaqo::Triangular { guanaqo::Triangular::Lower , guanaqo::Triangular::StrictlyLower , guanaqo::Triangular::Upper , guanaqo::Triangular::StrictlyUpper }
 Triangular matrix structure. More...

Functions

template<class Derived>
auto guanaqo::as_span (Eigen::DenseBase< Derived > &v)
 Convert an Eigen vector view to a std::span.
template<class Derived>
auto guanaqo::as_span (Eigen::DenseBase< Derived > &&v)
 Convert an Eigen vector view to a std::span.
template<class Derived>
auto guanaqo::as_span (const Eigen::DenseBase< Derived > &v)
 Convert an Eigen vector view to a std::span.
template<class T, size_t E>
auto guanaqo::as_eigen (std::span< T, E > s)
 Convert a std::span to an Eigen::Vector view.
template<class T, size_t E>
auto guanaqo::as_vec (std::span< T, E > s)
template<class Derived, class I = typename Derived::Index>
auto guanaqo::as_view (Eigen::DenseBase< Derived > &M, with_index_type_t< I >={})
 Convert an Eigen matrix view to a guanaqo::MatrixView.
template<class Derived, class I = typename Derived::Index>
auto guanaqo::as_view (const Eigen::DenseBase< Derived > &M, with_index_type_t< I >={})
 Convert an Eigen matrix view to a guanaqo::MatrixView.
template<class Derived, class I = typename Derived::Index>
auto guanaqo::as_view (Eigen::DenseBase< Derived > &&M, with_index_type_t< I >={})
 Convert an Eigen matrix view to a guanaqo::MatrixView.
template<class Derived, class I = typename Derived::Index>
auto guanaqo::as_view (const Eigen::DenseBase< Derived > &&M, with_index_type_t< I >={})
 Convert an Eigen matrix view to a guanaqo::MatrixView.
template<class T, class I, class S, StorageOrder O>
auto guanaqo::as_eigen (MatrixView< T, I, S, O > M)
 Convert a guanaqo::MatrixView to an Eigen::Matrix view.
constexpr StorageOrder guanaqo::transpose (StorageOrder o)
 Transpose the storage order (swaps row and column major).

Class Documentation

◆ guanaqo::default_stride

struct guanaqo::default_stride
Collaboration diagram for guanaqo::default_stride< S >:

Typedef Documentation

◆ index_t

using guanaqo::linalg::index_t = std::ptrdiff_t

#include <guanaqo/linalg/config.hpp>

Definition at line 12 of file config.hpp.

◆ length_t

using guanaqo::linalg::length_t = std::ptrdiff_t

#include <guanaqo/linalg/config.hpp>

Definition at line 14 of file config.hpp.

◆ MatrixViewRM

template<class T, class I = ptrdiff_t, class S = std::integral_constant<I, 1>>
using guanaqo::MatrixViewRM = MatrixView<T, I, S, StorageOrder::RowMajor>

#include <guanaqo/mat-view.hpp>

Convenience alias for a row-major MatrixView.

Definition at line 429 of file mat-view.hpp.

Enumeration Type Documentation

◆ StorageOrder

enum class guanaqo::StorageOrder : bool
strong

#include <guanaqo/mat-view.hpp>

Storage order of matrices.

Enumerator
ColMajor 

Column-major storage order (Fortran-style, layout left, unit row stride).

RowMajor 

Row-major storage order (C-style, layout right, unit column stride).

Definition at line 20 of file mat-view.hpp.

◆ Triangular

enum class guanaqo::Triangular
strong

#include <guanaqo/mat-view.hpp>

Triangular matrix structure.

Enumerator
Lower 

Lower triangular (including diagonal).

StrictlyLower 

Strictly lower triangular (excluding diagonal).

Upper 

Upper triangular (including diagonal).

StrictlyUpper 

Strictly upper triangular (excluding diagonal).

Definition at line 35 of file mat-view.hpp.

Function Documentation

◆ as_span() [1/3]

template<class Derived>
auto guanaqo::as_span ( Eigen::DenseBase< Derived > & v)

#include <guanaqo/eigen/span.hpp>

Convert an Eigen vector view to a std::span.

Definition at line 29 of file span.hpp.

◆ as_span() [2/3]

template<class Derived>
auto guanaqo::as_span ( Eigen::DenseBase< Derived > && v)

#include <guanaqo/eigen/span.hpp>

Convert an Eigen vector view to a std::span.

Definition at line 39 of file span.hpp.

◆ as_span() [3/3]

template<class Derived>
auto guanaqo::as_span ( const Eigen::DenseBase< Derived > & v)

#include <guanaqo/eigen/span.hpp>

Convert an Eigen vector view to a std::span.

Definition at line 53 of file span.hpp.

◆ as_eigen() [1/2]

template<class T, size_t E>
auto guanaqo::as_eigen ( std::span< T, E > s)

#include <guanaqo/eigen/span.hpp>

Convert a std::span to an Eigen::Vector view.

Definition at line 62 of file span.hpp.

Here is the caller graph for this function:

◆ as_vec()

template<class T, size_t E>
auto guanaqo::as_vec ( std::span< T, E > s)

#include <guanaqo/eigen/span.hpp>

Definition at line 74 of file span.hpp.

Here is the call graph for this function:

◆ as_view() [1/4]

template<class Derived, class I = typename Derived::Index>
auto guanaqo::as_view ( Eigen::DenseBase< Derived > & M,
with_index_type_t< I > = {} )

#include <guanaqo/eigen/view.hpp>

Convert an Eigen matrix view to a guanaqo::MatrixView.

Definition at line 69 of file view.hpp.

◆ as_view() [2/4]

template<class Derived, class I = typename Derived::Index>
auto guanaqo::as_view ( const Eigen::DenseBase< Derived > & M,
with_index_type_t< I > = {} )

#include <guanaqo/eigen/view.hpp>

Convert an Eigen matrix view to a guanaqo::MatrixView.

Definition at line 75 of file view.hpp.

◆ as_view() [3/4]

template<class Derived, class I = typename Derived::Index>
auto guanaqo::as_view ( Eigen::DenseBase< Derived > && M,
with_index_type_t< I > = {} )
delete

#include <guanaqo/eigen/view.hpp>

Convert an Eigen matrix view to a guanaqo::MatrixView.

Definition at line 81 of file view.hpp.

◆ as_view() [4/4]

template<class Derived, class I = typename Derived::Index>
auto guanaqo::as_view ( const Eigen::DenseBase< Derived > && M,
with_index_type_t< I > = {} )
delete

#include <guanaqo/eigen/view.hpp>

Convert an Eigen matrix view to a guanaqo::MatrixView.

Definition at line 87 of file view.hpp.

◆ as_eigen() [2/2]

template<class T, class I, class S, StorageOrder O>
auto guanaqo::as_eigen ( MatrixView< T, I, S, O > M)

#include <guanaqo/eigen/view.hpp>

Convert a guanaqo::MatrixView to an Eigen::Matrix view.

Definition at line 107 of file view.hpp.

◆ transpose()

StorageOrder guanaqo::transpose ( StorageOrder o)
constexpr

#include <guanaqo/mat-view.hpp>

Transpose the storage order (swaps row and column major).

Definition at line 28 of file mat-view.hpp.