DUNE: Uniform Navigational Environment
2.4.1
|
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 | isZeroSized (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) |
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.
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(), 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 DUNE::Navigation::AAKR::add(), blkDiag(), Maneuver::VehicleFormation::FormCollAvoid::Task::checkParameters(), 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::AAKR::sampleSize(), 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(), isVector(), resizeAndFill(), rows(), and size().
double DUNE::Math::Matrix::det | ( | void | ) | const |
Matrix determinant through LUP decomposition Iterative technique O(n^3).
References element(), 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 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 |
Referenced by det(), detr(), set(), toDCM(), toEulerAngles(), and toQuaternion().
double DUNE::Math::Matrix::element | ( | size_t | i | ) |
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 | matrix index |
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(), 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 |
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::SGNavigation::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 |
Referenced by Maneuver::VehicleFormation::FormCollAvoid::Task::consume(), Maneuver::VehicleFormation::FormCollAvoid::Task::formationControl(), DUNE::Navigation::KalmanFilter::getCovariance(), DUNE::Navigation::KalmanFilter::getObservation(), DUNE::Navigation::AAKR::normalize(), Control::ROV::RemoteOperation::Task::onRemoteActions(), Maneuver::VehicleFormation::FormCollAvoid::Task::onResourceAcquisition(), Simulators::UAV::Task::task(), Maneuver::VehicleFormation::FormCollAvoid::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(), resizeAndFill(), rows(), and set().
Referenced by Simulators::AUV::Task::matrixJ(), and Simulators::UAV::Task::matrixJ().
void DUNE::Math::Matrix::identity | ( | void | ) |
Turns the Matrix into an identity matrix if it is squared.
References fill().
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::isInvertible | ( | void | ) | const |
This routine checks if matrix is invertible.
References 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 |
bool DUNE::Math::Matrix::isZeroSized | ( | void | ) | const |
Return true for zero sized matrices.
Referenced by put(), and readFromLines().
[in] | L | lower triangular matrix |
[in] | U | upper triangular matrix |
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 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 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 DUNE::Math::median().
void DUNE::Math::Matrix::minLimitValues | ( | double | min | ) |
Limit the minimum Matrix elements values.
[in] | min | minimum value |
References 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 put(), and resizeAndFill().
Referenced by detr(), and Sylvester().
Right-multiply a matrix with given matrix.
[in] | m | matrix to be multiplied |
Referenced by lup().
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.
Referenced by Navigation::General::Alignment::Task::calibrate(), Maneuver::VehicleFormation::FormCollAvoid::Task::consume(), Maneuver::VehicleFormation::FormCollAvoid::Task::formationControl(), and Simulators::UAVAutopilot::Task::task().
double DUNE::Math::Matrix::norm_inf | ( | void | ) | const |
This implements the infinity-norm.
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 |
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 |
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 |
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 |
double DUNE::Math::Matrix::operator() | ( | size_t | i | ) | const |
This routine returns a value of the matrix.
[in] | i | matrix index |
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 | ) |
This method implements the unary minus operator.
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 isZeroSized().
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 isZeroSized(), 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 DUNE::Navigation::AAKR::add(), fill(), resizeAndFill(), 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(), Navigation::General::Alignment::Task::calibrate(), DUNE::Navigation::CompassCalibration::clear(), DUNE::Navigation::BeamFilter::clear(), cross(), horzCat(), DUNE::Navigation::KalmanFilter::KalmanFilter(), DUNE::Control::LinearSystem::LinearSystem(), mminor(), DUNE::Navigation::AAKR::normalize(), DUNE::Navigation::KalmanFilter::reset(), DUNE::Navigation::AAKR::resize(), 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().
Referenced by Maneuver::VehicleFormation::FormCollAvoid::Task::checkParameters(), 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 DUNE::Navigation::AAKR::add(), blkDiag(), Maneuver::VehicleFormation::FormCollAvoid::Task::checkParameters(), cross(), DUNE::Navigation::AAKR::dataSize(), 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(), 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().
Referenced by DUNE::Navigation::AAKR::add(), blkDiag(), Navigation::General::Alignment::Task::calibrate(), Maneuver::VehicleFormation::FormCollAvoid::Task::consume(), Maneuver::VehicleFormation::FormCollAvoid::Task::formationControl(), horzCat(), 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(), 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(), Matrix(), and transpose.
Referenced by Control::PTU::Task::consume(), Maneuver::VehicleFormation::FormCollAvoid::Task::consume(), Simulators::UAV::Task::matrixJ(), Simulators::UAVAutopilot::Task::task(), Simulators::UAV::Task::task(), Maneuver::VehicleFormation::FormCollAvoid::Task::task(), and DUNE::Navigation::CompassCalibration::updateField().
Matrix DUNE::Math::Matrix::toEulerAngles | ( | void | ) | const |
Convert from DCM or Quaternion to Euler angles attitude representation.
References element(), and Matrix().
Referenced by Navigation::General::Alignment::Task::calibrate().
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 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().
|
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(), resizeAndFill(), rows(), and set().
Referenced by DUNE::Control::LinearSystem::append(), Maneuver::VehicleFormation::FormCollAvoid::Task::consume(), Simulators::AUV::Task::matrixJ(), Simulators::UAV::Task::matrixJ(), Maneuver::VehicleFormation::FormCollAvoid::Task::onResourceAcquisition(), DUNE::Math::operator>>(), and Maneuver::VehicleFormation::FormCollAvoid::Task::teamUnevenUpdate().
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 |