MyraMath
Public Types | Public Member Functions | Friends | List of all members
myra::SparseMatrixRange< Number > Class Template Reference

Represents a mutable SparseMatrixRange. More...

#include <SparseMatrixRange.h>

Collaboration diagram for myra::SparseMatrixRange< Number >:
[legend]

Public Types

typedef std::pair< SparseMatrixRange< Number >, SparseMatrixRange< Number > > Pair
 
typedef SparseMatrixIterator< Number > Iterator
 

Public Member Functions

 SparseMatrixRange ()
 Default constructs a size 0x0 range.
 
 SparseMatrixRange (const int *in_Ao, const int *in_Ai, Number *in_Av, int I, int J)
 Constructs onto underlying data in compressed-sparse-column format.
 
void write (OutputStream &out) const
 Writes to OutputStream. Layout compatible with SparseMatrix's InputStream constructor.
 
std::pair< int, int > size () const
 Size inspector.
 
int n_nonzeros () const
 Counts nonzeros in A(:,:)
 
int n_nonzeros (int j) const
 Counts nonzeros in A(:,j)
 
bool test (int i, int j) const
 Tests for a structural nonzero.
 
PatternRange pattern () const
 Returns the nonzero Pattern over all of A(:,:)
 
std::vector< int > pattern (int j) const
 Returns the (sorted) nonzero pattern of A(:,j)
 
CSparseMatrixRange< Number > add_const () const
 Adds "const" (C) qualifier, explicit conversion to CSparseMatrixRange<Number>
 
 operator CSparseMatrixRange< Number > () const
 Implicit conversion operator to CSparseMatrixRange<Number>
 
SparseMatrixRange< Number > window (int i0, int i1, int j0, int j1) const
 Returns this(i0:i1,j0:j1)
 
Array2< SparseMatrixRange< Number > > windows (const intCRange &i, const intCRange &j) const
 Tile rows and columns using given sizes.
 
Number * pointer (int i, int j) const
 Returns pointer to A(i,j), returns nullptr if structural zero.
 
Number & operator() (int i, int j) const
 Returns reference to A(i,j), undefined behavior if structural zero.
 
Number & at (int i, int j) const
 Returns reference to A(i,j), throws if structural zero.
 
SparseMatrixRange< Number > row (int i) const
 Returns this(i,:)
 
SparseMatrixRange< Number > rows (int i0, int i1) const
 Returns this(i0:i1,:)
 
Array1< SparseMatrixRange< Number > > rows (const intCRange &i) const
 Returns {this.rows(0:i0,:), this.rows(i0:i0+i1,:), ...}, tiling by rows.
 
SparseMatrixRange< Number > top (int i) const
 Returns the i topmost rows, this(0:i,:)
 
SparseMatrixRange< Number > cut_top (int i) const
 Cuts the i topmost rows, returns this(i:I,:)
 
Pair split_top (int i) const
 Splits by rows, returns [this->top(i), this->cut_top(i)].
 
SparseMatrixRange< Number > bottom (int i) const
 Returns the i bottommost rows, this(I-i:I,:)
 
SparseMatrixRange< Number > cut_bottom (int i) const
 Cuts the i bottommost rows, returns this(0:I-i,:)
 
Pair split_bottom (int i) const
 Splits by rows, returns [this->cut_bottom(i), this->bottom(i)].
 
SparseMatrixRange< Number > column (int j) const
 Returns this(:,j)
 
SparseMatrixRange< Number > columns (int j0, int j1) const
 Returns this(:,j0:j1)
 
Array1< SparseMatrixRange< Number > > columns (const intCRange &j) const
 Tile columns using given sizes. Returns {this.columns(:,0:j0), this.columns(:,j0:j0+i1), ...}.
 
SparseMatrixRange< Number > left (int j) const
 Returns the j leftmost columns, this(:,0:j)
 
SparseMatrixRange< Number > cut_left (int j) const
 Cuts the j leftmost columns, returns this(:,j:J)
 
Pair split_left (int j) const
 Splits by columns, returns [this->left(j), this->cut_left(j)].
 
SparseMatrixRange< Number > right (int j) const
 Returns the j rightmost columns, this(:,J-j:J)
 
SparseMatrixRange< Number > cut_right (int j) const
 Cuts the j rightmost columns, returns this(:,0:J-j)
 
Pair split_right (int j) const
 Splits by columns, returns [this->cut_right(j), this->right(j)].
 
template<class Functor >
void transform (const Functor &f) const
 Overwrites every A(i,j) in this SparseMatrixRange with f(A(i,j)).
 
template<class Functor >
void transform_triangle (const Functor &f, char uplo) const
 Overwrites every A(i,j) in the 'U'pper or 'L'ower triangle of this SparseMatrixRange with f(A(i,j)).
 
template<class Functor >
void transform_diagonal (const Functor &f) const
 Overwrites every A(n,n) on the diagonal of this SparseMatrixRange with f(A(n,n)).
 
void operator*= (Number alpha) const
 Scales this *= alpha.
 
void operator/= (Number alpha) const
 Scales this /= alpha.
 
SparseMatrixIterator< Number > begin () const
 Returns an iterator pair over all of A(:,:)
 
SparseMatrixIterator< Number > end () const
 Returns an iterator pair over all of A(:,:)
 
SparseMatrixIterator< Number > begin (int j) const
 Returns an iterator pair over over column A(:,j)
 
SparseMatrixIterator< Number > end (int j) const
 Returns an iterator pair over over column A(:,j)
 
Matrix< Number > make_Matrix () const
 Accumulates *this onto a Matrix<Number>.
 
void make_Matrix (const MatrixRange< Number > &A) const
 Accumulates *this onto a Matrix<Number>.
 

Public Attributes

const int * Ao
 ---------— Data members, all public ----------------—
 
const int * Ai
 ---------— Data members, all public ----------------—
 
Number * Av
 ---------— Data members, all public ----------------—
 
int I0
 ---------— Data members, all public ----------------—
 
int I1
 ---------— Data members, all public ----------------—
 
int J0
 ---------— Data members, all public ----------------—
 
int J1
 ---------— Data members, all public ----------------—
 
bool sliced
 ---------— Data members, all public ----------------—
 

Friends

class SparseMatrixIterator< Number >
 
class CSparseMatrixRange< Number >
 
class SparseMatrix< Number >
 

Detailed Description

template<class Number>
class myra::SparseMatrixRange< Number >

Represents a mutable SparseMatrixRange.


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