MUQ  0.4.3
muq::Modeling::AnyAlgebra2 Class Reference

Implement a generic way to do algebric operations on boost::any's. More...

#include <AnyAlgebra2.h>

Detailed Description

Implement a generic way to do algebric operations on boost::any's.

Definition at line 65 of file AnyAlgebra2.h.

Public Member Functions

double Norm (boost::any const &obj) const
 The norm of an object. More...
 
double InnerProduct (boost::any const &vec1, boost::any const &vec2) const
 The inner product between two vectors. More...
 
boost::any OuterProduct (boost::any const &vec1, boost::any const &vec2) const
 The outer product between two vectors. More...
 
boost::any AccessElement (boost::any const &obj, unsigned int const i=0, unsigned int const j=0) const
 Access an element of a vector/matrix. More...
 
boost::any Zero (std::type_info const &type, unsigned int const rows=0, unsigned int const cols=0) const
 Compute a zero vector. More...
 
bool IsZero (boost::any const &obj) const
 Determine if an object is the zero object. More...
 
boost::any Identity (std::type_info const &type, unsigned int const rows=0, unsigned int const cols=0) const
 Compute an identity object. More...
 
boost::any Identity (std::type_index const &type, unsigned int const rows=0, unsigned int const cols=0) const
 Compute an identity object. More...
 
boost::any Add (boost::any const &in0, boost::any const &in1) const
 Add two objects together. More...
 
boost::any Subtract (boost::any const &in0, boost::any const &in1) const
 Subtract two objects. More...
 
boost::any Multiply (boost::any const &in0, boost::any const &in1) const
 Multiply two objects. More...
 
boost::any ApplyInverse (boost::any const &A, boost::any const &x) const
 Apply the inverse of a matrix. More...
 
boost::any Apply (boost::any const &A, boost::any const &x) const
 Apply a matrix (mat-vec) More...
 
boost::any Inverse (boost::any const &obj) const
 The inverse. More...
 
boost::any SquareRoot (boost::any const &obj) const
 Compute the square root of an object. More...
 
double LogDeterminate (boost::any const &obj) const
 Compute the log-determinate. More...
 
boost::any Concatenate (boost::any const &vec1, boost::any const &vec2) const
 Combine to vectors into one. More...
 

Static Public Member Functions

static unsigned int Size (boost::any const &obj, int const dim=-1)
 

Member Function Documentation

◆ AccessElement()

boost::any muq::Modeling::AnyAlgebra2::AccessElement ( boost::any const &  obj,
unsigned int const  i = 0,
unsigned int const  j = 0 
) const

Access an element of a vector/matrix.

The return type is whatever the elements of the vector/matrix are (doubles, ints, ect ...)

Parameters
[in]objThe vector/matrix whose data we want to access
[in]iWe want to access the \(i^{th}\) element/row of the vector/matrix (defaults to 0)
[in]jWe want to access the \(j^{th}\) col of the matrix (defaults to 0)
Returns
The \((i,j)^{th}}\) element of the vector/matrix

◆ AccessElementImpl()

virtual boost::any muq::Modeling::AnyAlgebra2::AccessElementImpl ( boost::any const &  vec,
unsigned int const  i 
) const
privatevirtual

Access an element of a vector.

MUQ automatically checks for some common input types. However, the user may need to overload this function for special types.

Parameters
[in]vecThe vector whose data we want to access
[in]iWe want to access the \(i^{th}\) element/row
Returns
The \(i^{th}\) element/row of the vector

◆ Add()

boost::any muq::Modeling::AnyAlgebra2::Add ( boost::any const &  in0,
boost::any const &  in1 
) const

Add two objects together.

Parameters
[in]in0The first input
[in]in1The second input
Returns
The addition of in0 and in1 (in0+in1)

◆ AddImpl()

virtual boost::any muq::Modeling::AnyAlgebra2::AddImpl ( boost::any const &  in0,
boost::any const &  in1 
) const
privatevirtual

Add two objects together.

MUQ automatically checks for some common pairs. However, the user may need to overload this function for special types.

Parameters
[in]in0The first input
[in]in1The second input
Returns
The addition of in0 and in1 (in0+in1)

◆ Apply()

boost::any muq::Modeling::AnyAlgebra2::Apply ( boost::any const &  A,
boost::any const &  x 
) const

Apply a matrix (mat-vec)

If the input is a vector, treat is as the diagonal of a matrix

Parameters
[in]AWe are applying this matrix
[in]xWe are applying the matrix to this vector
Returns
The result \(y=A x\)

◆ ApplyImpl()

virtual boost::any muq::Modeling::AnyAlgebra2::ApplyImpl ( boost::any const &  A,
boost::any const &  x 
) const
privatevirtual

Apply a matrix (mat-vec)

If the input is a vector, treat is as the diagonal of a matrix

Parameters
[in]AWe are applying this matrix
[in]xWe are applying the matrix to this vector
Returns
The result \(y=A x\)

◆ ApplyInverse()

