/usr/include/tulip/Matrix.h is in libtulip-dev 4.8.0dfsg-2build2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | /*
*
* This file is part of Tulip (www.tulip-software.org)
*
* Authors: David Auber and the Tulip development Team
* from LaBRI, University of Bordeaux
*
* Tulip is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* Tulip is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
///@cond DOXYGEN_HIDDEN
//@TLPGEOLICENCE#
#ifndef _TLP_GEO_MATRIX_H
#define _TLP_GEO_MATRIX_H
#include <cassert>
#include <iostream>
#include <vector>
#include <tulip/Vector.h>
namespace tlp {
#define MATRIX tlp::Matrix<Obj,SIZE>
/**
* @ingroup Structures
* \brief class for mathematical square matrix
*
* Enables to create a Square Matrix of Obj with a
* limited size and provides Mathematical operation. Mathematical
* operators must be defined for Obj. Out of bound accesses
* are only checked in debug mode.
*
* \author : David Auber auber@tulip-software.org
*
* \author Contributor : Maxime Delorme
* \version 0.0.2 27/04/2005
*/
template<typename Obj,unsigned int SIZE>
class Matrix:public Array< Vector<Obj,SIZE> , SIZE > {
public:
Matrix() {}
Matrix(const Array< Vector<Obj,SIZE> , SIZE > &a) :
Array< Vector<Obj,SIZE> , SIZE >(a) {
}
// Builds a correlation matrix from a covariance matrix !
Matrix(const std::vector<std::vector<Obj> > &covarianceMatrix);
/**
* Fill the matrix with the value of obj
*/
inline MATRIX& fill(Obj obj);
/**
* Compute the determinant of the matrix,
*/
Obj determinant() const;
/**
* Transpose the matrix and return "&(*this)".
*/
MATRIX& transpose();
/**
* Inverse the matrix and return "&(*this)"
*/
MATRIX& inverse();
/**
* add another matrix to the current one and return "&(*this)"
*/
inline MATRIX & operator+=(const MATRIX &mat);
/**
* substract another matrix from the current and return "&(*this)"
*/
inline MATRIX & operator-=(const MATRIX &mat);
/**
* Check equality of two Matrices
*/
inline bool operator==(const MATRIX &) const;
/**
* Check non equality of two Matrices
*/
inline bool operator!=(const MATRIX &) const;
/**
* Multiply the matrix by another matrix and return "&(*this)"
*/
inline MATRIX & operator*=(const MATRIX &mat);
/**
* Multiply all elements of the matrix by obj, return "&(*this)"
*/
inline MATRIX & operator*=(const Obj &obj);
/**
* Divide the matrix by another one return "&(*this)"
*/
inline MATRIX & operator/=(const MATRIX &mat);
/**
* Divide all elements of the matrix by obj, return "&(*this)"
*/
inline MATRIX & operator/=(const Obj &obj);
/**
* Returns the cofactor Matrix of this
*/
MATRIX cofactor() const;
/**
* Returns a new matrix equal to the division of the matrix by
* another matrix"
*/
MATRIX operator/(const MATRIX &mat2) const;
/**
* Returns a new matrix equal to the division of the matrix by
* obj"
*/
MATRIX operator/(const Obj &obj) const;
/**
* Returns a new vector equal to the most influent eigenvector of the
* matrix
*/
inline Vector<Obj,SIZE> powerIteration(const unsigned int nIterations) const;
#ifndef DOXYGEN_NOTFOR_DEVEL
/**
* Simplifies a 3x3 matrix in 2x2 matrix to be used with computeEigenVector
*/
inline bool simplify(Matrix<Obj, 2> &simplifiedMatrix) const;
/**
* Returns the EigenVector of the matrix corresponding to the EigenValue passed, with a base x
* /!\ This can only be used with a 2x2 matrix !!! /!\
*/
inline bool computeEigenVector(const float x, Vector<Obj, 3> &eigenVector) const;
#endif // DOXYGEN_NOTFOR_DEVEL
};
typedef Matrix<float, 3> Mat3f;
typedef Matrix<double, 3> Mat3d;
typedef Matrix<float, 4> Mat4f;
typedef Matrix<double, 4> Mat4d;
/**
* Returns a new matrix equal to the sum of 2 matrices
*/
template<typename Obj, unsigned int SIZE>
inline MATRIX operator+(const MATRIX &mat1, const MATRIX &mat2);
/**
* Returns a new matrix equal to the difference of 2 matrices
*/
template<typename Obj, unsigned int SIZE>
inline MATRIX operator-(const MATRIX &mat1, const MATRIX &mat2);
/**
* Returns a new matrix equal to the multiplication of the matrix by
* obj
*/
template<typename Obj, unsigned int SIZE>
inline MATRIX operator*(const MATRIX &mat, const Obj &obj);
/**
* Returns a new matrix equal to the multiplication of the matrix by
* another matrix
*/
template<typename Obj, unsigned int SIZE>
inline MATRIX operator*(const MATRIX &mat1, const MATRIX &mat2);
/**
* Returns a new vector equal to the multiplication of the vector by
* a matrix,(the vector is automatically transposed to do the multiplication)
*/
template<typename Obj, unsigned int SIZE>
inline Vector<Obj,SIZE> operator*(const Vector<Obj,SIZE> &vec, const tlp::Matrix<Obj, SIZE> &);
/**
* Returns a new vector equal to the multiplication of the matrix by
* a vector
*/
template<typename Obj, unsigned int SIZE>
inline Vector<Obj,SIZE> operator*( const Matrix<Obj, SIZE> &, const Vector<Obj,SIZE> &vec);
}
#include "cxx/Matrix.cxx"
#endif
///@endcond
|