/usr/include/CLHEP/Matrix/Vector.h is in libclhep-dev 2.1.2.3-1.
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 | // -*- C++ -*-
// CLASSDOC OFF
// ---------------------------------------------------------------------------
// CLASSDOC ON
//
// This file is a part of the CLHEP - a Class Library for High Energy Physics.
//
// Although Vector and Matrix class are very much related, I like the typing
// information I get by making them different types. It is usually an error
// to use a Matrix where a Vector is expected, except in the case that the
// Matrix is a single column. But this case can be taken care of by using
// constructors as conversions. For this same reason, I don't want to make
// a Vector a derived class of Matrix.
//
#ifndef _Vector_H_
#define _Vector_H_
#ifdef GNUPRAGMA
#pragma interface
#endif
#include "CLHEP/Matrix/defs.h"
#include "CLHEP/Matrix/GenMatrix.h"
namespace CLHEP {
class HepRandom;
class HepMatrix;
class HepSymMatrix;
class HepDiagMatrix;
class Hep3Vector;
/**
* @author
* @ingroup matrix
*/
class HepVector : public HepGenMatrix {
public:
inline HepVector();
// Default constructor. Gives vector of length 0.
// Another Vector can be assigned to it.
explicit HepVector(int p);
HepVector(int p, int);
// Constructor. Gives vector of length p.
HepVector(int p, HepRandom &r);
HepVector(const HepVector &v);
HepVector(const HepMatrix &m);
// Copy constructors.
// Note that there is an assignment operator for v = Hep3Vector.
virtual ~HepVector();
// Destructor.
inline const double & operator()(int row) const;
inline double & operator()(int row);
// Read or write a matrix element.
// ** Note that the indexing starts from (1). **
inline const double & operator[](int row) const;
inline double & operator[](int row);
// Read and write an element of a Vector.
// ** Note that the indexing starts from [0]. **
virtual const double & operator()(int row, int col) const;
virtual double & operator()(int row, int col);
// Read or write a matrix element.
// ** Note that the indexing starts from (1,1). **
// Allows accessing Vector using GenMatrix
HepVector & operator*=(double t);
// Multiply a Vector by a floating number.
HepVector & operator/=(double t);
// Divide a Vector by a floating number.
HepVector & operator+=( const HepMatrix &v2);
HepVector & operator+=( const HepVector &v2);
HepVector & operator-=( const HepMatrix &v2);
HepVector & operator-=( const HepVector &v2);
// Add or subtract a Vector.
HepVector & operator=( const HepVector &m2);
// Assignment operators.
HepVector& operator=(const HepMatrix &);
HepVector& operator=(const Hep3Vector &);
// assignment operators from other classes.
HepVector operator- () const;
// unary minus, ie. flip the sign of each element.
HepVector apply(double (*f)(double, int)) const;
// Apply a function to all elements.
HepVector sub(int min_row, int max_row) const;
// Returns a sub vector.
HepVector sub(int min_row, int max_row);
// SGI CC bug. I have to have both with/without const. I should not need
// one without const.
void sub(int row, const HepVector &v1);
// Replaces a sub vector of a Vector with v1.
inline double normsq() const;
// Returns norm squared.
inline double norm() const;
// Returns norm.
virtual int num_row() const;
// Returns number of rows.
virtual int num_col() const;
// Number of columns. Always returns 1. Provided for compatibility with
// GenMatrix.
HepMatrix T() const;
// Returns the transpose of a Vector. Note that the returning type is
// Matrix.
friend inline void swap(HepVector &v1, HepVector &v2);
// Swaps two vectors.
protected:
virtual int num_size() const;
private:
virtual void invert(int&);
// produces an error. Demanded by GenMatrix
friend class HepDiagMatrix;
friend class HepSymMatrix;
friend class HepMatrix;
// friend classes
friend double dot(const HepVector &v1, const HepVector &v2);
// f = v1 * v2;
friend HepVector operator+(const HepVector &v1, const HepVector &v2);
friend HepVector operator-(const HepVector &v1, const HepVector &v2);
friend HepVector operator*(const HepSymMatrix &m1, const HepVector &m2);
friend HepVector operator*(const HepDiagMatrix &m1, const HepVector &m2);
friend HepMatrix operator*(const HepVector &m1, const HepMatrix &m2);
friend HepVector operator*(const HepMatrix &m1, const HepVector &m2);
friend HepVector solve(const HepMatrix &a, const HepVector &v);
friend void tridiagonal(HepSymMatrix *a,HepMatrix *hsm);
friend void row_house(HepMatrix *,const HepMatrix &, double, int, int,
int, int);
friend void row_house(HepMatrix *,const HepVector &, double, int, int);
friend void back_solve(const HepMatrix &R, HepVector *b);
friend void col_house(HepMatrix *,const HepMatrix &,double, int, int,
int, int);
friend HepVector house(const HepSymMatrix &a,int row,int col);
friend HepVector house(const HepMatrix &a,int row,int col);
friend void house_with_update(HepMatrix *a,int row,int col);
friend HepSymMatrix vT_times_v(const HepVector &v);
friend HepVector qr_solve(HepMatrix *, const HepVector &);
#ifdef DISABLE_ALLOC
std::vector<double > m;
#else
std::vector<double,Alloc<double,25> > m;
#endif
int nrow;
};
//
// Operations other than member functions
//
std::ostream& operator<<(std::ostream &s, const HepVector &v);
// Write out Matrix, SymMatrix, DiagMatrix and Vector into ostream.
HepVector operator*(const HepMatrix &m1, const HepVector &m2);
HepVector operator*(double t, const HepVector &v1);
HepVector operator*(const HepVector &v1, double t);
// Multiplication operators.
// Note that m *= x is always faster than m = m * x.
HepVector operator/(const HepVector &v1, double t);
// Divide by a real number.
HepVector operator+(const HepMatrix &m1, const HepVector &v2);
HepVector operator+(const HepVector &v1, const HepMatrix &m2);
HepVector operator+(const HepVector &v1, const HepVector &v2);
// Addition operators
HepVector operator-(const HepMatrix &m1, const HepVector &v2);
HepVector operator-(const HepVector &v1, const HepMatrix &m2);
HepVector operator-(const HepVector &v1, const HepVector &v2);
// subtraction operators
HepVector dsum(const HepVector &s1, const HepVector &s2);
// Direct sum of two vectors;
} // namespace CLHEP
#ifdef ENABLE_BACKWARDS_COMPATIBILITY
// backwards compatibility will be enabled ONLY in CLHEP 1.9
using namespace CLHEP;
#endif
#include "CLHEP/Matrix/Vector.icc"
#endif /*!_Vector_H*/
|