boost::any muq::Modeling::AnyAlgebra2::ApplyInverse ( boost::any const &  A,
boost::any const &  x 
) const

Apply the inverse of a matrix.

If the input is a vector, treat is as the diagonal of a matrix

Parameters
[in]AWe are applying the inverse of this matrix
[in]xWe are applying the inverse to this vector
Returns
The result \(y=A^{-1} x\)

◆ ApplyInverseImpl()

virtual boost::any muq::Modeling::AnyAlgebra2::ApplyInverseImpl ( boost::any const &  A,
boost::any const &  x 
) const
privatevirtual

Apply the inverse of a matrix.

If the input is a vector, treat is as the diagonal of a matrix

Parameters
[in]AWe are applying the inverse of this matrix
[in]xWe are applying the inverse to this vector
Returns
The result \(y=A^{-1} x\)

◆ Concatenate()

boost::any muq::Modeling::AnyAlgebra2::Concatenate ( boost::any const &  vec1,
boost::any const &  vec2 
) const

Combine to vectors into one.

Parameters
[in]vec1The first vector
[in]vec2The second vector
Returns
The combined vector [vec1, vec2]

◆ ConcatenateImpl()

virtual boost::any muq::Modeling::AnyAlgebra2::ConcatenateImpl ( boost::any const &  vec1,
boost::any const &  vec2 
) const
privatevirtual

Combine to vectors into one.

Parameters
[in]vec1The first vector
[in]vec2The second vector
Returns
The combined vector [vec1, vec2]

◆ Identity() [1/2]

boost::any muq::Modeling::AnyAlgebra2::Identity ( std::type_index const &  type,
unsigned int const  rows = 0,
unsigned int const  cols = 0 
) const

Compute an identity object.

If the input type is a vector (e.g., Eigen::Vector), return an identity matrix of corresponding type (e.g., Eigen::Matrix)

Parameters
[in]typeThe type—return an identity of this type
[in]rowsThe number of rows (e.g., for a matrix) defaults to 0 since some types imply the size
[in]colsThe number of columns (e.g., for a matrix) defaults to 0 since some types imply the size
Returns
An identity of some type

◆ Identity() [2/2]

boost::any muq::Modeling::AnyAlgebra2::Identity ( std::type_info const &  type,
unsigned int const  rows = 0,
unsigned int const  cols = 0 
) const

Compute an identity object.

If the input type is a vector (e.g., Eigen::Vector), return an identity matrix of corresponding type (e.g., Eigen::Matrix)

Parameters
[in]typeThe type—return an identity of this type
[in]rowsThe number of rows (e.g., for a matrix) defaults to 0 since some types imply the size
[in]colsThe number of columns (e.g., for a matrix) defaults to 0 since some types imply the size
Returns
An identity of some type

◆ IdentityImpl()

virtual boost::any muq::Modeling::AnyAlgebra2::IdentityImpl ( std::type_index const &  type,
unsigned int const  rows,
unsigned int const  cols 
) const
privatevirtual

Compute an identity object.

Parameters
[in]typeThe type—return an identity of this type
[in]rowsThe number of rows (e.g., for a matrix)
[in]colsThe number of columns (e.g., for a matrix)
Returns
An identity of some type

◆ InnerProduct()

double muq::Modeling::AnyAlgebra2::InnerProduct ( boost::any const &  vec1,
boost::any const &  vec2 
) const

The inner product between two vectors.

Parameters
[in]vec1The first vector
[in]vec2The second vector
Returns
The inner product

◆ InnerProductImpl()

virtual double muq::Modeling::AnyAlgebra2::InnerProductImpl ( boost::any const &  vec1,
boost::any const &  vec2 
) const
privatevirtual

The inner product between two vectors.

Parameters
[in]vec1The first vector
[in]vec2The second vector
Returns
The inner product

◆ Inverse()

boost::any muq::Modeling::AnyAlgebra2::Inverse ( boost::any const &  obj) const

The inverse.

Parameters
[in]objWe need the inverse of this object
Returns
The inverse

◆ InverseImpl()

virtual boost::any muq::Modeling::AnyAlgebra2::InverseImpl ( boost::any const &  obj) const
privatevirtual

The inverse.

Parameters
[in]objWe need the inverse of this object
Returns
The inverse

◆ IsZero()

bool muq::Modeling::AnyAlgebra2::IsZero ( boost::any const &  obj) const

Determine if an object is the zero object.

Parameters
[in]objAn input object
Returns
true: if obj is the zero object, false: if obj is not the zero object

◆ IsZeroImpl()

virtual bool muq::Modeling::AnyAlgebra2::IsZeroImpl ( boost::any const &  obj) const
privatevirtual

Determine if an object is the zero object.

Parameters
[in]objAn input object
Returns
true: if obj is the zero object, false: if obj is not the zero object

◆ LogDeterminate()

double muq::Modeling::AnyAlgebra2::LogDeterminate ( boost::any const &  obj) const

Compute the log-determinate.

In the vector case, compute the determinate of a diagonal matrix.

Parameters
[in]objWe need the determinate of this object
Returns
The determinate

