MyraMath
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
myra::Pattern Class Reference

Holds the nonzero pattern of a sparse matrix. More...

#include <Pattern.h>

Public Types

typedef std::pair< PatternRange, PatternRangePair
 Useful typedefs.
 

Public Member Functions

 Pattern ()
 Default constructor, makes 0x0 empty Pattern.
 
 Pattern (const Pattern &that)
 Copy constructor.
 
void swap (Pattern &that)
 Member swap.
 
 Pattern (Pattern &&that)
 Move constructor, default construct and swap idiom.
 
Patternoperator= (Pattern that)
 Copy-assignment operator, copy construct and swap idiom.
 
 Pattern (const PatternRange &that)
 Constructs from a PatternRange (same size, values copied)
 
 Pattern (InputStream &in)
 InputStream constructor, complements write(OutputStream) method.
 
void write (OutputStream &out) const
 Writes to OutputStream, complements InputStream constructor.
 
const Patternadd_const () const
 Returns const reference to *this.
 
 ~Pattern ()
 Releases internal resources.
 
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.
 
std::vector< int > pattern (int j) const
 Returns the (sorted) nonzero pattern of A(:,j)
 
PatternIterator begin () const
 Returns iterators over all of A(:,:)
 
PatternIterator end () const
 
PatternIterator begin (int j) const
 Returns iterators over column A(:,j)
 
PatternIterator end (int j) const
 
PatternRange range () const
 Explicit conversion, returns a PatternRange over all of *this.
 
 operator PatternRange () const
 Implicit conversion into a PatternRange.
 
PatternRange window (int i0, int i1, int j0, int j1) const
 Returns a PatternRange over this(i0:i1,j0:j1)
 
Array2< PatternRangewindows (const intCRange &i, const intCRange &j) const
 Tile rows and columns using given sizes.
 
Patternoperator= (const PatternRange &that)
 Assigns this = that.
 
PatternRange row (int i) const
 Returns a PatternRange over this(i,:)
 
PatternRange rows (int i0, int i1) const
 Returns a PatternRange over this(i0:i1,:)
 
Array1< PatternRangerows (const intCRange &i) const
 Returns {this.rows(0:i0,:), this.rows(i0:i0+i1,:), ...}, tiling by rows.
 
PatternRange top (int i) const
 Returns a PatternRange over the i topmost rows, this(0:i,:)
 
PatternRange cut_top (int i) const
 Returns a PatternRange that cuts the i topmost rows, this(i:I,:)
 
Pair split_top (int i) const
 Splits by rows, returns [this->top(i), this->cut_top(i)].
 
PatternRange bottom (int i) const
 Returns a PatternRange over the i bottommost rows, this(I-i:I,:)
 
PatternRange cut_bottom (int i) const
 Returns a PatternRange that cuts the i bottommost rows, this(0:I-i,:)
 
Pair split_bottom (int i) const
 Splits by rows, returns [this->cut_bottom(i), this->bottom(i)].
 
PatternRange column (int j) const
 Returns a PatternRange over this(:,j)
 
PatternRange columns (int j0, int j1) const
 Returns a PatternRange over this(:,j0:j1)
 
Array1< PatternRangecolumns (const intCRange &j) const
 Returns {this.columns(:,0:j0), this.columns(:,j0:j0+j1), ...}, tiling by columns.
 
PatternRange left (int j) const
 Returns a PatternRange over the j leftmost columns, this(:,0:j)
 
PatternRange cut_left (int j) const
 Returns a PatternRange that cuts the j leftmost columns, this(:,j:J)
 
Pair split_left (int j) const
 Splits by columns, returns [this->left(j), this->cut_left(j)].
 
PatternRange right (int j) const
 Returns a PatternRange over the j rightmost columns, this(:,J-j:J)
 
PatternRange cut_right (int j) const
 Returns a PatternRange that cuts the j rightmost columns, this(:,0:J-j)
 
Pair split_right (int j) const
 Splits by columns, returns [this->cut_right(j), this->right(j)].
 
void debug (std::ostream &out) const
 Prints raw CSC-data on supplied ostream, used for debugging.
 

Static Public Member Functions

static Pattern identity (int IJ)
 Generates an identity Pattern of specified size.
 
static Pattern random (int I, int J, int N)
 Generates a random Pattern with size IxJ and (approximately) N nonzeros.
 
static Pattern fill (const intCRange &i, const intCRange &j)
 Generates a Pattern from coordinate format. Works similar to A = sparse(i,j,v) in Matlab/Octave.
 
static Pattern swap (int I, int J, std::vector< int > &Ao, std::vector< int > &Ai)
 Generates a Pattern from CSC arrays (offsets/indices). Note the inputs are destroyed/swapped-from.
 

Friends

class PatternBuilder
 
class detail::permute_wrapper
 
class detail::horzcat_wrapper
 
class detail::vertcat_wrapper
 
class detail::bothcat_wrapper
 
class detail::diagcat_wrapper
 
class detail::transpose_wrapper
 
class detail::multiply_wrapper
 
class detail::flip_wrapper
 
template<class Number >
class SparseMatrix
 
Pattern detail::stencil1 (int I)
 
Pattern detail::stencil2 (int I, int J)
 
Pattern detail::stencil3 (int I, int J, int K)
 

Detailed Description

Holds the nonzero pattern of a sparse matrix.


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