IntaRNA 3.4.1
RNA-RNA interaction prediction | C++ API
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
IntaRNA::UpperBandedMatrix< T > Class Template Reference

#include <Matrix.h>

Public Types

using value_type = T
 Type of one stored cell.
 

Public Member Functions

 UpperBandedMatrix ()=default
 
 UpperBandedMatrix (std::size_t rows, std::size_t columns, std::size_t lower, std::size_t upper)
 
 UpperBandedMatrix (const UpperBandedMatrix &)=default
 
UpperBandedMatrix & operator= (const UpperBandedMatrix &)=default
 
 UpperBandedMatrix (UpperBandedMatrix &&other) noexcept
 
UpperBandedMatrix & operator= (UpperBandedMatrix &&other) noexcept
 
std::size_t size1 () const noexcept
 
std::size_t size2 () const noexcept
 
std::size_t storageSize () const noexcept
 
T & operator() (std::size_t i, std::size_t j)
 
const T & operator() (std::size_t i, std::size_t j) const
 
std::span< T > row (std::size_t i)
 
std::span< const T > row (std::size_t i) const
 
void clear ()
 
void swap (UpperBandedMatrix &other) noexcept
 
void resize (std::size_t rows, std::size_t newColumns, std::size_t lower, std::size_t upper, bool preserve=true)
 

Detailed Description

template<class T>
class IntaRNA::UpperBandedMatrix< T >

Upper band including the diagonal and 'upper' superdiagonals. Stores rows * min(columns, upper+1) cells, never a dense square for a narrow band. Logical (i,j) maps to mdspan[i,j-i] in the owning Matrix. Const access outside the band returns zero; writes must be in the band.

Member Typedef Documentation

◆ value_type

template<class T >
using IntaRNA::UpperBandedMatrix< T >::value_type = T

Type of one stored cell.

Constructor & Destructor Documentation

◆ UpperBandedMatrix() [1/4]

template<class T >
IntaRNA::UpperBandedMatrix< T >::UpperBandedMatrix ( )
default

Construct an empty matrix.

◆ UpperBandedMatrix() [2/4]

template<class T >
IntaRNA::UpperBandedMatrix< T >::UpperBandedMatrix ( std::size_t  rows,
std::size_t  columns,
std::size_t  lower,
std::size_t  upper 
)
inline

Allocate a default-initialized upper band.

Parameters
rowslogical row count
columnslogical column count
lowerlower bandwidth; must be zero
uppernumber of stored superdiagonals
Exceptions
std::invalid_argumentif lower is not zero
std::length_errorif the storage size overflows

◆ UpperBandedMatrix() [3/4]

template<class T >
IntaRNA::UpperBandedMatrix< T >::UpperBandedMatrix ( const UpperBandedMatrix< T > &  )
default

Copy the shape and values into independent storage.

◆ UpperBandedMatrix() [4/4]

template<class T >
IntaRNA::UpperBandedMatrix< T >::UpperBandedMatrix ( UpperBandedMatrix< T > &&  other)
inlinenoexcept

Take ownership of another matrix and leave it empty.

Parameters
othermatrix whose storage is moved

Member Function Documentation

◆ clear()

template<class T >
void IntaRNA::UpperBandedMatrix< T >::clear ( )
inline

Reset stored cells to default values without changing the shape.

◆ operator()() [1/2]

template<class T >
T & IntaRNA::UpperBandedMatrix< T >::operator() ( std::size_t  i,
std::size_t  j 
)
inline

Access a cell within the stored upper band.

Parameters
izero-based row within the logical shape
jzero-based column within the logical shape
Returns
mutable reference to the cell

◆ operator()() [2/2]

template<class T >
const T & IntaRNA::UpperBandedMatrix< T >::operator() ( std::size_t  i,
std::size_t  j 
) const
inline

Read a logical cell; structural zeros are returned outside stored cells.

Parameters
izero-based row within the logical shape
jzero-based column within the logical shape
Returns
read-only reference to the cell

◆ operator=() [1/2]

template<class T >
UpperBandedMatrix & IntaRNA::UpperBandedMatrix< T >::operator= ( const UpperBandedMatrix< T > &  )
default

Copy the shape and values into independent storage.

Returns
this matrix

◆ operator=() [2/2]

template<class T >
UpperBandedMatrix< T > & IntaRNA::UpperBandedMatrix< T >::operator= ( UpperBandedMatrix< T > &&  other)
inlinenoexcept

Take ownership of another matrix; self-move leaves this matrix unchanged.

Parameters
othermatrix whose storage is moved; emptied on a non-self move
Returns
this matrix

◆ resize()

template<class T >
void IntaRNA::UpperBandedMatrix< T >::resize ( std::size_t  rows,
std::size_t  newColumns,
std::size_t  lower,
std::size_t  upper,
bool  preserve = true 
)
inline

Resize, preserving overlapping logical cells when requested.

Parameters
rowsnew row count
newColumnsnew column count
lowerlower bandwidth; must be zero
uppernumber of stored superdiagonals
preserveretain overlapping cells and default-initialize new cells; otherwise callers must overwrite cells before reading
Exceptions
std::length_errorif the storage size overflows
std::invalid_argumentif the requested shape or band is unsupported

◆ row() [1/2]

template<class T >
std::span< T > IntaRNA::UpperBandedMatrix< T >::row ( std::size_t  i)
inline

View the contiguous stored cells (i,i), (i,i+1), ... in one row. Excludes structural zeros and row-end padding. The view aliases this matrix and must not outlive its storage or be retained across resize, move, swap or assignment.

Parameters
izero-based row, less than size1()
Returns
mutable stored cells; empty when i >= size2() or the band is empty

◆ row() [2/2]

template<class T >
std::span< const T > IntaRNA::UpperBandedMatrix< T >::row ( std::size_t  i) const
inline

Read-only view of one stored row, with the same bounds and lifetime as row().

Parameters
izero-based row, less than size1()
Returns
read-only stored cells, excluding padding and structural zeros

◆ size1()

template<class T >
std::size_t IntaRNA::UpperBandedMatrix< T >::size1 ( ) const
inlinenoexcept

Number of logical rows.

Returns
logical row count

◆ size2()

template<class T >
std::size_t IntaRNA::UpperBandedMatrix< T >::size2 ( ) const
inlinenoexcept

Number of logical columns.

Returns
logical column count

◆ storageSize()

template<class T >
std::size_t IntaRNA::UpperBandedMatrix< T >::storageSize ( ) const
inlinenoexcept

Number of stored elements, including any band padding.

Returns
stored element count

◆ swap()

template<class T >
void IntaRNA::UpperBandedMatrix< T >::swap ( UpperBandedMatrix< T > &  other)
inlinenoexcept

Exchange shape and owned storage.

Parameters
othermatrix to exchange with

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