This file is indexed.

/usr/include/libMems-1.6/libMems/Matrix.h is in libmems-1.6-dev 1.6.0+4725-4.

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
/*******************************************************************************
 * $Id: Matrix.h,v 1.6 2004/02/27 23:08:55 darling Exp $
 * This file is copyright 2002-2007 Aaron Darling and authors listed in the AUTHORS file.
 * This file is licensed under the GPL.
 * Please see the file called COPYING for licensing details.
 * **************
 ******************************************************************************/

#ifndef __Matrix_h__
#define __Matrix_h__

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "libGenome/gnSetup.h"
#include <iostream>
#include <sstream>
#include <vector>
#include <stdexcept>

template<class T>
class Matrix
{
public:
	Matrix();
	Matrix(unsigned nrows, unsigned ncols);
	// Throws a BadSize object if either size is zero
	class BadSize : public std::range_error{
	public:
		BadSize() : std::range_error( "Bad matrix size" ){}
	};

	// Based on the Law Of The Big Three:
	~Matrix();	
	Matrix(const Matrix<T>& m);
	Matrix<T>& operator= (const Matrix<T>& m);
   	// Access methods to get the (i,j) element:	
	T& operator() (unsigned i, unsigned j);
	const T& operator() (unsigned i, unsigned j) const;
	// These throw a BoundsViolation object if i or j is too big
	class BoundsViolation : public std::range_error{
	public:
		BoundsViolation() : std::range_error( "Index out of bounds" ){}
	 };
	// Support for initializing each matrix element to a value
	void init( const T& init_val );
	
	void print( std::ostream& os ) const;
	void read( std::istream& is );

	unsigned rows() const;
	unsigned cols() const;
protected:
	T* data_;
	unsigned nrows_, ncols_;
};
   
template<class T>
inline Matrix<T>::Matrix()
{
	data_ = NULL;
	nrows_ = 0;
	ncols_ = 0;
}

template<class T>
inline unsigned Matrix<T>::rows() const
{
	return nrows_;
}

template<class T>
inline unsigned Matrix<T>::cols() const
{
	return ncols_;
}

template<class T>
inline T& Matrix<T>::operator() (unsigned row, unsigned col)
{
	if (row >= nrows_ || col >= ncols_) 
		throw BoundsViolation();
	return data_[row*ncols_ + col];
}
   
template<class T>
inline const T& Matrix<T>::operator() (unsigned row, unsigned col) const
{
	if (row >= nrows_ || col >= ncols_) {
		std::cout << "debug me ";
		throw BoundsViolation();
	}
	return data_[row*ncols_ + col];
}
   
template<class T>
inline Matrix<T>::Matrix(unsigned nrows, unsigned ncols)
	: data_  (new T[nrows * ncols]),
	  nrows_ (nrows),
	  ncols_ (ncols)
{
}
template<class T>
inline Matrix<T>::Matrix(const Matrix<T>& m){
	*this = m;
}

template<class T>
inline Matrix<T>& Matrix<T>::operator=( const Matrix<T>& m )
{
	if( data_ != NULL )
		delete[] data_;
	data_ = new T[m.nrows_ * m.ncols_];
	nrows_ = m.nrows_;
	ncols_ = m.ncols_;
	memcpy( data_, m.data_, nrows_ * ncols_ * sizeof( T ) );
	return *this;
}

template<class T>
inline Matrix<T>::~Matrix()
{
	if( data_ != NULL )
		delete[] data_;
}

template<class T>
inline void Matrix<T>::init( const T& init_val )
{
	for( unsigned rowI = 0; rowI < nrows_; rowI++ )
		for( unsigned colI = 0; colI < ncols_; colI++ )
			data_[ rowI * ncols_ + colI ] = init_val;
}

template<class T>
inline void Matrix<T>::print( std::ostream& os ) const{
	for( unsigned rowI = 0; rowI < nrows_; rowI++ ){
		for( unsigned colI = 0; colI < ncols_; colI++ ){
			if( colI > 0 )
				os << '\t';
			os << data_[ rowI * ncols_ + colI ];
		}
		os << std::endl;
	}
}

template<class T>
inline void Matrix<T>::read( std::istream& is ){
	std::vector< std::string > lines;
	std::string cur_line;
	while( std::getline( is, cur_line ) )
		lines.push_back( cur_line );
		
	nrows_ = lines.size();
	// count ncols
	std::stringstream ss( lines[0] );
	ncols_ = 0;
	while( std::getline( ss, cur_line, '\t' ) )
		ncols_++;

	data_ = new T[nrows_ * ncols_];
	
	int valueI = 0;
	for( int lineI = 0; lineI < lines.size(); lineI++ ){
		ss = std::stringstream( lines[ lineI ] );
		std::getline( ss, cur_line, '\t' );
		std::stringstream type_stream( cur_line );
		type_stream >> data_[ valueI ];
		valueI++;
	}
}

#endif // __Matrix_h__