Matrix.hpp
Go to the documentation of this file.
1 // This code is based on Jet framework.
2 // Copyright (c) 2018 Doyub Kim
3 // CubbyFlow is voxel-based fluid simulation engine for computer games.
4 // Copyright (c) 2020 CubbyFlow Team
5 // Core Part: Chris Ohk, Junwoo Hwang, Jihong Sin, Seungwoo Yoo
6 // AI Part: Dongheon Cho, Minseo Kim
7 // We are making my contributions/submissions to this project solely in our
8 // personal capacity and are not conveying any rights to any intellectual
9 // property of any third parties.
10 
11 #ifndef CUBBYFLOW_MATRIX_HPP
12 #define CUBBYFLOW_MATRIX_HPP
13 
16 #include <Core/Utils/Macros.hpp>
19 
20 #include <array>
21 #include <cstdint>
22 #include <vector>
23 
24 namespace CubbyFlow
25 {
26 template <typename T, size_t Rows, size_t Cols>
27 class Matrix final
28  : public MatrixExpression<T, Rows, Cols, Matrix<T, Rows, Cols>>,
29  public MatrixDenseBase<T, Rows, Cols, Matrix<T, Rows, Cols>>
30 {
31  public:
32  static_assert(IsMatrixSizeStatic<Rows, Cols>(),
33  "This class should be a static-sized matrix.");
34 
36  using Base::CopyFrom;
37  using Base::operator();
38 
39  using ValueType = T;
40  using Reference = T&;
41  using ConstReference = const T&;
42  using Pointer = T*;
43  using ConstPointer = const T*;
44  using Iterator = Pointer;
46 
47  constexpr Matrix() : m_elements{}
48  {
49  // Do nothing
50  }
51 
52  Matrix(ConstReference value);
53 
54  template <typename... Args>
55  constexpr Matrix(ConstReference first, Args... rest)
56  : m_elements{ { first, static_cast<ValueType>(rest)... } }
57  {
58  // Do nothing
59  }
60 
61  template <size_t R, size_t C, typename E>
62  Matrix(const MatrixExpression<T, R, C, E>& expression);
63 
65 
66  Matrix(ConstPointer ptr);
67 
68  ~Matrix() = default;
69 
70  constexpr Matrix(const Matrix& other) : m_elements(other.m_elements)
71  {
72  // Do nothing
73  }
74 
75  constexpr Matrix(Matrix&& other) noexcept
76  : m_elements(std::move(other.m_elements))
77  {
78  // Do nothing
79  }
80 
81  Matrix& operator=(const Matrix& other)
82  {
83  m_elements = other.m_elements;
84  return *this;
85  }
86 
87  Matrix& operator=(Matrix&& other) noexcept
88  {
89  m_elements = std::move(other.m_elements);
90  return *this;
91  }
92 
93  void Fill(const T& val);
94 
95  void Fill(const std::function<T(size_t i)>& func);
96 
97  void Fill(const std::function<T(size_t i, size_t j)>& func);
98 
99  void Swap(Matrix& other);
100 
101  [[nodiscard]] constexpr size_t GetRows() const;
102 
103  [[nodiscard]] constexpr size_t GetCols() const;
104 
105  Iterator begin();
106 
107  constexpr ConstIterator begin() const;
108 
109  Iterator end();
110 
111  constexpr ConstIterator end() const;
112 
113  Pointer data();
114 
115  constexpr ConstPointer data() const;
116 
117  Reference operator[](size_t i);
118 
119  ConstReference operator[](size_t i) const;
120 
121  private:
122  std::array<T, Rows * Cols> m_elements;
123 };
124 
125 template <typename T>
126 class Matrix<T, 1, 1> final : public MatrixExpression<T, 1, 1, Matrix<T, 1, 1>>,
127  public MatrixDenseBase<T, 1, 1, Matrix<T, 1, 1>>
128 {
129  public:
131  using Base::operator();
132 
133  using ValueType = T;
134  using Reference = T&;
135  using ConstReference = const T&;
136  using Pointer = T*;
137  using ConstPointer = const T*;
138  using Iterator = Pointer;
140 
141  constexpr Matrix() : x(T{})
142  {
143  // Do nothing
144  }
145 
146  constexpr Matrix(const T& _x) : x(_x)
147  {
148  // Do nothing
149  }
150 
151  template <size_t R, size_t C, typename E>
152  Matrix(const MatrixExpression<T, R, C, E>& expression);
153 
154  Matrix(const std::initializer_list<T>& lst);
155 
156  ~Matrix() = default;
157 
158  constexpr Matrix(const Matrix& other) : x(other.x)
159  {
160  // Do nothing
161  }
162 
163  constexpr Matrix(Matrix&& other) noexcept : x(std::move(other.x))
164  {
165  // Do nothing
166  }
167 
168  Matrix& operator=(const Matrix& other)
169  {
170  x = other.x;
171  return *this;
172  }
173 
174  Matrix& operator=(Matrix&& other) noexcept
175  {
176  x = std::move(other.x);
177  return *this;
178  }
179 
180  void Fill(const T& val);
181 
182  void Fill(const std::function<T(size_t i)>& func);
183 
184  void Fill(const std::function<T(size_t i, size_t j)>& func);
185 
186  void Swap(Matrix& other);
187 
188  [[nodiscard]] constexpr size_t GetRows() const;
189 
190  [[nodiscard]] constexpr size_t GetCols() const;
191 
192  [[nodiscard]] Iterator begin();
193 
194  [[nodiscard]] constexpr ConstIterator begin() const;
195 
196  [[nodiscard]] Iterator end();
197 
198  [[nodiscard]] constexpr ConstIterator end() const;
199 
200  [[nodiscard]] Pointer data();
201 
202  [[nodiscard]] constexpr ConstPointer data() const;
203 
204  Reference operator[](size_t i);
205 
206  ConstReference operator[](size_t i) const;
207 
208  constexpr static Matrix MakeUnitX();
209 
210  constexpr static Matrix MakeUnit(size_t i);
211 
213 };
214 
215 template <typename T>
216 class Matrix<T, 2, 1> final : public MatrixExpression<T, 2, 1, Matrix<T, 2, 1>>,
217  public MatrixDenseBase<T, 2, 1, Matrix<T, 2, 1>>
218 {
219  public:
221  using Base::operator();
222 
223  using ValueType = T;
224  using Reference = T&;
225  using ConstReference = const T&;
226  using Pointer = T*;
227  using ConstPointer = const T*;
228  using Iterator = Pointer;
230 
231  constexpr Matrix() : x(T{}), y(T{})
232  {
233  // Do nothing
234  }
235 
236  constexpr Matrix(const T& _x, const T& _y) : x(_x), y(_y)
237  {
238  // Do nothing
239  }
240 
241  template <size_t R, size_t C, typename E>
242  Matrix(const MatrixExpression<T, R, C, E>& expression);
243 
244  Matrix(const std::initializer_list<T>& lst);
245 
246  ~Matrix() = default;
247 
248  constexpr Matrix(const Matrix& other) : x(other.x), y(other.y)
249  {
250  // Do nothing
251  }
252 
253  constexpr Matrix(Matrix&& other) noexcept
254  : x(std::move(other.x)), y(std::move(other.y))
255  {
256  // Do nothing
257  }
258 
259  Matrix& operator=(const Matrix& other)
260  {
261  x = other.x;
262  y = other.y;
263  return *this;
264  }
265 
266  Matrix& operator=(Matrix&& other) noexcept
267  {
268  x = std::move(other.x);
269  y = std::move(other.y);
270  return *this;
271  }
272 
273  void Fill(const T& val);
274 
275  void Fill(const std::function<T(size_t i)>& func);
276 
277  void Fill(const std::function<T(size_t i, size_t j)>& func);
278 
279  void Swap(Matrix& other);
280 
281  [[nodiscard]] constexpr size_t GetRows() const;
282 
283  [[nodiscard]] constexpr size_t GetCols() const;
284 
285  [[nodiscard]] Iterator begin();
286 
287  [[nodiscard]] constexpr ConstIterator begin() const;
288 
289  [[nodiscard]] Iterator end();
290 
291  [[nodiscard]] constexpr ConstIterator end() const;
292 
293  [[nodiscard]] Pointer data();
294 
295  [[nodiscard]] constexpr ConstPointer data() const;
296 
297  Reference operator[](size_t i);
298 
299  ConstReference operator[](size_t i) const;
300 
301  constexpr static Matrix MakeUnitX();
302 
303  constexpr static Matrix MakeUnitY();
304 
305  constexpr static Matrix MakeUnit(size_t i);
306 
309 };
310 
311 template <typename T>
312 class Matrix<T, 3, 1> final : public MatrixExpression<T, 3, 1, Matrix<T, 3, 1>>,
313  public MatrixDenseBase<T, 3, 1, Matrix<T, 3, 1>>
314 {
315  public:
317  using Base::operator();
318 
319  using ValueType = T;
320  using Reference = T&;
321  using ConstReference = const T&;
322  using Pointer = T*;
323  using ConstPointer = const T*;
324  using Iterator = Pointer;
326 
327  constexpr Matrix() : x(T{}), y(T{}), z(T{})
328  {
329  // Do nothing
330  }
331 
332  constexpr Matrix(const Matrix<T, 2, 1>& _xy, const T& _z)
333  : x(_xy.x), y(_xy.y), z(_z)
334  {
335  // Do nothing
336  }
337 
338  constexpr Matrix(const T& _x, const T& _y, const T& _z)
339  : x(_x), y(_y), z(_z)
340  {
341  // Do nothing
342  }
343 
344  template <size_t R, size_t C, typename E>
345  Matrix(const MatrixExpression<T, R, C, E>& expression);
346 
347  Matrix(const std::initializer_list<T>& lst);
348 
349  ~Matrix() = default;
350 
351  constexpr Matrix(const Matrix& other) : x(other.x), y(other.y), z(other.z)
352  {
353  // Do nothing
354  }
355 
356  constexpr Matrix(Matrix&& other) noexcept
357  : x(std::move(other.x)), y(std::move(other.y)), z(std::move(other.z))
358  {
359  // Do nothing
360  }
361 
362  Matrix& operator=(const Matrix& other)
363  {
364  x = other.x;
365  y = other.y;
366  z = other.z;
367  return *this;
368  }
369 
370  Matrix& operator=(Matrix&& other) noexcept
371  {
372  x = std::move(other.x);
373  y = std::move(other.y);
374  z = std::move(other.z);
375  return *this;
376  }
377 
378  void Fill(const T& val);
379 
380  void Fill(const std::function<T(size_t i)>& func);
381 
382  void Fill(const std::function<T(size_t i, size_t j)>& func);
383 
384  void Swap(Matrix& other);
385 
386  [[nodiscard]] constexpr size_t GetRows() const;
387 
388  [[nodiscard]] constexpr size_t GetCols() const;
389 
390  [[nodiscard]] Iterator begin();
391 
392  [[nodiscard]] constexpr ConstIterator begin() const;
393 
394  [[nodiscard]] Iterator end();
395 
396  [[nodiscard]] constexpr ConstIterator end() const;
397 
398  [[nodiscard]] Pointer data();
399 
400  [[nodiscard]] constexpr ConstPointer data() const;
401 
402  Reference operator[](size_t i);
403 
404  ConstReference operator[](size_t i) const;
405 
406  constexpr static Matrix MakeUnitX();
407 
408  constexpr static Matrix MakeUnitY();
409 
410  constexpr static Matrix MakeUnitZ();
411 
412  constexpr static Matrix MakeUnit(size_t i);
413 
417 };
418 
419 template <typename T>
420 class Matrix<T, 4, 1> final : public MatrixExpression<T, 4, 1, Matrix<T, 4, 1>>,
421  public MatrixDenseBase<T, 4, 1, Matrix<T, 4, 1>>
422 {
423  public:
425  using Base::operator();
426 
427  using ValueType = T;
428  using Reference = T&;
429  using ConstReference = const T&;
430  using Pointer = T*;
431  using ConstPointer = const T*;
432  using Iterator = Pointer;
434 
435  constexpr Matrix() : x(T{}), y(T{}), z(T{}), w(T{})
436  {
437  // Do nothing
438  }
439 
440  constexpr Matrix(const T& _x, const T& _y, const T& _z, const T& _w)
441  : x(_x), y(_y), z(_z), w(_w)
442  {
443  // Do nothing
444  }
445 
446  template <size_t R, size_t C, typename E>
447  Matrix(const MatrixExpression<T, R, C, E>& expression);
448 
449  Matrix(const std::initializer_list<T>& lst);
450 
451  ~Matrix() = default;
452 
453  constexpr Matrix(const Matrix& other)
454  : x(other.x), y(other.y), z(other.z), w(other.w)
455  {
456  // Do nothing
457  }
458 
459  constexpr Matrix(Matrix&& other) noexcept
460  : x(std::move(other.x)),
461  y(std::move(other.y)),
462  z(std::move(other.z)),
463  w(std::move(other.w))
464  {
465  // Do nothing
466  }
467 
468  Matrix& operator=(const Matrix& other)
469  {
470  x = other.x;
471  y = other.y;
472  z = other.z;
473  w = other.w;
474  return *this;
475  }
476 
477  Matrix& operator=(Matrix&& other) noexcept
478  {
479  x = std::move(other.x);
480  y = std::move(other.y);
481  z = std::move(other.z);
482  w = std::move(other.w);
483  return *this;
484  }
485 
486  void Fill(const T& val);
487 
488  void Fill(const std::function<T(size_t i)>& func);
489 
490  void Fill(const std::function<T(size_t i, size_t j)>& func);
491 
492  void Swap(Matrix& other);
493 
494  [[nodiscard]] constexpr size_t GetRows() const;
495 
496  [[nodiscard]] constexpr size_t GetCols() const;
497 
498  [[nodiscard]] Iterator begin();
499 
500  [[nodiscard]] constexpr ConstIterator begin() const;
501 
502  [[nodiscard]] Iterator end();
503 
504  [[nodiscard]] constexpr ConstIterator end() const;
505 
506  [[nodiscard]] Pointer data();
507 
508  [[nodiscard]] constexpr ConstPointer data() const;
509 
510  Reference operator[](size_t i);
511 
512  ConstReference operator[](size_t i) const;
513 
514  constexpr static Matrix MakeUnitX();
515 
516  constexpr static Matrix MakeUnitY();
517 
518  constexpr static Matrix MakeUnitZ();
519 
520  constexpr static Matrix MakeUnitW();
521 
522  constexpr static Matrix MakeUnit(size_t i);
523 
528 };
529 
530 template <typename T>
531 class Matrix<T, MATRIX_SIZE_DYNAMIC, MATRIX_SIZE_DYNAMIC> final
532  : public MatrixExpression<
533  T, MATRIX_SIZE_DYNAMIC, MATRIX_SIZE_DYNAMIC,
534  Matrix<T, MATRIX_SIZE_DYNAMIC, MATRIX_SIZE_DYNAMIC>>,
535  public MatrixDenseBase<
536  T, MATRIX_SIZE_DYNAMIC, MATRIX_SIZE_DYNAMIC,
537  Matrix<T, MATRIX_SIZE_DYNAMIC, MATRIX_SIZE_DYNAMIC>>
538 {
539  public:
540  using ValueType = T;
541  using Reference = T&;
542  using ConstReference = const T&;
543  using Pointer = T*;
544  using ConstPointer = const T*;
545  using Iterator = Pointer;
547  using MatrixDenseBase<
548  T, MATRIX_SIZE_DYNAMIC, MATRIX_SIZE_DYNAMIC,
550 
551  Matrix();
552 
553  Matrix(size_t rows, size_t cols, ConstReference value = ValueType{});
554 
555  template <size_t R, size_t C, typename E>
556  Matrix(const MatrixExpression<T, R, C, E>& expression);
557 
559 
560  explicit Matrix(size_t rows, size_t cols, ConstPointer ptr);
561 
562  ~Matrix() = default;
563 
564  Matrix(const Matrix& other);
565 
566  Matrix(Matrix&& other) noexcept;
567 
568  Matrix& operator=(const Matrix& other);
569 
570  Matrix& operator=(Matrix&& other) noexcept;
571 
572  void Fill(const T& val);
573 
574  void Fill(const std::function<T(size_t i)>& func);
575 
576  void Fill(const std::function<T(size_t i, size_t j)>& func);
577 
578  void Swap(Matrix& other);
579 
580  void Resize(size_t rows, size_t cols, ConstReference val = ValueType{});
581 
582  void Clear();
583 
584  [[nodiscard]] size_t GetRows() const;
585 
586  [[nodiscard]] size_t GetCols() const;
587 
588  [[nodiscard]] Iterator begin();
589 
590  [[nodiscard]] ConstIterator begin() const;
591 
592  [[nodiscard]] Iterator end();
593 
594  [[nodiscard]] ConstIterator end() const;
595 
596  [[nodiscard]] Pointer data();
597 
598  [[nodiscard]] ConstPointer data() const;
599 
600  Reference operator[](size_t i);
601 
602  ConstReference operator[](size_t i) const;
603 
604  private:
605  std::vector<T> m_elements;
606  size_t m_rows = 0;
607  size_t m_cols = 0;
608 };
609 
610 template <typename T>
611 class Matrix<T, MATRIX_SIZE_DYNAMIC, 1> final
612  : public MatrixExpression<T, MATRIX_SIZE_DYNAMIC, 1,
613  Matrix<T, MATRIX_SIZE_DYNAMIC, 1>>,
614  public MatrixDenseBase<T, MATRIX_SIZE_DYNAMIC, 1,
615  Matrix<T, MATRIX_SIZE_DYNAMIC, 1>>
616 {
617  public:
618  using ValueType = T;
619  using Reference = T&;
620  using ConstReference = const T&;
621  using Pointer = T*;
622  using ConstPointer = const T*;
623  using Iterator = Pointer;
625  using MatrixDenseBase<T, MATRIX_SIZE_DYNAMIC, 1,
627 
628  Matrix();
629 
630  Matrix(size_t rows, ConstReference value = ValueType{});
631 
632  template <size_t R, size_t C, typename E>
633  Matrix(const MatrixExpression<T, R, C, E>& expression);
634 
635  Matrix(const std::initializer_list<T>& lst);
636 
637  explicit Matrix(size_t rows, ConstPointer ptr);
638 
639  ~Matrix() = default;
640 
641  Matrix(const Matrix& other);
642 
643  Matrix(Matrix&& other) noexcept;
644 
645  Matrix& operator=(const Matrix& other);
646 
647  Matrix& operator=(Matrix&& other) noexcept;
648 
649  void Fill(const T& val);
650 
651  void Fill(const std::function<T(size_t i)>& func);
652 
653  void Fill(const std::function<T(size_t i, size_t j)>& func);
654 
655  void Swap(Matrix& other);
656 
657  void Resize(size_t rows, ConstReference val = ValueType{});
658 
659  void AddElement(ConstReference newElem);
660 
661  void AddElement(const Matrix& newElems);
662 
663  void Clear();
664 
665  [[nodiscard]] size_t GetRows() const;
666 
667  [[nodiscard]] constexpr size_t GetCols() const;
668 
669  [[nodiscard]] Iterator begin();
670 
671  [[nodiscard]] ConstIterator begin() const;
672 
673  [[nodiscard]] Iterator end();
674 
675  [[nodiscard]] ConstIterator end() const;
676 
677  [[nodiscard]] Pointer data();
678 
679  [[nodiscard]] ConstPointer data() const;
680 
681  Reference operator[](size_t i);
682 
683  ConstReference operator[](size_t i) const;
684 
685  private:
686  std::vector<T> m_elements;
687 };
688 
689 template <typename T>
691 
692 template <typename T>
694 
695 template <typename T>
697 
710 
723 
736 
737 template <typename T, size_t Rows>
739 
740 template <typename T>
742 
743 template <typename T>
745 
746 template <typename T>
748 
749 template <typename T>
751 
764 
777 
790 
803 
804 template <typename T>
806 
819 
820 template <typename T>
822 
835 
836 template <typename T, size_t Rows, size_t Cols>
837 struct GetScalarType<Matrix<T, Rows, Cols>>
838 {
839  using value = T;
840 };
841 
842 template <typename T, size_t R1, size_t C1, size_t R2, size_t C2, typename M2>
844 
845 template <typename T, size_t Rows, size_t Cols>
846 void operator+=(Matrix<T, Rows, Cols>& a, const T& b);
847 
848 template <typename T, size_t R1, size_t C1, size_t R2, size_t C2, typename M2>
850 
851 template <typename T, size_t Rows, size_t Cols>
852 void operator-=(Matrix<T, Rows, Cols>& a, const T& b);
853 
854 template <typename T, size_t R1, size_t C1, size_t R2, size_t C2, typename M2>
856 
857 template <typename T, size_t R1, size_t C1, size_t R2, size_t C2, typename M2>
859 
860 template <typename T, size_t Rows, size_t Cols>
861 void operator*=(Matrix<T, Rows, Cols>& a, const T& b);
862 
863 template <typename T, size_t R1, size_t C1, size_t R2, size_t C2, typename M2>
865 
866 template <typename T, size_t Rows, size_t Cols>
867 void operator/=(Matrix<T, Rows, Cols>& a, const T& b);
868 
869 template <typename T, size_t Rows, size_t Cols, typename M1, typename M2>
870 constexpr std::enable_if_t<IsMatrixSizeStatic<Rows, Cols>(), bool> operator==(
873 
874 template <typename T, size_t R1, size_t C1, size_t R2, size_t C2, typename M1,
875  typename M2>
878 
879 template <typename T, size_t R1, size_t C1, size_t R2, size_t C2, typename M1,
880  typename M2>
883 
884 template <typename T, size_t Rows, size_t Cols, typename M1,
885  typename BinaryOperation>
886 constexpr std::enable_if_t<TraitIsMatrixSizeStatic<Rows, Cols>::value, T>
887 Accumulate(const MatrixExpression<T, Rows, Cols, M1>& a, const T& init,
888  BinaryOperation op);
889 
890 template <typename T, size_t Rows, size_t Cols, typename M1>
891 constexpr std::enable_if_t<TraitIsMatrixSizeStatic<Rows, Cols>::value, T>
892 Accumulate(const MatrixExpression<T, Rows, Cols, M1>& a, const T& init);
893 
894 template <typename T, size_t Rows, size_t Cols, typename M1>
895 constexpr std::enable_if_t<TraitIsMatrixSizeStatic<Rows, Cols>::value, T>
897 
898 template <typename T, size_t Rows, size_t Cols, typename M1,
899  typename BinaryOperation>
900 constexpr std::enable_if_t<TraitIsMatrixSizeDynamic<Rows, Cols>::value, T>
901 Accumulate(const MatrixExpression<T, Rows, Cols, M1>& a, const T& init,
902  BinaryOperation op);
903 
904 template <typename T, size_t Rows, size_t Cols, typename M1>
905 constexpr std::enable_if_t<TraitIsMatrixSizeDynamic<Rows, Cols>::value, T>
906 Accumulate(const MatrixExpression<T, Rows, Cols, M1>& a, const T& init);
907 
908 template <typename T, size_t Rows, size_t Cols, typename M1>
909 constexpr std::enable_if_t<TraitIsMatrixSizeDynamic<Rows, Cols>::value, T>
911 
912 template <typename T, size_t Rows, size_t Cols, typename M1>
913 constexpr T Product(const MatrixExpression<T, Rows, Cols, M1>& a,
914  const T& init);
915 
916 template <typename T, size_t Rows, size_t Cols, typename M1, typename M2,
917  typename M3, typename M4>
918 std::enable_if_t<IsMatrixSizeStatic<Rows, Cols>(), Matrix<T, Rows, Cols>>
922  const MatrixExpression<T, Rows, Cols, M4>& f3, T f);
923 } // namespace CubbyFlow
924 
926 
927 #endif
constexpr Matrix()
Definition: Matrix.hpp:47
constexpr Matrix(Matrix &&other) noexcept
Definition: Matrix.hpp:356
constexpr Matrix(const Matrix< T, 2, 1 > &_xy, const T &_z)
Definition: Matrix.hpp:332
Matrix & operator=(Matrix &&other) noexcept
Definition: Matrix.hpp:87
const T * ConstPointer
Definition: Matrix.hpp:323
Matrix & operator=(const Matrix &other)
Definition: Matrix.hpp:468
T & Reference
Definition: Matrix.hpp:320
Matrix & operator=(Matrix &&other) noexcept
Definition: Matrix.hpp:477
T * Pointer
Definition: Matrix.hpp:226
const T * ConstPointer
Definition: Matrix.hpp:622
constexpr Matrix(Matrix &&other) noexcept
Definition: Matrix.hpp:459
Definition: MatrixDenseBase.hpp:20
Matrix & operator=(Matrix &&other) noexcept
Definition: Matrix.hpp:370
Pointer Iterator
Definition: Matrix.hpp:432
ConstPointer ConstIterator
Definition: Matrix.hpp:624
const double & ConstReference
Definition: Matrix.hpp:41
ValueType y
Definition: Matrix.hpp:415
const T & ConstReference
Definition: Matrix.hpp:321
Matrix & operator=(const Matrix &other)
Definition: Matrix.hpp:259
T & Reference
Definition: Matrix.hpp:134
constexpr Matrix(const Matrix &other)
Definition: Matrix.hpp:70
constexpr std::enable_if_t< IsMatrixSizeStatic< Rows, Cols >), bool > operator==(const MatrixExpression< T, Rows, Cols, M1 > &a, const MatrixExpression< T, Rows, Cols, M2 > &b)
Definition: Matrix-Impl.hpp:1408
Returns the type of the value itself.
Definition: TypeHelpers.hpp:18
T * Pointer
Definition: Matrix.hpp:430
T ValueType
Definition: Matrix.hpp:319
void CopyFrom(const MatrixExpression< T, R, C, E > &expression)
Copies from generic expression.
Definition: MatrixDenseBase-Impl.hpp:21
T ValueType
Definition: Matrix.hpp:223
Pointer Iterator
Definition: Matrix.hpp:324
const T * ConstPointer
Definition: Matrix.hpp:137
ValueType w
Definition: Matrix.hpp:527
constexpr Matrix(const T &_x)
Definition: Matrix.hpp:146
const double * ConstPointer
Definition: Matrix.hpp:43
ValueType x
Definition: Matrix.hpp:307
Matrix & operator=(Matrix &&other) noexcept
Definition: Matrix.hpp:174
Matrix & operator=(const Matrix &other)
Definition: Matrix.hpp:168
ValueType y
Definition: Matrix.hpp:308
constexpr Matrix()
Definition: Matrix.hpp:231
constexpr Matrix(Matrix &&other) noexcept
Definition: Matrix.hpp:163
void ElemIDiv(Matrix< T, R1, C1 > &a, const MatrixExpression< T, R2, C2, M2 > &b)
Definition: Matrix-Impl.hpp:1393
Matrix & operator=(Matrix &&other) noexcept
Definition: Matrix.hpp:266
ValueType y
Definition: Matrix.hpp:525
Pointer data()
Definition: Matrix-Impl.hpp:298
void Fill(const T &val)
Definition: Matrix-Impl.hpp:226
Pointer Iterator
Definition: Matrix.hpp:138
Pointer Iterator
Definition: Matrix.hpp:228
Iterator end()
Definition: Matrix-Impl.hpp:285
const T & ConstReference
Definition: Matrix.hpp:135
Definition: Matrix.hpp:27
constexpr Matrix(Matrix &&other) noexcept
Definition: Matrix.hpp:253
constexpr Matrix()
Definition: Matrix.hpp:435
constexpr T Product(const MatrixExpression< T, Rows, Cols, M1 > &a, const T &init)
Definition: Matrix-Impl.hpp:1503
constexpr Matrix(const Matrix &other)
Definition: Matrix.hpp:158
Matrix & operator=(const Matrix &other)
Definition: Matrix.hpp:81
constexpr Matrix(ConstReference first, Args... rest)
Definition: Matrix.hpp:55
const T & ConstReference
Definition: Matrix.hpp:620
constexpr Matrix(const T &_x, const T &_y, const T &_z, const T &_w)
Definition: Matrix.hpp:440
void operator+=(Matrix< T, R1, C1 > &a, const MatrixExpression< T, R2, C2, M2 > &b)
Definition: Matrix-Impl.hpp:1342
ValueType z
Definition: Matrix.hpp:416
Definition: pybind11Utils.hpp:20
T ValueType
Definition: Matrix.hpp:427
ValueType x
Definition: Matrix.hpp:414
ConstPointer ConstIterator
Definition: Matrix.hpp:139
const T * ConstPointer
Definition: Matrix.hpp:431
constexpr Matrix(const Matrix &other)
Definition: Matrix.hpp:453
T * Pointer
Definition: Matrix.hpp:136
const T & ConstReference
Definition: Matrix.hpp:429
Definition: Matrix.hpp:216
void operator/=(Matrix< T, Rows, Cols > &a, const T &b)
Definition: Matrix-Impl.hpp:1400
ConstPointer ConstIterator
Definition: Matrix.hpp:45
constexpr Matrix()
Definition: Matrix.hpp:141
constexpr Matrix(const T &_x, const T &_y, const T &_z)
Definition: Matrix.hpp:338
ConstPointer ConstIterator
Definition: Matrix.hpp:229
constexpr Matrix(const T &_x, const T &_y)
Definition: Matrix.hpp:236
constexpr size_t GetCols() const
Definition: Matrix-Impl.hpp:266
void operator*=(Matrix< T, R1, C1 > &a, const MatrixExpression< T, R2, C2, M2 > &b)
Definition: Matrix-Impl.hpp:1366
Base class for matrix expression.
Definition: MatrixExpression.hpp:93
T * Pointer
Definition: Matrix.hpp:621
constexpr Matrix(const Matrix &other)
Definition: Matrix.hpp:351
const T & ConstReference
Definition: Matrix.hpp:225
constexpr std::enable_if_t< TraitIsMatrixSizeStatic< Rows, Cols >::value, T > Accumulate(const MatrixExpression< T, Rows, Cols, M1 > &a, const T &init, BinaryOperation op)
Definition: Matrix-Impl.hpp:1452
bool operator!=(const MatrixExpression< T, R1, C1, M1 > &a, const MatrixExpression< T, R2, C2, M2 > &b)
Definition: Matrix-Impl.hpp:1443
void operator-=(Matrix< T, R1, C1 > &a, const MatrixExpression< T, R2, C2, M2 > &b)
Definition: Matrix-Impl.hpp:1354
Reference operator[](size_t i)
Definition: Matrix-Impl.hpp:311
constexpr Matrix()
Definition: Matrix.hpp:327
typename NestedInitializerLists< T, N >::Type NestedInitializerListsT
Definition: NestedInitializerList.hpp:57
Iterator begin()
Definition: Matrix-Impl.hpp:272
std::enable_if_t< std::is_arithmetic< T >::value, T > MonotonicCatmullRom(const T &f0, const T &f1, const T &f2, const T &f3, T t)
Computes monotonic Catmull-Rom interpolation.
Definition: MathUtils-Impl.hpp:336
constexpr size_t GetRows() const
Definition: Matrix-Impl.hpp:260
ConstPointer ConstIterator
Definition: Matrix.hpp:325
T & Reference
Definition: Matrix.hpp:428
constexpr Matrix(Matrix &&other) noexcept
Definition: Matrix.hpp:75
Pointer Iterator
Definition: Matrix.hpp:623
T ValueType
Definition: Matrix.hpp:133
void Swap(Matrix &other)
Definition: Matrix-Impl.hpp:254
T & Reference
Definition: Matrix.hpp:619
constexpr Matrix(const Matrix &other)
Definition: Matrix.hpp:248
ValueType x
Definition: Matrix.hpp:524
Matrix & operator=(const Matrix &other)
Definition: Matrix.hpp:362
ValueType z
Definition: Matrix.hpp:526
void ElemIMul(Matrix< T, R1, C1 > &a, const MatrixExpression< T, R2, C2, M2 > &b)
Definition: Matrix-Impl.hpp:1375
ValueType x
Definition: Matrix.hpp:212
const T * ConstPointer
Definition: Matrix.hpp:227
ConstPointer ConstIterator
Definition: Matrix.hpp:433
T & Reference
Definition: Matrix.hpp:224
T * Pointer
Definition: Matrix.hpp:322