lsst.sphgeom
21.0.0+e70536a077
|
Go to the documentation of this file.
23 #ifndef LSST_SPHGEOM_MATRIX3D_H_
24 #define LSST_SPHGEOM_MATRIX3D_H_
46 double m10,
double m11,
double m12,
47 double m20,
double m21,
double m22)
69 bool operator==(
Matrix3d const & m)
const {
70 return _c[0] == m._c[0] &&
75 bool operator!=(
Matrix3d const & m)
const {
76 return _c[0] != m._c[0] ||
96 Vector3d sum = p._c[0] + p._c[1] + p._c[2];
97 return sum(0) + sum(1) + sum(2);
110 return Vector3d(_c[0] * v(0) + _c[1] * v(1) + _c[2] * v(2));
117 for (
int i = 0; i < 3; ++i) { r._c[i] = this->
operator*(m._c[i]); }
124 for (
int i = 0; i < 3; ++i) { r._c[i] = _c[i] + m._c[i]; }
131 for (
int i = 0; i < 3; ++i) { r._c[i] = _c[i] - m._c[i]; }
138 for (
int i = 0; i < 3; ++i) { r._c[i] = _c[i].
cwiseProduct(m._c[i]); }
145 t._c[0] =
Vector3d(_c[0].x(), _c[1].x(), _c[2].x());
146 t._c[1] =
Vector3d(_c[0].y(), _c[1].y(), _c[2].y());
147 t._c[2] =
Vector3d(_c[0].z(), _c[1].z(), _c[2].z());
156 Vector3d a0(m(1, 1) * m(2, 2) - m(2, 1) * m(1, 2),
157 m(1, 2) * m(2, 0) - m(2, 2) * m(1, 0),
158 m(1, 0) * m(2, 1) - m(2, 0) * m(1, 1));
161 double rdet = 1.0 / (a0(0) * m(0,0) + a0(1) * m(0,1) + a0(2) * m(0,2));
163 inv._c[0] = a0 * rdet;
164 inv._c[1] =
Vector3d((m(0, 2) * m(2, 1) - m(2, 2) * m(0, 1)) * rdet,
165 (m(0, 0) * m(2, 2) - m(2, 0) * m(0, 2)) * rdet,
166 (m(0, 1) * m(2, 0) - m(2, 1) * m(0, 0)) * rdet);
167 inv._c[2] =
Vector3d((m(0, 1) * m(1, 2) - m(1, 1) * m(0, 2)) * rdet,
168 (m(0, 2) * m(1, 0) - m(1, 2) * m(0, 0)) * rdet,
169 (m(0, 0) * m(1, 1) - m(1, 0) * m(0, 1)) * rdet);
177 std::ostream & operator<<(std::ostream &, Matrix3d
const &);
181 #endif // LSST_SPHGEOM_MATRIX3D_H_
Matrix3d operator-(Matrix3d const &m) const
The subtraction operator returns the difference between this matrix and m.
Definition: Matrix3d.h:129
Matrix3d(double s)
This constructor returns the identity matrix scaled by s.
Definition: Matrix3d.h:63
Matrix3d operator+(Matrix3d const &m) const
The addition operator returns the sum of this matrix and m.
Definition: Matrix3d.h:122
Vector3d operator*(Vector3d const &v) const
Definition: Matrix3d.h:109
Vector3d is a vector in ℝ³ with components stored in double precision.
Definition: Vector3d.h:44
double getSquaredNorm() const
Definition: Matrix3d.h:102
This file declares a class for representing vectors in ℝ³.
Matrix3d cwiseProduct(Matrix3d const &m) const
cwiseProduct returns the component-wise product of this matrix and m.
Definition: Matrix3d.h:136
Matrix3d(double m00, double m01, double m02, double m10, double m11, double m12, double m20, double m21, double m22)
Definition: Matrix3d.h:45
Vector3d const & getColumn(int c) const
getColumn returns the c-th matrix column. Bounds are not checked.
Definition: Matrix3d.h:87
Matrix3d(Vector3d const &v)
Definition: Matrix3d.h:56
double inner(Matrix3d const &m) const
inner returns the Frobenius inner product of this matrix with m.
Definition: Matrix3d.h:94
A 3x3 matrix with real entries stored in double precision.
Definition: Matrix3d.h:38
Matrix3d()
This constructor creates a zero matrix.
Definition: Matrix3d.h:41
Matrix3d operator*(Matrix3d const &m) const
Definition: Matrix3d.h:115
Vector3d cwiseProduct(Vector3d const &v) const
cwiseProduct returns the component-wise product of this vector and v.
Definition: Vector3d.h:150
Matrix3d transpose() const
transpose returns the transpose of this matrix.
Definition: Matrix3d.h:143
double operator()(int r, int c) const
Definition: Matrix3d.h:91
Matrix3d inverse() const
inverse returns the inverse of this matrix.
Definition: Matrix3d.h:152
double getNorm() const
getNorm returns the L2 (Frobenius) norm of this matrix.
Definition: Matrix3d.h:105
Vector3d getRow(int r) const
getRow returns the r-th matrix row. Bounds are not checked.
Definition: Matrix3d.h:82