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

Tabulates the values of a square NxN diagonal matrix. Allows random access, but only on the diagonal. More...

#include <DiagonalMatrix.h>

Public Types

typedef ReflectPrecision< Number >::type Precision
 Useful typedefs.
 

Public Member Functions

 DiagonalMatrix ()
 Default constructor, makes a size 0x0 empty DiagonalMatrix.
 
 DiagonalMatrix (int N)
 Constructs a DiagonalMatrix of size NxN, filled with Number(0)
 
 DiagonalMatrix (const Expression< 1, Number > &e)
 Constructs a Matrix from an Expression.
 
 DiagonalMatrix (const DiagonalMatrix &that)
 Copy constructor.
 
void swap (DiagonalMatrix &that)
 Member swap.
 
 DiagonalMatrix (DiagonalMatrix &&that)
 Move constructor, default construct and swap idiom.
 
DiagonalMatrixoperator= (DiagonalMatrix that)
 Copy-assignment operator, copy construct and swap idiom.
 
 DiagonalMatrix (const CDiagonalMatrixRange< Number > &that)
 Constructs from a DiagonalMatrixRange (same size, values copied).
 
 DiagonalMatrix (InputStream &in)
 InputStream constructor, complements write(OutputStream) method.
 
void write (OutputStream &out) const
 Writes to OutputStream, complements InputStream constructor.
 
const DiagonalMatrix< Number > & add_const () const
 Returns const reference to *this.
 
 ~DiagonalMatrix ()
 Releases internal resources.
 
int size () const
 Size inspector.
 
int n_words () const
 Storage requirements.
 
template<class Functor >
void transform (const Functor &f)
 Overwrites every D(n) in this DiagonalMatrix with f(D(n)).
 
DiagonalMatrixoperator= (const CDiagonalMatrixRange< Number > &that)
 Assigns this = that.
 
DiagonalMatrixoperator= (const Expression< 1, Number > &that)
 
void assign (const CDiagonalMatrixRange< Number > &that)
 Like operator =, but does not reallocate/resize. Requires matching sizes.
 
void assign (const Expression< 1, Number > &that)
 
void operator+= (const CDiagonalMatrixRange< Number > &that)
 Adds this += that.
 
void operator+= (const Expression< 1, Number > &that)
 
void operator-= (const CDiagonalMatrixRange< Number > &that)
 Subtracts this -= that.
 
void operator-= (const Expression< 1, Number > &that)
 
void operator*= (Number alpha)
 Scales this *= alpha.
 
void operator/= (Number alpha)
 Scales this /= alpha.
 
DiagonalMatrix< Number > operator- ()
 Unary minus (sign negation).
 
template<>
DiagonalMatrix< NumberSlogspace (NumberS x0, NumberS x1, int N)
 Generates a DiagonalMatrix filled with N Number's logarithmically spaced between (10^x0,10^x1)
 
template<>
DiagonalMatrix< NumberD > logspace (NumberD x0, NumberD x1, int N)
 
template<>
DiagonalMatrix< NumberC > logspace (NumberS x0, NumberS x1, int N)
 
template<>
DiagonalMatrix< NumberZ > logspace (NumberD x0, NumberD x1, int N)
 
const CDiagonalMatrixRange< Number > range () const
 Explicit conversion, returns a DiagonalMatrixRange over all of *this.
 
const DiagonalMatrixRange< Number > range ()
 Explicit conversion, returns a DiagonalMatrixRange over all of *this.
 
 operator const CDiagonalMatrixRange< Number > () const
 Implicit conversion into a DiagonalMatrixRange.
 
 operator const DiagonalMatrixRange< Number > ()
 Implicit conversion into a DiagonalMatrixRange.
 
const CDiagonalMatrixRange< Number > window (int n0, int n1) const
 Returns a DiagonalMatrixRange over this(n0:n1,n0:n1)
 
const DiagonalMatrixRange< Number > window (int n0, int n1)
 Returns a DiagonalMatrixRange over this(n0:n1,n0:n1)
 
const Number & operator() (int n) const
 Random accessor/mutator for D(n,n)
 
Number & operator() (int n)
 Random accessor/mutator for D(n,n)
 
const Number & at (int n) const
 Bounds checked random accessor/mutator for D(n,n)
 
Number & at (int n)
 Bounds checked random accessor/mutator for D(n,n)
 
const CDiagonalMatrixRange< Number > first (int n) const
 Returns a DiagonalMatrixRange over the first n entries, this(0:n,0:n)
 
const DiagonalMatrixRange< Number > first (int n)
 Returns a DiagonalMatrixRange over the first n entries, this(0:n,0:n)
 
const CDiagonalMatrixRange< Number > last (int n) const
 Returns a DiagonalMatrixRange over the last n entries, this(N-n:N,N-n:N)
 
const DiagonalMatrixRange< Number > last (int n)
 Returns a DiagonalMatrixRange over the last n entries, this(N-n:N,N-n:N)
 
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>.
 
Vector< Number > make_Vector () const
 Accumulates *this onto a Vector<Number>.
 
void make_Vector (const VectorRange< Number > &x) const
 Accumulates *this onto a Vector<Number>.
 

Static Public Member Functions

static DiagonalMatrix< Number > identity (int N)
 Generates an identity DiagonalMatrix of specified size.
 
static DiagonalMatrix< Number > random (int N)
 Generates a random DiagonalMatrix of specified size.
 
static DiagonalMatrix< Number > inertia (int N_plus, int N_minus)
 Generates an inertia DiagonalMatrix, [+I -I].
 
static DiagonalMatrix< Number > zeros (int N)
 Generates a zeros DiagonalMatrix of specified size.
 
static DiagonalMatrix< Number > fill (int N, Number c)
 Generates a DiagonalMatrix of specified size filled with constant c.
 
static DiagonalMatrix< Number > fill (std::initializer_list< Number > list)
 Generates a DiagonalMatrix of specified size filled with a std::initializer_list.
 
static DiagonalMatrix< Number > linspace (Number x0, Number x1, int N)
 Generates a DiagonalMatrix filled with N Number's linearly spaced between (x0,x1).
 
static DiagonalMatrix< Number > logspace (Precision x0, Precision x1, int N)
 Generates a Vector filled with N Number's logarithmically spaced between (10^x0,10^x1).
 
static DiagonalMatrix< Number > evaluate (const Expression< 1, Number > &e)
 Generates a DiagonalMatrix by evaluating an arity-1 Expression of Number.
 

Detailed Description

template<class Number>
class myra::DiagonalMatrix< Number >

Tabulates the values of a square NxN diagonal matrix. Allows random access, but only on the diagonal.


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