◆ LogDeterminateImpl()

virtual double muq::Modeling::AnyAlgebra2::LogDeterminateImpl ( boost::any const &  obj) const
privatevirtual

Compute the log-determinate.

In the vector case, compute the determinate of a diagonal matrix.

Parameters
[in]objWe need the determinate of this object
Returns
The determinate

◆ Multiply()

boost::any muq::Modeling::AnyAlgebra2::Multiply ( boost::any const &  in0,
boost::any const &  in1 
) const

Multiply two objects.

Parameters
[in]in0The first input
[in]in1The second input
Returns
The multiplication of in0 and in1 (in0-in1)

◆ MultiplyImpl()

virtual boost::any muq::Modeling::AnyAlgebra2::MultiplyImpl ( boost::any const &  in0,
boost::any const &  in1 
) const
privatevirtual

Multiply two objects.

MUQ automatically checks for some common pairs. However, the user may need to overload this function for special types.

Parameters
[in]in0The first input
[in]in1The second input
Returns
The multiplication of in0 and in1 (in0*in1)

◆ Norm()

double muq::Modeling::AnyAlgebra2::Norm ( boost::any const &  obj) const

The norm of an object.

Parameters
[in]objWe need the norm of this object
Returns
The norm

◆ NormImpl()

virtual double muq::Modeling::AnyAlgebra2::NormImpl ( boost::any const &  obj) const
privatevirtual

The norm of an object.

Parameters
[in]objWe need the norm of this object
Returns
The norm

◆ OuterProduct()

boost::any muq::Modeling::AnyAlgebra2::OuterProduct ( boost::any const &  vec1,
boost::any const &  vec2 
) const

The outer product between two vectors.

Parameters
[in]vec1The first vector
[in]vec2The second vector
Returns
The outer product

◆ OuterProductImpl()

virtual boost::any muq::Modeling::AnyAlgebra2::OuterProductImpl ( boost::any const &  vec1,
boost::any const &  vec2 
) const
privatevirtual

The outer product between two vectors.

Parameters
[in]vec1The first vector
[in]vec2The second vector
Returns
The outer product

◆ Size()

static unsigned int muq::Modeling::AnyAlgebra2::Size ( boost::any const &  obj,
int const  dim = -1 
)
static

◆ SizeImpl()

virtual unsigned int muq::Modeling::AnyAlgebra2::SizeImpl ( boost::any const &  obj) const
privatevirtual

The size of an object (implemented by a child for non standard types)

For vectors/matrices, return the number of elements.

Parameters
[in]objWe need the size of this object
Returns
The size

◆ SquareRoot()

boost::any muq::Modeling::AnyAlgebra2::SquareRoot ( boost::any const &  obj) const

Compute the square root of an object.

In the vector case, compute the square root of each component. In the matrix case, compute the Cholesky

Parameters
[in]objWe need the square root of this object
Returns
The square root

◆ SquareRootImpl()

virtual boost::any muq::Modeling::AnyAlgebra2::SquareRootImpl ( boost::any const &  obj) const
privatevirtual

Compute the square root of an object.

In the vector case, compute the square root of each component. In the matrix case, compute the Cholesky

Parameters
[in]objWe need the square root of this object
Returns
The square root

◆ Subtract()

boost::any muq::Modeling::AnyAlgebra2::Subtract ( boost::any const &  in0,
boost::any const &  in1 
) const

Subtract two objects.

Parameters
[in]in0The first input
[in]in1The second input
Returns
The subtraction of in0 and in1 (in0-in1)

◆ SubtractImpl()

virtual boost::any muq::Modeling::AnyAlgebra2::SubtractImpl ( boost::any const &  in0,
boost::any const &  in1 
) const
privatevirtual

Subtract two objects.

MUQ automatically checks for some common pairs. However, the user may need to overload this function for special types.

Parameters
[in]in0The first input
[in]in1The second input
Returns
The subtraction of in0 and in1 (in0-in1)

◆ Zero()

boost::any muq::Modeling::AnyAlgebra2::Zero ( std::type_info const &  type,
unsigned int const  rows = 0,
unsigned int const  cols = 0 
) const

Compute a zero vector.

Parameters
[in]typeWe need a zero object of this type
[in]rowsThe size of the vector (defaults to 0 because some types have implied sizes (e.g., Eigen::Vector2d)) or number of rows of the matrix
[in]colsThe number of columns in the matrix (defaults to 0 but, again, some types imply a size)

◆ ZeroImpl()

virtual boost::any muq::Modeling::AnyAlgebra2::ZeroImpl ( std::type_info const &  type,
unsigned int const  rows,
unsigned int const  cols 
) const
privatevirtual

Compute a zero object for boost::any.

Parameters
[in]typeWe need a zero object of this type
[in]rowsThe size of the vector (defaults to 0 because some types have implied sizes (e.g., Eigen::Vector2d)) or number of rows of the matrix
[in]colsThe number of columns in the matrix (defaults to 0 but, again, some types imply a size)

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