27 for (
int i = 0; i < 3; i++)
28 for (
int j = 0; j < 3; j++)
34 for (
int i = 0; i < 3; i++)
35 for (
int j = 0; j < 3; j++)
36 os.write((
char*)&
M[i][j],
sizeof(
M[i][j]));
41 for (
int i = 0; i < 3; i++)
42 for (
int j = 0; j < 3; j++)
43 is.read((
char*)&
M[i][j],
sizeof(
M[i][j]));
56 for (
int i = 0; i < 3; i++)
58 for (
int i = 0; i < 3; i++)
60 for (
int i = 0; i < 3; i++)
66 if (
this == &A)
return *
this;
67 for (
int i = 0; i < 3; i++)
68 for (
int j = 0; j < 3; j++)
76 for (
int i = 0; i < 3; i++)
77 for (
int j = 0; j < 3; j++)
78 Erg = Erg && (
M[i][j] == A.
M[i][j]);
85 for (
int i = 0; i < 3; i++)
86 for (
int j = 0; j < 3; j++)
87 Erg = Erg || (
M[i][j] !=
M.M[i][j]);
105 for (
int i = 0; i < 3; i++)
106 for (
int j = 0; j < 3; j++)
107 Erg.
M[i][j] =
M[i][j] + A.
M[i][j];
113 for (
int i = 0; i < 3; i++)
114 for (
int j = 0; j < 3; j++)
115 M[i][j] += A.
M[i][j];
122 for (
int i = 0; i < 3; i++)
123 for (
int j = 0; j < 3; j++)
124 Erg.
M[i][j] = -
M[i][j];
130 for (
int i = 0; i < 3; i++)
131 for (
int j = 0; j < 3; j++)
132 M[i][j] -= A.
M[i][j];
139 for (
int i = 0; i < 3; i++)
140 for (
int j = 0; j < 3; j++)
143 for (
int l = 0; l < 3; l++)
144 m[i][j] +=
M[i][l] * A.
M[l][j];
146 for (
int i = 0; i < 3; i++)
147 for (
int j = 0; j < 3; j++)
154 for (
int i = 0; i < 3; i++)
155 for (
int j = 0; j < 3; j++)
162 for (
int i = 0; i < 3; i++)
163 for (
int j = 0; j < 3; j++)
172 for (
int i = 0; i < 3; i++)
173 for (
int j = 0; j < 3; j++)
174 Erg.
M[i][j] = A.
M[i][j] - B.
M[i][j];
181 for (
int i = 0; i < 3; i++)
182 for (
int j = 0; j < 3; j++)
183 for (
int l = 0; l < 3; l++)
184 Erg.
M[i][j] += A.
M[i][l] * B.
M[l][j];
191 for (
int i = 0; i < 3; i++)
192 for (
int j = 0; j < 3; j++)
193 Erg.
M[i][j] = A.
M[i][j] * x;
200 for (
int i = 0; i < 3; i++)
201 for (
int j = 0; j < 3; j++)
202 Erg.
M[i][j] = x * A.
M[i][j];
209 for (
int i = 0; i < 3; i++)
210 for (
int j = 0; j < 3; j++)
211 Erg[i] += A.
M[i][j] * r[j];
218 for (
int i = 0; i < 3; i++)
219 for (
int j = 0; j < 3; j++)
220 Erg[i] += A.
M[i][j] * r[j];
227 for (
int i = 0; i < 3; i++)
228 for (
int j = 0; j < 3; j++)
229 Erg.
M[i][j] = A.
M[i][j] / x;
246 for (
int i = 0; i < 3; i++)
247 os << A.
M[i][0] <<
" " << A.
M[i][1] <<
" " << A.
M[i][2] << std::endl;
260 for (
int i = 0; i < 3; i++)
261 for (
int j = 0; j < 3; j++)
276 for (
int i = 0; i < 3; i++)
277 for (
int j = 0; j < 3; j++)
278 Erg.
M[i][j] = A.
M[j][i];
291 for (
int i = 0; i < 3; i++)
305 Erg = A.
M[0][0] * (A.
M[1][1] * A.
M[2][2] - A.
M[2][1] * A.
M[1][2])
306 - A.
M[0][1] * (A.
M[1][0] * A.
M[2][2] - A.
M[2][0] * A.
M[1][2])
307 + A.
M[0][2] * (A.
M[1][0] * A.
M[2][1] - A.
M[2][0] * A.
M[1][1]);
322 for (
int k = 0; k < 3; k++)
323 for (
int l = 0; l < 3; l++)
325 if ((k != i) && (l != j)) Erg.
M[k][l] =
M.M[k][l];
326 if ((l == j) && (k == i)) Erg.
M[k][l] = 1;
329 if (l == j) Erg.
M[k][l] = 0;
330 if (k == i) Erg.
M[k][l] = 0;
347 if (C == 0.0) invertable =
false;
350 Erg.
M[0][0] = A.
M[1][1] * A.
M[2][2] - A.
M[2][1] * A.
M[1][2];
351 Erg.
M[1][0] = A.
M[2][0] * A.
M[1][2] - A.
M[1][0] * A.
M[2][2];
352 Erg.
M[2][0] = A.
M[1][0] * A.
M[2][1] - A.
M[2][0] * A.
M[1][1];
354 Erg.
M[0][1] = A.
M[2][1] * A.
M[0][2] - A.
M[0][1] * A.
M[2][2];
355 Erg.
M[1][1] = A.
M[0][0] * A.
M[2][2] - A.
M[2][0] * A.
M[0][2];
356 Erg.
M[2][1] = A.
M[2][0] * A.
M[0][1] - A.
M[0][0] * A.
M[2][1];
358 Erg.
M[0][2] = A.
M[0][1] * A.
M[1][2] - A.
M[1][1] * A.
M[0][2];
359 Erg.
M[1][2] = A.
M[1][0] * A.
M[0][2] - A.
M[0][0] * A.
M[1][2];
360 Erg.
M[2][2] = A.
M[0][0] * A.
M[1][1] - A.
M[0][1] * A.
M[1][0];
380 for (
int i = 0; i < 3; i++)
381 for (
int j = 0; j < 3; j++)
This class represents a threedimensional (numeric) Matrix as a template.
Matrix operator+(const Matrix &A)
bool operator!=(const Matrix &M)
Matrix & operator/=(const T &x)
Matrix & operator+=(const Matrix &A)
bool operator==(const Matrix &A)
T & operator()(int i, int j)
This operator returns the value of the j-th element in the i-th column.
void binWrite(std::ofstream &os)
Matrix & operator*=(const Matrix &A)
void binRead(std::ifstream &is)
friend Matrix operator*(const Matrix &A, const Matrix &B)
friend Matrix invert(const Matrix< T > &A)
Calculates the inverse of a matrix, if possible.
Matrix(Vector< T > a, Vector< T > b, Vector< T > c)
Main constructor for the template class Matrix. This constructor uses three vectors as parameters,...
friend T det(const Matrix &A)
Calculates the determinant of the matrix A.
friend std::istream & operator>>(std::istream &is, Matrix &A)
Input of the matrix from an istream.
friend Matrix cutMatrix(const Matrix &M, int i, int j)
This function returns a matrix where all elements of the i-th column and the j-th row set to zero.
friend Matrix transpose(const Matrix &A)
Calculates the transpose of the matrix A.
friend Matrix invert(const Matrix< T > &A, bool &invertable)
Calculates the inverse of a matrix, if possible.
Matrix & operator-=(const Matrix &A)
friend std::ostream & operator<<(std::ostream &os, const Matrix &A)
Output of the matrix into an ostream Output in the form: M00 M01 M02 M10 M11 M12 M20 M21 M22.
friend Matrix operator/(const Matrix &A, const T &x)
friend T trace(const Matrix &A)
Calculates the trace of matrix A, i.e. the sum over all diagonal elements.
Matrix & operator=(const Matrix &A)
Template class for threedimensional vectors.
Matrix< double > null()
Null-matrix (all components are zero)
const Matrix< double > UNITY
Unity matrix (double-valued)
Matrix< double > rotMatrixA(Vector< double > n, Vector< double > k, double gamma)
Calculates rotation matrix for a rotation around an axis passing through a given point and pointing i...
void trafo(const Vector< double > &e0, const Vector< double > &e1, const Vector< double > &e2, Matrix< double > &H, Matrix< double > &R)
Calculates the transformation matrices from the laboratory coordinate system into a local system and ...
Matrix< std::complex< double > > cunity()
unity matrix (complex)
Matrix< double > Dx(double phi)
Rotation matrix around x axis This function returns the matrix for a rotation around the x-axis:
Matrix< double > Dy(double phi)
Rotation matrix around y axis This function returns the matrix for a rotation around the y-axis:
Matrix< std::complex< double > > operator-(const Matrix< double > &, const Matrix< std::complex< double > > &)
Matrix< std::complex< double > > operator/(const Matrix< double > &, const std::complex< double > &)
Matrix< std::complex< double > > operator*(const Matrix< double > &, const Matrix< std::complex< double > > &)
Matrix< double > Dz(double phi)
Rotation matrix around z axis This function returns the matrix for a rotation around the z-axis:
Matrix< std::complex< double > > operator+(const Matrix< double > &, const Matrix< std::complex< double > > &)
Matrix< double > rotMatrix(const Vector< double > a, double gamma)
Rotation matrix for rotation around the axis a by the angle gamma.
const Matrix< std::complex< double > > CUNITY
Unity matrix (complex-valued)
Matrix< double > unity()
unity matrix (double precision)
This class is used for the iray class. This class is intended for internal use only....
This file contains the Vector template class and some useful functions around this class.