MimIR
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
pbqp::BasicMatrix< T > Class Template Reference

A view of a cost matrix over row-major storage owned elsewhere; transposed() views the same storage column-major. More...

#include <pbqp/graph.h>

Inheritance diagram for pbqp::BasicMatrix< T >:
[legend]

Public Member Functions

constexpr BasicMatrix ()=default
constexpr BasicMatrix (T *data, size_t rows, size_t cols)
template<class U>
requires (std::same_as<T, const Cost> && std::same_as<U, Cost>)
constexpr BasicMatrix (const BasicMatrix< U > &other)
constexpr T & operator[] (size_t row, size_t col) const
constexpr size_t rows () const
constexpr size_t cols () const
constexpr size_t size () const
constexpr bool row_major () const
 Whether rows are contiguous, which also holds for a transposed single row or column.
constexpr BasicMatrix transposed () const
constexpr const BasicMatrix & operator+= (BasicMatrix< const Cost > rhs) const
constexpr void copy_from (BasicMatrix< const Cost > src) const
constexpr void erase_rows (fe::View< size_t > rows) &
 Erases the rows in rows, which must be sorted and distinct.
constexpr void erase_cols (fe::View< size_t > cols) &
 Erases the columns in cols, which must be sorted and distinct.
Storage

Iteration covers the storage in memory order, which is row-major only if row_major().

constexpr T * data () const
constexpr T * begin () const
constexpr T * end () const
constexpr T * row (size_t row) const

Detailed Description

template<class T>
requires std::same_as<std::remove_cv_t<T>, Cost>
class pbqp::BasicMatrix< T >

A view of a cost matrix over row-major storage owned elsewhere; transposed() views the same storage column-major.

Definition at line 73 of file graph.h.

Constructor & Destructor Documentation

◆ BasicMatrix() [1/3]

template<class T>
pbqp::BasicMatrix< T >::BasicMatrix ( )
constexprdefault

◆ BasicMatrix() [2/3]

template<class T>
pbqp::BasicMatrix< T >::BasicMatrix ( T * data,
size_t rows,
size_t cols )
inlineconstexpr

Definition at line 76 of file graph.h.

◆ BasicMatrix() [3/3]

template<class T>
template<class U>
requires (std::same_as<T, const Cost> && std::same_as<U, Cost>)
pbqp::BasicMatrix< T >::BasicMatrix ( const BasicMatrix< U > & other)
inlineconstexpr

Definition at line 80 of file graph.h.

Member Function Documentation

◆ begin()

template<class T>
T * pbqp::BasicMatrix< T >::begin ( ) const
inlinenodiscardconstexpr

Definition at line 100 of file graph.h.

◆ cols()

template<class T>
size_t pbqp::BasicMatrix< T >::cols ( ) const
inlinenodiscardconstexpr

◆ copy_from()

template<class T>
void pbqp::BasicMatrix< T >::copy_from ( BasicMatrix< const Cost > src) const
inlineconstexpr

Definition at line 117 of file graph.h.

◆ data()

template<class T>
T * pbqp::BasicMatrix< T >::data ( ) const
inlinenodiscardconstexpr

Definition at line 99 of file graph.h.

Referenced by pbqp::write_json().

◆ end()

template<class T>
T * pbqp::BasicMatrix< T >::end ( ) const
inlinenodiscardconstexpr

Definition at line 101 of file graph.h.

◆ erase_cols()

template<class T>
void pbqp::BasicMatrix< T >::erase_cols ( fe::View< size_t > cols) &
inlineconstexpr

Erases the columns in cols, which must be sorted and distinct.

Definition at line 150 of file graph.h.

◆ erase_rows()

template<class T>
void pbqp::BasicMatrix< T >::erase_rows ( fe::View< size_t > rows) &
inlineconstexpr

Erases the rows in rows, which must be sorted and distinct.

The & ensures erasing an rvalue cannot compact the storage yet drop the shrunken dimensions.

Definition at line 127 of file graph.h.

◆ operator+=()

template<class T>
const BasicMatrix & pbqp::BasicMatrix< T >::operator+= ( BasicMatrix< const Cost > rhs) const
inlineconstexpr

Definition at line 108 of file graph.h.

◆ operator[]()

template<class T>
T & pbqp::BasicMatrix< T >::operator[] ( size_t row,
size_t col ) const
inlinenodiscardconstexpr

Definition at line 83 of file graph.h.

◆ row()

template<class T>
T * pbqp::BasicMatrix< T >::row ( size_t row) const
inlinenodiscardconstexpr

Definition at line 102 of file graph.h.

◆ row_major()

template<class T>
bool pbqp::BasicMatrix< T >::row_major ( ) const
inlinenodiscardconstexpr

Whether rows are contiguous, which also holds for a transposed single row or column.

Definition at line 93 of file graph.h.

◆ rows()

template<class T>
size_t pbqp::BasicMatrix< T >::rows ( ) const
inlinenodiscardconstexpr

◆ size()

template<class T>
size_t pbqp::BasicMatrix< T >::size ( ) const
inlinenodiscardconstexpr

Definition at line 90 of file graph.h.

Referenced by pbqp::write_json().

◆ transposed()

template<class T>
BasicMatrix pbqp::BasicMatrix< T >::transposed ( ) const
inlinenodiscardconstexpr

Definition at line 94 of file graph.h.


The documentation for this class was generated from the following file: