This file is indexed.

/usr/include/terralib/kernel/TeMatrix.h is in libterralib-dev 4.3.0+dfsg.2-11.

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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
/************************************************************************************
TerraLib - a library for developing GIS applications.
Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.

This code is part of the TerraLib library.
This library 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 2.1 of the License, or (at your option) any later version.

You should have received a copy of the GNU Lesser General Public
License along with this library.

The authors reassure the license terms regarding the warranties.
They specifically disclaim any warranties, including, but not limited to,
the implied warranties of merchantability and fitness for a particular purpose.
The library provided hereunder is on an "as is" basis, and the authors have no
obligation to provide maintenance, support, updates, enhancements, or modifications.
In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
indirect, special, incidental, or consequential damages arising out of the use
of this library and its documentation.
*************************************************************************************/
/*! \file TeMatrix.h
    \brief This file models the object matrix of type double
*/
#ifndef  __TERRALIB_INTERNAL_MATRIX_H
#define  __TERRALIB_INTERNAL_MATRIX_H

#include "TeDefines.h"
#include "TeAgnostic.h"

//! This class represents a matrix of elements of type double
class TL_DLL TeMatrix
{
private:
	int nrow;	// Number of rows
	int ncol;	// Number of columns
	double **mat;	// TeMatrix of double elements 

	//! Allocates memory to holds a matrix of l lines by c columns
	short Alloc( int l, int c);

public:
	//! Normal constructor
	TeMatrix();

	//! Copy constructor
	TeMatrix(const TeMatrix& );

	//! Destructor
	~TeMatrix();

	//! Clear memory for matrix.
	void Clear();

	//! Checks if the matrix is initialized.
	int Initialized(){ return ( nrow > 0 && ncol > 0 ) ? (true) : (false); }

	//!	Initializes the matrix with a vector of values
	int Init( int nrow = 1, int ncol = 1 , double* f=0);

	//!	Initializes the matrix with the same value.
	int Init( int nrow , int ncol , double f  );
	
	//! Diagonal matrix with different values.
	int Init(int k, double* f);

	//! Diagonal matrix with the same value
	int Init(int k, double f); 

  //! Acess element in position (lin,col)
  inline const double& operator()( int lin, int col ) const {
    TEAGN_DEBUG_CONDITION( ( ( lin >= 0 ) && ( lin < nrow ) && 
      ( col >= 0 ) && ( col < ncol ) ),
      "Trying to acces an invalid position" )
      
    return mat[lin][col];
  }  
      
	//! Acess element in position (lin,col)
	inline double& operator()( int lin, int col ){ 
    TEAGN_DEBUG_CONDITION( ( ( lin >= 0 ) && ( lin < nrow ) && 
      ( col >= 0 ) && ( col < ncol ) ),
      "Trying to acces an invalid position" )
      
    return mat[lin][col];
	}

  /** @brief Direct line pointer const access.
    * @param lin A valid line number.
    * @return The required line pointer.
    */
  inline double const* const operator[]( int lin ) const 
  {
    TEAGN_DEBUG_CONDITION( ( ( lin >= 0 ) && ( lin < nrow ) ),
      "Trying to acces an invalid line" )
      
    return mat[lin];
  }     
  
  /** @brief Direct line pointer access.
    * @param lin A valid line number.
    * @return The required line pointer.
    */
  inline double* operator[]( int lin )
  {
    TEAGN_DEBUG_CONDITION( ( ( lin >= 0 ) && ( lin < nrow ) ),
      "Trying to acces an invalid line" )
      
    return mat[lin];
  }   

	//! Assign matrix values to another one using operator =
	TeMatrix& operator=( const TeMatrix& m ); 

	//! Compares two matrix using the operator ==
	int 	operator==(const TeMatrix& m) const;

	//! Operator *=
	void 	operator*=(double);

	//! Operator unary minus 
	TeMatrix 	operator-();

	//!	Returns the number of rows.
	int	Nrow() const { return nrow; }
 	
