Implement a generic way to do algebric operations on boost::any's. More...
#include <AnyAlgebra2.h>
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) |
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 ...)
[in] | obj | The vector/matrix whose data we want to access |
[in] | i | We want to access the \(i^{th}\) element/row of the vector/matrix (defaults to 0) |
[in] | j | We want to access the \(j^{th}\) col of the matrix (defaults to 0) |
|
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.
[in] | vec | The vector whose data we want to access |
[in] | i | We want to access the \(i^{th}\) element/row |
boost::any muq::Modeling::AnyAlgebra2::Add | ( | boost::any const & | in0, |
boost::any const & | in1 | ||
) | const |
Add two objects together.
[in] | in0 | The first input |
[in] | in1 | The second input |
|
privatevirtual |
Add two objects together.
MUQ automatically checks for some common pairs. However, the user may need to overload this function for special types.
[in] | in0 | The first input |
[in] | in1 | The second input |
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
[in] | A | We are applying this matrix |
[in] | x | We are applying the matrix to this vector |
|
privatevirtual |
Apply a matrix (mat-vec)
If the input is a vector, treat is as the diagonal of a matrix
[in] | A | We are applying this matrix |
[in] | x | We are applying the matrix to this vector |
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
[in] | A | We are applying the inverse of this matrix |
[in] | x | We are applying the inverse to this vector |
|
privatevirtual |
Apply the inverse of a matrix.
If the input is a vector, treat is as the diagonal of a matrix
[in] | A | We are applying the inverse of this matrix |
[in] | x | We are applying the inverse to this vector |
boost::any muq::Modeling::AnyAlgebra2::Concatenate | ( | boost::any const & | vec1, |
boost::any const & | vec2 | ||
) | const |
Combine to vectors into one.
[in] | vec1 | The first vector |
[in] | vec2 | The second vector |
|
privatevirtual |
Combine to vectors into one.
[in] | vec1 | The first vector |
[in] | vec2 | The second vector |
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)
[in] | type | The type—return an identity of this type |
[in] | rows | The number of rows (e.g., for a matrix) defaults to 0 since some types imply the size |
[in] | cols | The number of columns (e.g., for a matrix) defaults to 0 since some types imply the size |
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)
[in] | type | The type—return an identity of this type |
[in] | rows | The number of rows (e.g., for a matrix) defaults to 0 since some types imply the size |
[in] | cols | The number of columns (e.g., for a matrix) defaults to 0 since some types imply the size |
|
privatevirtual |
Compute an identity object.
[in] | type | The type—return an identity of this type |
[in] | rows | The number of rows (e.g., for a matrix) |
[in] | cols | The number of columns (e.g., for a matrix) |
double muq::Modeling::AnyAlgebra2::InnerProduct | ( | boost::any const & | vec1, |
boost::any const & | vec2 | ||
) | const |
The inner product between two vectors.
[in] | vec1 | The first vector |
[in] | vec2 | The second vector |
|
privatevirtual |
The inner product between two vectors.
[in] | vec1 | The first vector |
[in] | vec2 | The second vector |
boost::any muq::Modeling::AnyAlgebra2::Inverse | ( | boost::any const & | obj | ) | const |
The inverse.
[in] | obj | We need the inverse of this object |
|
privatevirtual |
The inverse.
[in] | obj | We need the inverse of this object |
bool muq::Modeling::AnyAlgebra2::IsZero | ( | boost::any const & | obj | ) | const |
Determine if an object is the zero object.
[in] | obj | An input object |
|
privatevirtual |
Determine if an object is the zero object.
[in] | obj | An input object |
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.
[in] | obj | We need the determinate of this object |
|
privatevirtual |
Compute the log-determinate.
In the vector case, compute the determinate of a diagonal matrix.
[in] | obj | We need the determinate of this object |
boost::any muq::Modeling::AnyAlgebra2::Multiply | ( | boost::any const & | in0, |
boost::any const & | in1 | ||
) | const |
Multiply two objects.
[in] | in0 | The first input |
[in] | in1 | The second input |
|
privatevirtual |
Multiply two objects.
MUQ automatically checks for some common pairs. However, the user may need to overload this function for special types.
[in] | in0 | The first input |
[in] | in1 | The second input |
double muq::Modeling::AnyAlgebra2::Norm | ( | boost::any const & | obj | ) | const |
The norm of an object.
[in] | obj | We need the norm of this object |
|
privatevirtual |
The norm of an object.
[in] | obj | We need the norm of this object |
boost::any muq::Modeling::AnyAlgebra2::OuterProduct | ( | boost::any const & | vec1, |
boost::any const & | vec2 | ||
) | const |
The outer product between two vectors.
[in] | vec1 | The first vector |
[in] | vec2 | The second vector |
|
privatevirtual |
The outer product between two vectors.
[in] | vec1 | The first vector |
[in] | vec2 | The second vector |
|
static |
|
privatevirtual |
The size of an object (implemented by a child for non standard types)
For vectors/matrices, return the number of elements.
[in] | obj | We need the size of this object |
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
[in] | obj | We need the square root of this object |
|
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
[in] | obj | We need the square root of this object |
boost::any muq::Modeling::AnyAlgebra2::Subtract | ( | boost::any const & | in0, |
boost::any const & | in1 | ||
) | const |
Subtract two objects.
[in] | in0 | The first input |
[in] | in1 | The second input |
|
privatevirtual |
Subtract two objects.
MUQ automatically checks for some common pairs. However, the user may need to overload this function for special types.
[in] | in0 | The first input |
[in] | in1 | The second input |
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.
[in] | type | We need a zero object of this type |
[in] | rows | The 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] | cols | The number of columns in the matrix (defaults to 0 but, again, some types imply a size) |
|
privatevirtual |
Compute a zero object for boost::any.
[in] | type | We need a zero object of this type |
[in] | rows | The 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] | cols | The number of columns in the matrix (defaults to 0 but, again, some types imply a size) |