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)
70 return _c[0] == m._c[0] &&
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());
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);
181 #endif // LSST_SPHGEOM_MATRIX3D_H_ Vector3d cwiseProduct(Vector3d const &v) const
cwiseProduct returns the component-wise product of this vector and v.
double inner(Matrix3d const &m) const
inner returns the Frobenius inner product of this matrix with m.
Matrix3d(double m00, double m01, double m02, double m10, double m11, double m12, double m20, double m21, double m22)
This constructor creates a matrix from its components, where mij specifies the component for row i an...
Matrix3d()
This constructor creates a zero matrix.
double operator()(int r, int c) const
The function call operator returns the scalar at row r and column c.
std::ostream & operator<<(std::ostream &, Angle const &)
Matrix3d inverse() const
inverse returns the inverse of this matrix.
Matrix3d(Vector3d const &v)
This constructor creates a diagonal matrix with diagonal components set to the components of v...
Vector3d is a vector in ℝ³ with components stored in double precision.
Vector3d const & getColumn(int c) const
getColumn returns the c-th matrix column. Bounds are not checked.
double getNorm() const
getNorm returns the L2 (Frobenius) norm of this matrix.
A 3x3 matrix with real entries stored in double precision.
This file declares a class for representing vectors in ℝ³.
Matrix3d operator-(Matrix3d const &m) const
The subtraction operator returns the difference between this matrix and m.
Matrix3d operator*(Matrix3d const &m) const
The multiplication operator returns the product of this matrix with matrix m.
Matrix3d transpose() const
transpose returns the transpose of this matrix.
A base class for image defects.
Vector3d getRow(int r) const
getRow returns the r-th matrix row. Bounds are not checked.
Matrix3d(double s)
This constructor returns the identity matrix scaled by s.
Vector3d operator*(Vector3d const &v) const
The multiplication operator returns the product of this matrix with vector v.
Matrix3d operator+(Matrix3d const &m) const
The addition operator returns the sum of this matrix and m.
bool operator==(Matrix3d const &m) const
bool operator!=(Matrix3d const &m) const
double getSquaredNorm() const
getSquaredNorm returns the Frobenius inner product of this matrix with itself.
Matrix3d cwiseProduct(Matrix3d const &m) const
cwiseProduct returns the component-wise product of this matrix and m.