DUNE: Uniform Navigational Environment
2016.09.0
|
Classes | |
class | Error |
Public Member Functions | |
Matrix (void) | |
Matrix (const Matrix &m) | |
Matrix (double *data, size_t r, size_t c) | |
Matrix (size_t r, size_t c) | |
Matrix (size_t r, size_t c, double v) | |
Matrix (size_t n) | |
Matrix (double *diag, size_t n) | |
~Matrix (void) | |
int | rows (void) const |
int | columns (void) const |
int | size (void) const |
bool | isEmpty (void) const |
void | fill (double value) |
void | fill (size_t r, size_t c, const double *data=0) |
void | identity (void) |
void | maxLimitValues (double max) |
void | minLimitValues (double min) |
void | trimValues (double min, double max) |
void | trimValues (double lim) |
Matrix | get (size_t i1, size_t i2, size_t j1, size_t j2) const |
Matrix & | set (size_t i1, size_t i2, size_t j1, size_t j2, const Matrix &m_in) |
Matrix & | blkDiag (const Matrix &m_in) |
Matrix & | vertCat (const Matrix &m_in) |
Matrix & | horzCat (const Matrix &m_in) |
Matrix & | pow (unsigned int n) |
void | toFile (const char *path) |
void | fromFile (const char *path) |
void | readFromLines (const std::vector< std::string > &clines) |
void | readFromConfig (DUNE::Parsers::Config &cfg, const std::string §ion, const std::string ¶m) |
Matrix | row (size_t i) const |
Matrix | column (size_t j) const |
void | swapColumns (size_t i, size_t j) |
void | swapRows (size_t i, size_t j) |
void | resize (const Matrix &m) |
void | resize (size_t r, size_t c) |
void | resizeAndKeep (size_t r, size_t c) |
void | resizeAndFill (size_t r, size_t c, double value) |
double & | operator() (size_t i, size_t j) |
double | operator() (size_t i, size_t j) const |
double & | operator() (size_t i) |
double | operator() (size_t i) const |
double | element (size_t i, size_t j) const |
double | element (size_t i) |
void | to_row (void) |
void | to_column (void) |
Matrix | multiply (const Matrix &m) |
bool | operator== (const Matrix &m) const |
Matrix & | operator= (const Matrix &m) |
Matrix & | operator+= (const Matrix &m) |
Matrix & | operator-= (const Matrix &m) |
Matrix & | operator&= (const Matrix &m) |
Matrix & | operator/= (const Matrix &m) |
Matrix | operator- (void) |
Matrix & | operator*= (double x) |
Matrix & | operator/= (double x) |
void | put (size_t i, size_t j, const Matrix &a) |
Matrix | mminor (size_t i, size_t j) const |
unsigned int | lup (Matrix &L, Matrix &U, Matrix &P) const |
void | lu (Matrix &L, Matrix &U) const |
double | detr (void) const |
double | det (void) const |
bool | Sylvester (void) const |
Matrix | toDCM (void) const |
Matrix | toQuaternion (void) const |
Matrix | toEulerAngles (void) const |
Matrix | expmts (double tol=1e-05) const |
double | norm_p (double p) const |
double | norm_2 (void) const |
double | norm_inf (void) const |
double | median (void) const |
double | trace (void) const |
bool | isInvertible (void) const |
bool | isSquare (void) const |
bool | isVector (void) const |
bool | isColumnVector (void) const |
bool | isColumnVector (size_t rows) const |
bool | isRowVector (void) const |
bool | isRowVector (size_t columns) const |
Static Public Member Functions | |
static void | set_precision (double p) |
static double | get_precision (void) |
static double | dot (const Matrix &a, const Matrix &b) |
static Matrix | cross (const Matrix &a, const Matrix &b) |
static int | upper_triangular_pp (double *M, int n, int m, double tolerance) |
static int | upper_triangular_tp (double *M, int *index, int n, int m, double tolerance) |
Friends | |
DUNE_DLL_SYM Matrix | operator+ (const Matrix &m1, const Matrix &m2) |
DUNE_DLL_SYM Matrix | operator- (const Matrix &m1, const Matrix &m2) |
DUNE_DLL_SYM Matrix | operator* (const Matrix &m1, const Matrix &m2) |
DUNE_DLL_SYM Matrix | operator& (const Matrix &m1, const Matrix &m2) |
DUNE_DLL_SYM Matrix | operator/ (const Matrix &a, const Matrix &b) |
DUNE_DLL_SYM Matrix | operator* (double x, const Matrix &a) |
DUNE_DLL_SYM Matrix | operator* (const Matrix &a, double x) |
DUNE_DLL_SYM Matrix | operator/ (const Matrix &a, double x) |
DUNE_DLL_SYM std::ostream & | operator<< (std::ostream &os, const Matrix &a) |
DUNE_DLL_SYM std::istream & | operator>> (std::istream &is, Matrix &a) |
DUNE_DLL_SYM Matrix | transpose (const Matrix &a) |
DUNE_DLL_SYM Matrix | inverse (const Matrix &a) |
DUNE_DLL_SYM Matrix | inverse (const Matrix &a, const Matrix &b) |
Matrix | skew (double data[3]) |
Matrix | skew (const Matrix &a) |
Matrix | inverse_pp (const Matrix &a) |
Matrix | inverse_pp (const Matrix &, const Matrix &) |
Matrix | inverse_lup (const Matrix &a) |
Matrix | abs (const Matrix &a) |
double | max (const Matrix &a) |
double | min (const Matrix &a) |
double | sum (const Matrix &a) |
double | squaresum (const Matrix &a) |
DUNE::Math::Matrix::Matrix | ( | void | ) |
Constructor.
Construct a zero sized matrix.
Referenced by DUNE::Math::operator>>(), toDCM(), toEulerAngles(), and toQuaternion().
DUNE::Math::Matrix::Matrix | ( | const Matrix & | m | ) |
DUNE::Math::Matrix::Matrix | ( | double * | data, |
size_t | r, | ||
size_t | c | ||
) |
Constructor.
Create a Matrix of dimension (rows * columns) and fills it with the data pointed by 'data'.
[in] | data | pointer to data to be copied to new matrix |
[in] | r | number of rows of new matrix |
[in] | c | number of columns of new matrix |
DUNE::Math::Matrix::Matrix | ( | size_t | r, |
size_t | c | ||
) |
Constructor.
Construct a matrix of size rows*columns.
[in] | r | number of rows of new matrix |
[in] | c | number of columns of new matrix |
DUNE::Math::Matrix::Matrix | ( | size_t | r, |
size_t | c, | ||
double | v | ||
) |
Constructor.
Construct a matrix of size rows * columns filled with constant value.
[in] | r | number of rows of new matrix |
[in] | c | number of rows of new matrix |
[in] | v | value used to initialize cells. |
References fill().
DUNE::Math::Matrix::Matrix | ( | size_t | n | ) |
Constructor.
Construct a square identity matrix of size n param[in] n size of new matrix (n * n)
References identity().
DUNE::Math::Matrix::Matrix | ( | double * | diag, |
size_t | n | ||
) |
Constructor.
Construct a diagonal matrix using the values in data param[in] diag pointer to data to be copied to diagonal matrix param[in] n size of new matrix (n * n)
References fill().
DUNE::Math::Matrix::~Matrix | ( | void | ) |
Destructor.
Decrement the number of copies of a Matrix and frees the allocated memory if this number reaches zero.
Referenced by Maneuver::VehicleFormation::FormCollAvoid::Task::consume(), and Maneuver::VehicleFormation::Coordinator::Task::onUpdateParameters().
Returns the diagonal concatenation of a matrix Return a matrix of size (nrows + rows(m_in)) x (ncolumns +columns(m_in)) and fills the remaining elements with zeros.
[in] | m_in | reference to matrix |
References columns(), isEmpty(), resizeAndFill(), rows(), and set().
Referenced by DUNE::Control::LinearSystem::append().
Matrix DUNE::Math::Matrix::column | ( | size_t | j | ) | const |
This method returns a column of the Matrix.
[in] | j | column to be retrieved |
Referenced by Maneuver::VehicleFormation::FormCollAvoid::Task::formationControl(), and swapColumns().
int DUNE::Math::Matrix::columns | ( | void | ) | const |
Retrieve the number of columns of the matrix.
Referenced by blkDiag(), cross(), DUNE::Navigation::KalmanFilter::getCovariance(), horzCat(), DUNE::Navigation::KalmanFilter::initialize(), DUNE::Control::LinearSystem::LinearSystem(), Control::AUV::LMI::Task::onUpdateParameters(), DUNE::Navigation::KalmanFilter::predict(), DUNE::Navigation::KalmanFilter::setCovariance(), DUNE::Navigation::KalmanFilter::setCovarianceTransition(), DUNE::Navigation::KalmanFilter::setMeasurementNoise(), DUNE::Navigation::KalmanFilter::setObservation(), DUNE::Navigation::KalmanFilter::setProcessNoise(), DUNE::Navigation::KalmanFilter::setStateTransition(), DUNE::Control::LinearSystem::simLinearSystem(), DUNE::Math::QPSolver::solve(), DUNE::Navigation::KalmanFilter::update(), and vertCat().
Calculate cross product.
Arguments must be 3D column or row vectors.
[in] | a | matrix. |
[in] | b | matrix. |
References columns(), isEmpty(), isVector(), resizeAndFill(), rows(), and size().
double DUNE::Math::Matrix::det | ( | void | ) | const |
Matrix determinant through LUP decomposition Iterative technique O(n^3).
References element(), isEmpty(), and lup().
Referenced by Sylvester().
double DUNE::Math::Matrix::detr | ( | void | ) | const |
Calculate dot product.
Arguments must be equally sized column or row vectors.
[in] | a | matrix. |
[in] | b | matrix. |
References isEmpty(), and isVector().
Referenced by DUNE::Math::QPSolver::solve().
double DUNE::Math::Matrix::element | ( | size_t | i, |
size_t | j | ||
) | const |
This method returns the value of an entry of a Matrix.
As this is a reading method it does not care if the data is shared by other matrices.
[in] | i | row index |
[in] | j | column index |
References isEmpty().
Referenced by det(), detr(), set(), toDCM(), toEulerAngles(), and toQuaternion().
double DUNE::Math::Matrix::element | ( | size_t | i | ) |
Matrix DUNE::Math::Matrix::expmts | ( | double | tol = 1e-05 | ) | const |
Compute matrix exponential of a square matrix through Taylor series expansion technique.
Revised according to: "Nineteen dubious ways to compute the exponential of a matrix, twenty-five years later" SIAM Review, 2003 (pages 12-13 - "Scale and squaring method").
[in] | tol | tolerance value |
References DUNE::Math::computeNextPowerOfTwo(), expmts(), isEmpty(), and norm_p().
Referenced by DUNE::Control::LinearSystem::c2d(), and expmts().
void DUNE::Math::Matrix::fill | ( | double | value | ) |
Fill the Matrix with a constant value.
[in] | value | constant value to fill matrix with |
References isEmpty().
Referenced by identity(), Matrix(), Control::ROV::RemoteOperation::Task::onActivation(), Control::ROV::RemoteOperation::Task::onConnectionTimeout(), Control::ROV::RemoteOperation::Task::onDeactivation(), Sensors::IFOG::Task::onUpdateParameters(), DUNE::Navigation::KalmanFilter::resetOutputs(), DUNE::Navigation::KalmanFilter::resetState(), resizeAndFill(), resizeAndKeep(), Navigation::General::ROV::Task::setTransition(), and Navigation::AUV::Navigation::Task::setTransition().
void DUNE::Math::Matrix::fill | ( | size_t | r, |
size_t | c, | ||
const double * | data = 0 |
||
) |
Resize matrix and fill with new values.
[in] | r | number of rows of resized matrix |
[in] | c | number of columns of resized matrix |
[in] | data | pointer to data to be copied to resized matrix |
References resize().
void DUNE::Math::Matrix::fromFile | ( | const char * | path | ) |
Loads a matrix from text file (must initialize matrix dimensions first).
[in] | path | file path string (eg: "E:\dir/x.txt"). |
Matrix DUNE::Math::Matrix::get | ( | size_t | i1, |
size_t | i2, | ||
size_t | j1, | ||
size_t | j2 | ||
) | const |
Retrieve a submatrix.
[in] | i1 | initial row |
[in] | i2 | final row |
[in] | j1 | initial column |
[in] | j2 | final column |
References isEmpty().
Referenced by Maneuver::VehicleFormation::FormCollAvoid::Task::consume(), Maneuver::VehicleFormation::FormCollAvoid::Task::formationControl(), DUNE::Navigation::KalmanFilter::getCovariance(), DUNE::Navigation::KalmanFilter::getObservation(), Maneuver::VehicleFormation::FormCollAvoid::Task::leaderOutput(), Control::ROV::RemoteOperation::Task::onRemoteActions(), Maneuver::VehicleFormation::Coordinator::Task::onUpdateParameters(), Maneuver::VehicleFormation::FormCollAvoid::Task::onUpdateParameters(), Maneuver::VehicleFormation::Coordinator::Task::periodicUpdate(), Maneuver::VehicleFormation::Coordinator::Task::setLeaderState(), Maneuver::VehicleFormation::FormCollAvoid::Task::setLeaderState(), Simulators::UAV::Task::task(), Maneuver::VehicleFormation::FormCollAvoid::Task::teamPeriodicUpdate(), and Maneuver::VehicleFormation::FormCollAvoid::Task::teamUnevenUpdate().
|
static |
This method returns the precision currently in use.
Returns the horizontal concatenation of a matrix Return a matrix of size (nrows x (ncolumns + columns(m_in)) ) and fills the remaining elements with zeros.
[in] | m_in | reference to matrix |
References columns(), isEmpty(), resizeAndFill(), rows(), and set().
Referenced by Simulators::UAV::Task::matrixJ().
void DUNE::Math::Matrix::identity | ( | void | ) |
Turns the Matrix into an identity matrix if it is squared.
References fill(), and isEmpty().
Referenced by Matrix(), and DUNE::Navigation::KalmanFilter::reset().
bool DUNE::Math::Matrix::isColumnVector | ( | void | ) | const |
This routine checks if matrix is a column vector.
Referenced by DUNE::Math::QPSolver::solve().
bool DUNE::Math::Matrix::isColumnVector | ( | size_t | rows | ) | const |
This routine checks if matrix is a column vector with certain size.
[in] | rows | size of the vector |
bool DUNE::Math::Matrix::isEmpty | ( | void | ) | const |
Return true for empty matrices.
Referenced by DUNE::Math::abs(), blkDiag(), cross(), det(), detr(), dot(), element(), expmts(), fill(), get(), horzCat(), identity(), DUNE::Math::inverse(), DUNE::Math::inverse_lup(), DUNE::Math::inverse_pp(), isInvertible(), lu(), lup(), DUNE::Math::max(), maxLimitValues(), median(), DUNE::Math::min(), minLimitValues(), mminor(), multiply(), norm_2(), norm_inf(), norm_p(), DUNE::Math::operator&(), operator()(), DUNE::Math::operator*(), DUNE::Math::operator+(), operator-(), DUNE::Math::operator-(), DUNE::Math::operator/(), put(), readFromLines(), resizeAndKeep(), set(), DUNE::Math::skew(), DUNE::Math::squaresum(), DUNE::Math::sum(), Sylvester(), toDCM(), toEulerAngles(), toQuaternion(), trace(), DUNE::Math::transpose(), and vertCat().
bool DUNE::Math::Matrix::isInvertible | ( | void | ) | const |
This routine checks if matrix is invertible.
References isEmpty(), and upper_triangular_pp().
bool DUNE::Math::Matrix::isRowVector | ( | void | ) | const |
This routine checks if matrix is a row vector.
bool DUNE::Math::Matrix::isRowVector | ( | size_t | columns | ) | const |
This routine checks if matrix is a row vector with certain size.
[in] | columns | size of the vector |
bool DUNE::Math::Matrix::isSquare | ( | void | ) | const |
This routine checks if matrix is square.
Referenced by DUNE::Math::QPSolver::solve(), and trace().
bool DUNE::Math::Matrix::isVector | ( | void | ) | const |
[in] | L | lower triangular matrix |
[in] | U | upper triangular matrix |
References isEmpty().
LUP decomposition (P * A = L * U).
This method returns the number of permutations.
[in] | L | lower triangular matrix |
[in] | U | upper triangular matrix |
[in] | P | permutation matrix |
References isEmpty(), multiply(), and swapRows().
Referenced by det(), and DUNE::Math::inverse_lup().
void DUNE::Math::Matrix::maxLimitValues | ( | double | max | ) |
Limit the maximum Matrix elements values.
[in] | max | maximum value |
References isEmpty(), and max.
Referenced by trimValues().
double DUNE::Math::Matrix::median | ( | void | ) | const |
Compute the median value of the ordered data of the matrix.
(does not assume the data is already ordered)
References isEmpty(), and DUNE::Math::median().
void DUNE::Math::Matrix::minLimitValues | ( | double | min | ) |
Limit the minimum Matrix elements values.
[in] | min | minimum value |
References isEmpty(), and min.
Referenced by trimValues().
Matrix DUNE::Math::Matrix::mminor | ( | size_t | i, |
size_t | j | ||
) | const |
This routine returns the (i, j) minor Matrix.
[in] | i | row index |
[in] | j | column index |
References isEmpty(), put(), and resizeAndFill().
Referenced by detr(), and Sylvester().
double DUNE::Math::Matrix::norm_2 | ( | void | ) | const |
This implements the (element-wise) 2-norm, corresponding to the Euclidean norm for vectors and Froebnius norm for matrices.
References isEmpty().
Referenced by Maneuver::VehicleFormation::Coordinator::Task::consume(), Maneuver::VehicleFormation::FormCollAvoid::Task::consume(), Maneuver::VehicleFormation::FormCollAvoid::Task::formationControl(), Maneuver::VehicleFormation::FormCollAvoid::Task::leaderOutput(), Maneuver::VehicleFormation::Coordinator::Task::periodicUpdate(), and Simulators::UAVAutopilot::Task::task().
double DUNE::Math::Matrix::norm_inf | ( | void | ) | const |
double DUNE::Math::Matrix::norm_p | ( | double | p | ) | const |
This method implements the p-norm for both matrices and vectors.
The following values of p yield particular cases: Vectors: p = 1: Manhattan/taxicab norm; p = 2: Euclidean norm; very large values of p: infinity/maximum norm; Matrices: p = 2: Froebnius norm; very large values of p: maximum norm;
[in] | p | norm value |
References isEmpty().
Referenced by expmts().
double & DUNE::Math::Matrix::operator() | ( | size_t | i, |
size_t | j | ||
) |
This operator returns a reference to a given entry of a Matrix.
As this methods makes possible to change the entries of a Matrix a spliting is necessary to avoid corrupting other matrices sharing the same data.
Note: As this method returns a reference it is very powerful, and it can be used to gain access to the pointer to the Matrix entries. This use can be dangerous because the data of a given matrix can move from place to place due to splitting.
[in] | i | row index |
[in] | j | column index |
References isEmpty().
double DUNE::Math::Matrix::operator() | ( | size_t | i, |
size_t | j | ||
) | const |
This routine returns a value of the matrix.
[in] | i | row index |
[in] | j | column index |
References isEmpty().
double & DUNE::Math::Matrix::operator() | ( | size_t | i | ) |
This operator returns a reference to a given entry of a Matrix.
As this methods makes possible to change the entries of a Matrix a spliting is necessary to avoid corrupting other matrices sharing the same data.
Note: As this method returns a reference it is very powerful, and it can be used to gain access to the pointer to the Matrix entries. This use can be dangerous because the data of a given matrix can move from place to place due to splitting.
[in] | i | matrix index |
References isEmpty().
double DUNE::Math::Matrix::operator() | ( | size_t | i | ) | const |
This routine returns a value of the matrix.
[in] | i | matrix index |
References isEmpty().
Matrix & DUNE::Math::Matrix::operator*= | ( | double | x | ) |
This method multiplies a Matrix by a real number.
[in] | x | real number |
Matrix DUNE::Math::Matrix::operator- | ( | void | ) |
Matrix & DUNE::Math::Matrix::operator/= | ( | double | x | ) |
This method divides a Matrix by a real number.
Care must be taken to avoid divisions by zero.
[in] | x | real number |
bool DUNE::Math::Matrix::operator== | ( | const Matrix & | m | ) | const |
Compare matrices for equality.
[in] | m | matrix to compare. |
Matrix & DUNE::Math::Matrix::pow | ( | unsigned int | n | ) |
Returns the power matrix X^n.
[in] | n | positive integer exponent to raise the matrix to |
void DUNE::Math::Matrix::put | ( | size_t | i, |
size_t | j, | ||
const Matrix & | a | ||
) |
This method fills a submatrix of a given Matrix.
[in] | i | row index |
[in] | j | column index |
[in] | a | submatrix |
References isEmpty().
Referenced by mminor(), swapColumns(), and swapRows().
void DUNE::Math::Matrix::readFromConfig | ( | DUNE::Parsers::Config & | cfg, |
const std::string & | section, | ||
const std::string & | param | ||
) |
Read a matrix from a configuration file.
The matrix dimensions must be defined a priori.
[in] | cfg | configuration parser |
[in] | section | configuration section |
[in] | param | configuration parameter |
References DUNE::Parsers::Config::get(), and readFromLines().
Referenced by DUNE::Parsers::PlanConfigParser::parse().
void DUNE::Math::Matrix::readFromLines | ( | const std::vector< std::string > & | clines | ) |
Read a matrix from a vector of strings The matrix dimensions must be defined a priori.
[in] | clines | vector of strings containing the matrix data |
References isEmpty(), DUNE::Utils::String::split(), and DUNE::Utils::String::str().
Referenced by readFromConfig().
void DUNE::Math::Matrix::resize | ( | const Matrix & | m | ) |
This method resizes a Matrix to the same dimensions of other matrix.
Note that no data copy is performed.
[in] | m | reference to matrix |
Referenced by fill(), resizeAndFill(), resizeAndKeep(), DUNE::Math::QPSolver::solve(), and Sensors::IFOG::Task::Task().
void DUNE::Math::Matrix::resize | ( | size_t | r, |
size_t | c | ||
) |
This method resizes a Matrix to the dimensions of (r * c).
[in] | r | number of rows |
[in] | c | number of columns |
void DUNE::Math::Matrix::resizeAndFill | ( | size_t | r, |
size_t | c, | ||
double | value | ||
) |
This method resizes a Matrix to the dimensions of (r * c) and fills the matrix with constant value.
[in] | r | number of rows |
[in] | c | number of columns |
[in] | value | constant value to fill matrix with |
References fill(), and resize().
Referenced by blkDiag(), DUNE::Navigation::CompassCalibration::clear(), cross(), horzCat(), DUNE::Navigation::KalmanFilter::KalmanFilter(), DUNE::Control::LinearSystem::LinearSystem(), mminor(), DUNE::Navigation::KalmanFilter::reset(), and vertCat().
void DUNE::Math::Matrix::resizeAndKeep | ( | size_t | r, |
size_t | c | ||
) |
This method resizes a Matrix to the dimensions of (r * c) and keeps previous matrix values if/when possible.
[in] | r | number of rows |
[in] | c | number of columns |
References fill(), isEmpty(), and resize().
Referenced by Maneuver::VehicleFormation::FormCollAvoid::Task::consume(), Maneuver::VehicleFormation::Coordinator::Task::onUpdateParameters(), Maneuver::VehicleFormation::FormCollAvoid::Task::onUpdateParameters(), and DUNE::Navigation::KalmanFilter::resize().
Matrix DUNE::Math::Matrix::row | ( | size_t | i | ) | const |
This method returns a row of the Matrix.
[in] | i | row to be retrieved |
Referenced by Maneuver::VehicleFormation::FormCollAvoid::Task::formationControl(), and swapRows().
int DUNE::Math::Matrix::rows | ( | void | ) | const |
Retrieve the number of rows of the matrix.
Referenced by blkDiag(), cross(), DUNE::Navigation::KalmanFilter::getCovariance(), DUNE::Navigation::KalmanFilter::getOutput(), horzCat(), DUNE::Navigation::KalmanFilter::initialize(), DUNE::Navigation::KalmanFilter::KalmanFilter(), DUNE::Control::LinearSystem::LinearSystem(), Maneuver::VehicleFormation::SMC::Task::onUpdate(), Control::AUV::LMI::Task::onUpdateParameters(), Maneuver::VehicleFormation::Coordinator::Task::onUpdateParameters(), DUNE::Parsers::PlanConfigParser::parse(), DUNE::Navigation::KalmanFilter::predict(), DUNE::Navigation::KalmanFilter::reset(), DUNE::Navigation::KalmanFilter::resize(), DUNE::Navigation::KalmanFilter::setCovariance(), DUNE::Navigation::KalmanFilter::setCovarianceTransition(), DUNE::Navigation::KalmanFilter::setInnovation(), DUNE::Navigation::KalmanFilter::setMeasurementNoise(), DUNE::Navigation::KalmanFilter::setObservation(), DUNE::Navigation::KalmanFilter::setOutput(), DUNE::Simulation::UAVSimulation::setPosition(), DUNE::Navigation::KalmanFilter::setProcessNoise(), DUNE::Navigation::KalmanFilter::setStateTransition(), DUNE::Simulation::UAVSimulation::setVelocity(), DUNE::Control::LinearSystem::simLinearSystem(), DUNE::Math::QPSolver::solve(), DUNE::Navigation::KalmanFilter::update(), and vertCat().
Matrix & DUNE::Math::Matrix::set | ( | size_t | i1, |
size_t | i2, | ||
size_t | j1, | ||
size_t | j2, | ||
const Matrix & | m_in | ||
) |
Set a submatrix.
[in] | i1 | initial row |
[in] | i2 | final row |
[in] | j1 | initial column |
[in] | j2 | final column |
[in] | m_in | reference to matrix to be copied into submatrix |
References element(), and isEmpty().
Referenced by blkDiag(), Maneuver::VehicleFormation::FormCollAvoid::Task::consume(), Maneuver::VehicleFormation::Coordinator::Task::consume(), Maneuver::VehicleFormation::FormCollAvoid::Task::formationControl(), horzCat(), Maneuver::VehicleFormation::Coordinator::Task::onUpdateParameters(), Maneuver::VehicleFormation::FormCollAvoid::Task::onUpdateParameters(), Maneuver::VehicleFormation::Coordinator::Task::setLeaderState(), Maneuver::VehicleFormation::FormCollAvoid::Task::setLeaderState(), DUNE::Simulation::UAVSimulation::setPosition(), DUNE::Simulation::UAVSimulation::setVelocity(), Maneuver::VehicleFormation::FormCollAvoid::Task::teamPeriodicUpdate(), Maneuver::VehicleFormation::FormCollAvoid::Task::teamUnevenUpdate(), and vertCat().
|
static |
This method sets the precision used when inverting a Matrix.
[in] | p | value of the precision to be used when inverting |
int DUNE::Math::Matrix::size | ( | void | ) | const |
Retrieve the size of the matrix.
Referenced by cross(), DUNE::Math::max(), DUNE::Math::min(), Maneuver::VehicleFormation::Coordinator::Task::onUpdateParameters(), DUNE::Math::operator&(), DUNE::Math::operator+(), DUNE::Math::operator-(), DUNE::Math::operator/(), DUNE::Math::squaresum(), and DUNE::Math::sum().
void DUNE::Math::Matrix::swapColumns | ( | size_t | i, |
size_t | j | ||
) |
void DUNE::Math::Matrix::swapRows | ( | size_t | i, |
size_t | j | ||
) |
bool DUNE::Math::Matrix::Sylvester | ( | void | ) | const |
void DUNE::Math::Matrix::to_column | ( | void | ) |
void DUNE::Math::Matrix::to_row | ( | void | ) |
Matrix DUNE::Math::Matrix::toDCM | ( | void | ) | const |
Convert from Euler angles or quaternions to Direction Cosines Matrix attitude representation.
Used to transform vectors in the body frame to the fixed frame.
References element(), isEmpty(), Matrix(), and transpose.
Referenced by Sensors::LIMU::Task::decodeOutputData(), Maneuver::VehicleFormation::FormCollAvoid::Task::leaderOutput(), Simulators::UAV::Task::matrixJ(), Maneuver::VehicleFormation::Coordinator::Task::periodicUpdate(), Simulators::UAVAutopilot::Task::task(), Simulators::UAV::Task::task(), and DUNE::Navigation::CompassCalibration::updateField().
Matrix DUNE::Math::Matrix::toEulerAngles | ( | void | ) | const |
void DUNE::Math::Matrix::toFile | ( | const char * | path | ) |
Saves matrix to text file.
[in] | path | file path string (eg: "E:\dir/x.txt"). |
Matrix DUNE::Math::Matrix::toQuaternion | ( | void | ) | const |
double DUNE::Math::Matrix::trace | ( | void | ) | const |
Compute matrix trace (sum of diagonal elements for a square matrix).
References isEmpty(), and isSquare().
void DUNE::Math::Matrix::trimValues | ( | double | min, |
double | max | ||
) |
Limit the minimum and maximum Matrix elements' values.
[in] | min | minimum value |
[in] | max | maximum value |
References maxLimitValues(), and minLimitValues().
void DUNE::Math::Matrix::trimValues | ( | double | lim | ) |
Limit the minimum and maximum Matrix elements' values.
[in] | lim | absolute limit value |
References maxLimitValues(), and minLimitValues().
|
static |
This function tranforms a Matrix 'M' (n*m) into an upper triangular Matrix using Gauss elimination with partial pivoting.
'm' should be >= 'n'.
[out] | M | matrix to be transformed |
[in] | m | number of columns |
[in] | n | number of rows |
[in] | tolerance | small positive constant used to test for zero entries in 'M' |
Referenced by DUNE::Math::inverse_pp(), and isInvertible().
|
static |
This function tranforms a Matrix 'M' (n*m) into an upper triangular Matrix using Gauss elimination with total pivoting.
'm' should be >= 'n'.
The parameter 'index' is a pointer to an array of 'n' integers that indicates the permutations that are done during total pivotation. When this function is called the 'index' array must be properly initialized, i.e. ind[0]=0, ind[1]=1, ..., ind[n-1]=n-1.
[out] | M | matrix to be transformed |
[out] | index | pointer to array that indicates permutations |
[in] | m | number of columns |
[in] | n | number of rows |
[in] | tolerance | small positive constant used to test for zero entries in 'M' |
Referenced by DUNE::Math::inverse().
Returns the vertical concatenation of a matrix Return a matrix of size (nrows + rows(m_in)) x (ncolumns) and fills the remaining elements with zeros.
[in] | m_in | reference to matrix |
References columns(), isEmpty(), resizeAndFill(), rows(), and set().
Referenced by DUNE::Control::LinearSystem::append(), Simulators::UAV::Task::matrixJ(), Maneuver::VehicleFormation::FormCollAvoid::Task::onUpdateParameters(), DUNE::Math::operator>>(), Maneuver::VehicleFormation::Coordinator::Task::setLeaderState(), and Maneuver::VehicleFormation::FormCollAvoid::Task::setLeaderState().
This methods calculates the inverse of a Matrix.
The inverse is calculated using Gauss elimination with total pivoting.
If Matrix 'a' is singular (with current precision) a zero Matrix with the same dimension of 'a' is returned and the variable 'dMatrix::inversionerror' is set to 1. Otherwise it is set to 0.
[in] | a | matrix to be inverted. |
This methods calculates the Matrix 'x' that solves the linear system of equations 'a.x=b'.
The system is solved using Gauss elimination with total pivoting.
If Matrix 'a' is singular (with current precision) a zero Matrix with the same dimension of 'b' is returned and the variable 'dMatrix::inversionerror' is set to 1. Otherwise it is set to 0.
[in] | a | matrix |
[in] | b | matrix |
This function computes the Matrix inverse using LU or LUP decomposition.
[in] | a | reference to matrix to be inverted |
This methods calculates the inverse of a Matrix.
The inverse is calculated using Gauss elimination with partial pivoting.
If Matrix is singular (with current precision) a zero Matrix with the same dimension is returned and the variable. 'dMatrix::inversionerror' is set to 1. Otherwise is is set to 0.
[in] | a | reference to matrix to be inverted |
This methods calculates the Matrix 'x' that solves the linear system of equations 'a.x=b'.
The system is solved using Gauss elimination with partial pivoting.
If Matrix 'a' is singular (with current precision) a zero Matrix with the same dimension of 'b' is returned and the variable. 'dMatrix::inversionerror' is set to 1. Otherwise it is set to 0.
[in] | a | matrix |
[in] | b | matrix |
|
friend |
This function returns the maximum value of a Matrix.
[in] | a | matrix |
Referenced by maxLimitValues().
|
friend |
This function returns the minimum value of a Matrix.
[in] | a | matrix |
Referenced by minLimitValues().
This method returns the element-element product of two matrices.
[in] | m1 | matrix to be multiplied (element-element). |
[in] | m2 | matrix to be multiplied (element-element). |
This method returns the product of two matrices.
Applied loop interchange to achieve memory stride 1 (better data locality) in iterations of the innermost loop, This makes for better cache behavior (i.e. less cache misses), particularly as matrix dimensions increase. For those interested, see papers or books by M J Wolfe.
[in] | m1 | matrix to be summed. |
[in] | m2 | matrix to be summed. |
This function multiplies a Matrix by a real number.
[in] | x | real number. |
[in] | a | matrix to be multiplied. |
This function multiplies a Matrix by a real number.
[in] | a | matrix to be multiplied. |
[in] | x | real number. |
This method returns the sum of two matrices.
[in] | m1 | matrix to be summed. |
[in] | m2 | matrix to be summed. |
This method returns the difference of two matrices.
[in] | m1 | matrix to be subtracted. |
[in] | m2 | matrix to subtract. |
This method returns the element-element quocient of two matrices.
[in] | a | matrix for element-element quocient. |
[in] | b | matrix for element-element quocient. |
This function divides a Matrix by a real number.
[in] | a | matrix to be divided. |
[in] | x | real number. |
|
friend |
|
friend |
|
friend |
This function returns a 3x3 skew symmetrical matrix using an array with 3 elements.
[in] | data | array with 3 elements |
Referenced by DUNE::Math::skew().
This function returns a 3x3 skew symmetrical matrix using a matrix (3x1 or 1x3)
[in] | a | row or column vector with 3 elements |
|
friend |
This function returns the sum of the squares of the elements of a given Matrix.
[in] | a | matrix |
|
friend |
This function returns the sum of the elements of a given Matrix.
[in] | a | matrix |