	//!	Returns the number of columns.
	int	Ncol()	const { return ncol; } 

	//!	Print the matrix elements .
	void Print() const;

	//!	Switches two rows "a" and "b".
    void switchRows(int a ,int b);
		
	//! Combines two rows in according to row(i) += b*row(j)
   void combineRows(int i,double b,int j);

	//! 		Finds the transpose of a matrix.
	int	Transpose( TeMatrix& mt ) const;
	
	//! 		Finds the inverse of a matrix, if any.
	int	Inverse ( TeMatrix& mt ) const;

	//!		Finds the inverse of a triangle matrix	acquired from Cholesky decomposition
	int	CholeskyInv (TeMatrix&	mt) const;	
		
	//!	Calculates the inverse of a lowertriangle matrix aquired from the Cholesky decomposition of a simetric positive definide matrix.
	int MatTransf( TeMatrix& mt );	

//!	Checks if the matrix is an uppertriangle matrix.
   	int isUpperTriangle() const;
	
//!	Checks if the matrix is an lowertriangle matrix.
    int isLowerTriangle() const;	

//!	Checks if the matrix is a simetric matrix
	int	isSimetric()	const;		

//!	Checks if the matrix is positive definide
	int	isPositiveDefinide() const;

//!	Calculates the cofactor value of a matrix.
	int	CoFactor(int irow, int jcol, TeMatrix& m) const;

//!	Calculates the determinant value.
	double	Determinant() const;

//	Extracts a triangle matrix from a simetric positive	definide one
	int	CholeskyDecomp( TeMatrix& mt );	

//!	Calculates the EigenVectors.
	int	EigenVectors( TeMatrix& mt ) const;

//!	Calculates the EigenValues.
	int	EigenValues( TeMatrix& mt ) const;

//!	Calculates the EigenVectors.
	int EigenVec( double e_vec[] );
	
	/**
	 * @brief	Matrix trace calcule (the sum of diagonal elements).
	 * @return The matrix trace.
	 */	
	double getTrace() const;
  
  /**
   * @brief Build the pseudo-inverse from this matrix.
   * @note PinvX = Inv( Xt * X ) * Xt, where Inv=Inverse and Xt is the 
   * transposed matrix of X.
   * @return true if OK, false on errors.
   */ 
  bool getPinv( TeMatrix& pinv ) const;  
  
  /**
   * @brief Singular value decomposition (SVD) from this matrix (A).
   * @note A = U . D . Vt, where U is a MxM orthogonal matrix, D is a 
   * MxN diagonal matrix and V is NxN orthogonal matrix.
   * @return true if OK, false on errors.
   */ 
  bool getSVD( TeMatrix& UMtx, TeMatrix& DMtx, TeMatrix& VMtx ) const;  

//!	Sums two matrices.
	friend TL_DLL TeMatrix operator+(const TeMatrix& m1,const TeMatrix& m2);

//!	Subtracts two matrices.
	friend TL_DLL TeMatrix operator-(const TeMatrix&,const TeMatrix&);

//!	Calculates the product of two matrices.
	friend TL_DLL TeMatrix operator*(const TeMatrix&,const TeMatrix&);

//!	Product of the matrix by a constant.
	friend TL_DLL TeMatrix operator*(double c,const TeMatrix&);
  
  /**
   * @brief Generate a identity matrix .
   * @param identity The generated identity matrix.
   * @param width The identity matrix width.
   * @return true if OK, false on errors.
   */
  static bool getIdentity( TeMatrix& identity, unsigned int width );  
  
  /**
   * @brief Generate the product of two matrixes.
   * @note product = matrix1 * matrix2
   * @param matrix1 Input matrix 1.
   * @param matrix2 Input matrix 2.
   * @param productMatrix Output product matrix.
   * @return true if OK, false on errors.
   */
  static bool getProduct( const TeMatrix& matrix1, const TeMatrix& matrix2,
    TeMatrix& productMatrix );  
};


#endif