CMR  1.3.0
Public Member Functions | Public Attributes | List of all members
tu::SparseMatrix< V >::Data Struct Reference

Matrix data, row-wise or column-wise. More...

#include <matrix.hpp>

Public Member Functions

 Data ()
 Default constructor. More...
 
 Data (Data &&other)
 Move constructor. More...
 
 Data (const Data &other)
 Copy constructor. More...
 
Dataoperator= (Data &&other)
 Move operator. More...
 
Dataoperator= (const Data &other)
 Assignment operator. More...
 
 ~Data ()=default
 Destructor. More...
 
void constructFromTransposed (const Data &transposedData, Index numMinor)
 Computes the transpose version of data. numMinor is the new number of minor indices. More...
 
void ensureConsistency (Index numMinor=std::numeric_limits< Index >::max()) const
 Checks for consistency, raising a std::runtime_error if inconsistent. More...
 
void swap (Data &other)
 Swaps data with other. More...
 
std::size_t find (Index major, Index minor) const
 Finds entry major,minor. More...
 
void sort ()
 Sort data by minor. More...
 

Public Attributes

std::vector< std::pair< Index, Index > > range
 Array that maps a major to its nonzero range specified by first and beyond entries. More...
 
std::vector< std::pair< Index, Value > > entries
 Array that maps the nonzero indices to pairs of minor index and value. More...
 
bool isSorted
 Whether the data is sorted by minor. More...
 

Detailed Description

template<typename V>
struct tu::SparseMatrix< V >::Data

Matrix data, row-wise or column-wise.

Matrix data, row-wise or column-wise. The term major refers to the rows if it is a row-wise view and to columns otherwise. The term minor refers to the opposite.

Constructor & Destructor Documentation

◆ Data() [1/3]

template<typename V >
tu::SparseMatrix< V >::Data::Data ( )
inline

Default constructor.

◆ Data() [2/3]

template<typename V >
tu::SparseMatrix< V >::Data::Data ( Data &&  other)
inline

Move constructor.

◆ Data() [3/3]

template<typename V >
tu::SparseMatrix< V >::Data::Data ( const Data other)
inline

Copy constructor.

◆ ~Data()

template<typename V >
tu::SparseMatrix< V >::Data::~Data ( )
default

Destructor.

Member Function Documentation

◆ constructFromTransposed()

template<typename V >
void tu::SparseMatrix< V >::Data::constructFromTransposed ( const Data transposedData,
Index  numMinor 
)
inline

Computes the transpose version of data. numMinor is the new number of minor indices.

◆ ensureConsistency()

template<typename V >
void tu::SparseMatrix< V >::Data::ensureConsistency ( Index  numMinor = std::numeric_limits<Index>::max()) const
inline

Checks for consistency, raising a std::runtime_error if inconsistent.

◆ find()

template<typename V >
std::size_t tu::SparseMatrix< V >::Data::find ( Index  major,
Index  minor 
) const
inline

Finds entry major,minor.

Find entry major,minor. If it exists, the index of the entry is returned, and std::numeric_limits<std::size_t>::max() otherwise.

◆ operator=() [1/2]

template<typename V >
Data& tu::SparseMatrix< V >::Data::operator= ( const Data other)
inline

Assignment operator.

◆ operator=() [2/2]

template<typename V >
Data& tu::SparseMatrix< V >::Data::operator= ( Data &&  other)
inline

Move operator.

◆ sort()

template<typename V >
void tu::SparseMatrix< V >::Data::sort ( )
inline

Sort data by minor.

◆ swap()

template<typename V >
void tu::SparseMatrix< V >::Data::swap ( Data other)
inline

Swaps data with other.

Member Data Documentation

◆ entries

template<typename V >
std::vector<std::pair<Index, Value> > tu::SparseMatrix< V >::Data::entries

Array that maps the nonzero indices to pairs of minor index and value.

◆ isSorted

template<typename V >
bool tu::SparseMatrix< V >::Data::isSorted

Whether the data is sorted by minor.

◆ range

template<typename V >
std::vector<std::pair<Index, Index> > tu::SparseMatrix< V >::Data::range

Array that maps a major to its nonzero range specified by first and beyond entries.


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