Templates -- Meow  1.1.4
A C++ template which is unable and also not allowed to compile to obj-file first.
LinearTransformation.h
Go to the documentation of this file.
1 #ifndef math_LinearTransformation_H__
2 #define math_LinearTransformation_H__
3 
4 #include "Transformation.h"
5 #include "Matrix.h"
6 
7 #include <cstdlib>
8 
9 namespace meow {
10 
19 template<class Scalar>
20 class LinearTransformation: public Transformation<Scalar> {
21 private:
22  Matrix<Scalar> matrix_;
23 protected:
27  LinearTransformation(size_t inputRows, size_t outputRows, size_t psize):
28  Transformation<Scalar>(inputRows, 1u, outputRows, 1u, psize),
29  matrix_(outputRows, inputRows, Scalar(0.0)) {
30  }
31 
35  LinearTransformation(size_t inputRows, size_t outputRows, size_t psize,
36  Matrix<Scalar> const& m):
37  Transformation<Scalar>(inputRows, 1u, outputRows, 1u, psize),
38  matrix_(m) {
39  }
40 
47  Transformation<Scalar>(b),
48  matrix_(b.matrix_) {
49  }
50 
58  matrix_.copyFrom(b.matrix_);
59  return *this;
60  }
61 
69  matrix_.referenceFrom(b.matrix_);
70  return *this;
71  }
72 
76  virtual Matrix<Scalar> const& matrix(Matrix<Scalar> const& m) {
77  matrix_.copyFrom(m);
78  return matrix();
79  }
80 
81 public:
86  }
87 
93  virtual Matrix<Scalar> const& matrix() const {
94  return matrix_;
95  }
96 
102  virtual Matrix<Scalar> matrixInv() const {
103  return matrix_.inverse();
104  }
105 };
106 
107 
108 } // meow
109 
110 #endif // math_LinearTransformation_H__
Matrix & referenceFrom(Matrix const &m)
reference
Definition: Matrix.h:101
size_t outputRows() const
Return the number of rows of the output matrix.
Matrix inverse() const
Return a matrix which is an inverse matrix of (*this)
Definition: Matrix.h:382
A base class for implementing kinds of linear transformations.
size_t inputRows() const
Return the number of rows of the input matrix.
virtual Matrix< Scalar > matrixInv() const
Return the inverse of the matrix form of this transformate.
virtual Matrix< Scalar > const & matrix(Matrix< Scalar > const &m)
setup the matrix
Matrix & copyFrom(Matrix const &m)
copy
Definition: Matrix.h:88
LinearTransformation & copyFrom(LinearTransformation const &b)
Copy settings, matrix from another LinearTransformation.
LinearTransformation(LinearTransformation const &b)
Transformation & copyFrom(Transformation const &b)
Copy from the specified one.
virtual Matrix< Scalar > const & matrix() const
Return the matrix form of this transformation.
LinearTransformation(size_t inputRows, size_t outputRows, size_t psize)
Transformation & referenceFrom(Transformation const &b)
reference from the specified one
A base class for implementing kinds of transformations.
LinearTransformation(size_t inputRows, size_t outputRows, size_t psize, Matrix< Scalar > const &m)
LinearTransformation & referenceFrom(LinearTransformation const &b)
Reference settings, matrix from another LinearTransformation.