/usr/include/shark/LinAlg/Base.h is in libshark-dev 3.1.3+ds1-2.
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 | /*!
*
*
* \brief Entry Point for all Basic Linear Algebra(BLAS) in shark
*
*
*
* \author O.Krause, T.Glasmachers, T. Voss
* \date 2010-2011
*
*
* \par Copyright 1995-2015 Shark Development Team
*
* <BR><HR>
* This file is part of Shark.
* <http://image.diku.dk/shark/>
*
* Shark 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.
*
* Shark 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 Shark. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef SHARK_LINALG_BASE_H
#define SHARK_LINALG_BASE_H
/**
* \brief Shark linear algebra definitions
*
* \par
* This file provides all basic definitions for linear algebra.
* If defines objects and views for vectors and matrices over
* several base types as well as a lot of usefull functions.
*/
//for debug error handling of linear algebra
#include <shark/LinAlg/BLAS/blas.h>
#include <shark/Core/Exception.h>
#include <shark/LinAlg/Initialize.h>
#include <shark/LinAlg/Tools.h>
#include <shark/LinAlg/Metrics.h>
#include <boost/serialization/deque.hpp>
#include <deque>
namespace shark{
#define SHARK_VECTOR_MATRIX_TYPEDEFS(basetype, prefix) \
typedef blas::vector< basetype > prefix##Vector; \
typedef blas::vector< const basetype > Const##prefix##Vector; \
typedef blas::matrix< basetype, blas::row_major > prefix##Matrix; \
typedef blas::identity_matrix< basetype > prefix##Identity; \
typedef blas::identity_matrix< basetype > prefix##IdentityMatrix; \
typedef blas::scalar_matrix< basetype > prefix##ScalarMatrix; \
typedef blas::vector_range< prefix##Vector > prefix##VectorRange; \
typedef blas::vector_range< const prefix##Vector > Const##prefix##VectorRange; \
typedef blas::matrix_row< prefix##Matrix > prefix##MatrixRow; \
typedef blas::matrix_row< const prefix##Matrix > Const##prefix##MatrixRow; \
typedef blas::matrix_column< prefix##Matrix > prefix##MatrixColumn; \
typedef blas::matrix_column< const prefix##Matrix > Const##prefix##MatrixColumn; \
typedef blas::matrix_range< prefix##Matrix > prefix##SubMatrix; \
typedef blas::matrix_range< const prefix##Matrix > Const##prefix##SubMatrix; \
typedef blas::compressed_vector< basetype > Compressed##prefix##Vector; \
typedef blas::vector_range< Compressed##prefix##Vector > Compressed##prefix##VectorRange; \
typedef blas::vector_range< const Compressed##prefix##Vector > ConstCompressed##prefix##VectorRange; \
typedef blas::compressed_matrix< basetype > Compressed##prefix##Matrix; \
typedef blas::matrix_row< Compressed##prefix##Matrix > Compressed##prefix##MatrixRow; \
typedef blas::matrix_row< const Compressed##prefix##Matrix > ConstCompressed##prefix##MatrixRow; \
typedef blas::matrix_column< Compressed##prefix##Matrix > Compressed##prefix##MatrixColumn; \
typedef blas::matrix_column< const Compressed##prefix##Matrix > ConstCompressed##prefix##MatrixColumn; \
typedef blas::matrix_range< Compressed##prefix##Matrix > Compressed##prefix##SubMatrix; \
typedef blas::matrix_range< const Compressed##prefix##Matrix > ConstCompressed##prefix##SubMatrix;\
typedef blas::diagonal_matrix<blas::vector< basetype > > prefix##DiagonalMatrix;
#define SHARK_VECTOR_MATRIX_ASSIGNMENT(prefix) \
template<> struct VectorMatrixTraits< prefix##Vector >{ \
typedef prefix##Matrix MatrixType;\
typedef prefix##Matrix DenseMatrixType;\
typedef prefix##Vector VectorType;\
typedef prefix##Vector DenseVectorType;\
typedef prefix##VectorRange SubType;\
typedef prefix##VectorRange DenseSubType;\
typedef Const##prefix##VectorRange ConstSubType;\
typedef Const##prefix##VectorRange ConstDenseSubType;\
};\
template<> struct VectorMatrixTraits< Compressed##prefix##Vector >{ \
typedef Compressed##prefix##Matrix MatrixType;\
typedef prefix##Matrix DenseMatrixType;\
typedef Compressed##prefix##Vector VectorType;\
typedef prefix##Vector DenseVectorType;\
typedef Compressed##prefix##VectorRange SubType;\
typedef prefix##VectorRange DenseSubType;\
typedef ConstCompressed##prefix##VectorRange ConstSubType;\
typedef Const##prefix##VectorRange ConstDenseSubType;\
};\
template<> struct VectorMatrixTraits< prefix##VectorRange > { \
typedef prefix##Matrix MatrixType;\
typedef prefix##Matrix DenseMatrixType;\
typedef prefix##Vector VectorType;\
typedef prefix##Vector DenseVectorType;\
typedef prefix##VectorRange SubType;\
typedef prefix##VectorRange DenseSubType;\
typedef Const##prefix##VectorRange ConstSubType;\
typedef Const##prefix##VectorRange ConstDenseSubType;\
};\
template<> struct VectorMatrixTraits< Compressed##prefix##VectorRange > { \
typedef Compressed##prefix##Matrix MatrixType;\
typedef prefix##Matrix DenseMatrixType;\
typedef Compressed##prefix##Vector VectorType;\
typedef prefix##Vector DenseVectorType;\
typedef Compressed##prefix##VectorRange SubType;\
typedef prefix##VectorRange DenseSubType;\
typedef ConstCompressed##prefix##VectorRange ConstSubType;\
typedef Const##prefix##VectorRange ConstDenseSubType;\
};
SHARK_VECTOR_MATRIX_TYPEDEFS(long double, BigReal);
SHARK_VECTOR_MATRIX_TYPEDEFS(double, Real)
SHARK_VECTOR_MATRIX_TYPEDEFS(float, Float)
SHARK_VECTOR_MATRIX_TYPEDEFS(std::complex<double>, Complex)
SHARK_VECTOR_MATRIX_TYPEDEFS(int, Int)
SHARK_VECTOR_MATRIX_TYPEDEFS(unsigned int, UInt)
SHARK_VECTOR_MATRIX_TYPEDEFS(bool, Bool);
#undef SHARK_VECTOR_MATRIX_TYPEDEFS
///\brief Template which finds for every Vector type the best fitting Matrix.
///
///As default a RealMatrix is used
template<class VectorType>
struct VectorMatrixTraits {
typedef RealMatrix MatrixType;
typedef RealMatrix DenseMatrixType;
typedef RealVector SuperType;
typedef RealVector DenseSuperType;
typedef RealVectorRange SubType;
typedef RealVectorRange DenseSubType;
typedef ConstRealVectorRange ConstSubType;
typedef ConstRealVectorRange ConstDenseSubType;
};
typedef blas::range Range;
typedef blas::permutation_matrix PermutationMatrix;
SHARK_VECTOR_MATRIX_ASSIGNMENT(BigReal);
SHARK_VECTOR_MATRIX_ASSIGNMENT(Real)
SHARK_VECTOR_MATRIX_ASSIGNMENT(Float)
SHARK_VECTOR_MATRIX_ASSIGNMENT(Complex)
SHARK_VECTOR_MATRIX_ASSIGNMENT(Int)
SHARK_VECTOR_MATRIX_ASSIGNMENT(UInt)
SHARK_VECTOR_MATRIX_ASSIGNMENT(Bool)
//this ensures, that Sequence is serializable
///Type of Data sequences.
typedef std::deque<RealVector> Sequence;
}
#endif
|