Mantid
Loading...
Searching...
No Matches
MatrixVectorPair.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2015 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9#include "MantidGeometry/DllConfig.h"
10#include "MantidKernel/Matrix.h"
11
12namespace Mantid {
13namespace Geometry {
14
34template <typename MatrixNumericType, typename VectorType> class MatrixVectorPair {
35public:
37 MatrixVectorPair() : m_matrix(3, 3, true), m_vector() {}
38
40 MatrixVectorPair(const Kernel::Matrix<MatrixNumericType> &matrix, const VectorType &vector)
41 : m_matrix(matrix), m_vector(vector) {}
42
43 virtual ~MatrixVectorPair() = default;
44
47
49 const VectorType &getVector() const { return m_vector; }
50
52 template <typename T> T operator*(const T &operand) const { return (m_matrix * operand) + m_vector; }
53
58 (m_matrix * other.m_vector) + m_vector);
59 }
60
64 matrix.Invert();
65
67 }
68
71 return m_matrix == other.m_matrix && m_vector == other.m_vector;
72 }
73
75 bool operator!=(const MatrixVectorPair<MatrixNumericType, VectorType> &other) const { return !operator==(other); }
76
77private:
79 VectorType m_vector;
80};
81
82} // namespace Geometry
83} // namespace Mantid
MatrixVectorPair(const Kernel::Matrix< MatrixNumericType > &matrix, const VectorType &vector)
Constructor from matrix and vector.
const VectorType & getVector() const
Returns a const reference to the stored vector.
Kernel::Matrix< MatrixNumericType > m_matrix
MatrixVectorPair()
Default constructor, unit matrix and 0-vector.
const Kernel::Matrix< MatrixNumericType > & getMatrix() const
Returns a const reference to the internally stored matrix.
MatrixVectorPair< MatrixNumericType, VectorType > operator*(const MatrixVectorPair< MatrixNumericType, VectorType > &other) const
Operator to combine with another MatrixVectorPair.
bool operator!=(const MatrixVectorPair< MatrixNumericType, VectorType > &other) const
Inequality operator.
bool operator==(const MatrixVectorPair< MatrixNumericType, VectorType > &other) const
Comparison operator, compares the matrix & vector stored internally.
MatrixVectorPair< MatrixNumericType, VectorType > getInverse() const
Returns the inverse MatrixVectorPair.
T operator*(const T &operand) const
Operator to transform a vector or point.
Numerical Matrix class.
Definition: Matrix.h:42
T Invert()
LU inversion routine.
Definition: Matrix.cpp:924
Helper class which provides the Collimation Length for SANS instruments.