Templates -- Meow  1.1.2
不能,也不應該先編譯成obj-file的templates
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 
80  matrix_.copyFrom(m);
81  return matrix_;
82  }
83 public:
88  }
89 
95  virtual Matrix<Scalar> const& matrix() const {
96  return matrix_;
97  }
98 
104  virtual Matrix<Scalar> matrixInv() const {
105  return matrix_.inverse();
106  }
107 };
108 
109 }
110 
111 #endif // math_LinearTransformation_H__