/usr/include/tulip/Matrix.h is in libtulip-dev 3.1.2-2.3ubuntu3.
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 | //-*-c++-*-
/**
Authors: David Auber, Patrick Mary, Morgan Mathiaut
from the LaBRI Visualization Team
Email : auber@tulip-software.org
Last modification : 13/03/2009
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
*/
//@TLPGEOLICENCE#
#ifndef _TLP_GEO_MATRIX_H
#define _TLP_GEO_MATRIX_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <cassert>
#include <iostream>
#include <vector>
#include <tulip/Vector.h>
namespace tlp {
/**
* \addtogroup basic
*/
#define MATRIX Matrix<Obj,SIZE>
/*@{*/
/**
* \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 Vector< Vector<Obj,SIZE> , SIZE > {
public:
Matrix(){}
Matrix(const Vector< Vector<Obj,SIZE> , SIZE > &a) :
Vector< 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();
/**
* 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 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
};
/**
* 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
|