This file is indexed.

/usr/include/linbox/util/write-mm.h is in liblinbox-dev 1.4.2-3.

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
/* Copyright (C) 2012 LinBox
 * Written by bds
 *
 *
 *
 * ========LICENCE========
 * This file is part of the library LinBox.
 *
  * LinBox 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.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 * ========LICENCE========
 */

#ifndef __LINBOX_write_mm_h
#define __LINBOX_write_mm_h

/* write-mm.h
 * Tools to help write fields and matrices in matrix market formats.
 *
 */

#include <iostream>
#include <string>
#include "linbox/integer.h"

namespace LinBox
{

/// Write second line and comment part of matrix market header
template <class Field>
std::ostream& writeMMComment(std::ostream& os, Field& F, std::string name, std::string comment) {
	F.write(os << "% written by LinBox::" << name << "<field>, field = ") << std::endl;
	//F.write(os << name << "<"/*, std::string("")*/) << " >(F)" << std::endl;
	if (comment.size() > 0)
		os << "%" << std::endl << "% " << comment << std::endl << "%" << std::endl;
    return os;
}

/// Write matrix market header (up to the i,j,val lines) for a sparse or structured matrix.
template <class BB>
std::ostream& writeMMCoordHeader(std::ostream& os, BB& A, size_t nnz, std::string name, std::string comment = "") {
	os << "%%MatrixMarket matrix coordinate integer general" << std::endl;
	writeMMComment(os, A.field(), name, comment);
	os << A.rowdim() << " " << A.coldim() << " " << nnz << std::endl;
	return os;
}

/// Write matrix market header (up to the i,j lines) for a {0,1} sparse or structured matrix.
template <class BB>
std::ostream& writeMMPatternHeader(std::ostream& os, BB& A, size_t nnz, std::string name, std::string comment = "") {
	os << "%%MatrixMarket matrix coordinate pattern general" << std::endl;
	writeMMComment(os, A.field(), name, comment);
	os << A.rowdim() << " " << A.coldim() << " " << nnz << std::endl;
	return os;
}

/// Write matrix market header (up to the entry lines) for a dense matrix.
template <class BB>
std::ostream& writeMMArrayHeader(std::ostream& os, BB& A, std::string name, std::string comment = "") {
	os << "%%MatrixMarket matrix array integer general" << std::endl;
	writeMMComment(os, A.field(), name, comment);
	os << A.rowdim() << " " << A.coldim() << std::endl;
	return os;
}

/// Generic dense matrix writer to matrix market array format (col major).
template <class Mat>
std::ostream& writeMMArray(std::ostream& os, Mat& A, std::string name, std::string comment = "") {
	writeMMArrayHeader(os, A, name, comment);
	typename Mat::Field::Element x; A.field().assign(x, A.field().zero);
	for (size_t j = 0; j < A.coldim(); ++j)
		for (size_t i = 0; i < A.rowdim(); ++i)
			os << A.getEntry(x, i, j) << std::endl;
	return os;
}

/// eltype(x) returns a string containing the name of the type of field or ring element x.
inline std::string eltype(float x) { return "float"; }
inline std::string eltype(double x) { return "double"; }
inline std::string eltype(int8_t x) { return "int8_t"; }
inline std::string eltype(int16_t x) { return "int16_t"; }
inline std::string eltype(int32_t x) { return "int32_t"; }
inline std::string eltype(int64_t x) { return "int64_t"; }
inline std::string eltype(integer x) { return "integer"; }
inline std::string eltype(uint8_t x) { return "uint8_t"; }
inline std::string eltype(uint16_t x) { return "uint16_t"; }
inline std::string eltype(uint32_t x) { return "uint32_t"; }
inline std::string eltype(uint64_t x) { return "uint64_t"; }

}  // end of namespace LinBox
#endif // __write_mm_h

// Local Variables:
// mode: C++
// tab-width: 8
// indent-tabs-mode: nil
// c-basic-offset: 8
// End:
// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s