diff options
Diffstat (limited to 'matrix.hpp')
-rw-r--r-- | matrix.hpp | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -141,6 +141,18 @@ public: template<typename T, std::size_t S> class sqmatrix final : public matrix<T, S, S> { +public: + constexpr sqmatrix(const std::array<std::array<T, S>, S> &vs) : + matrix<T, S, S>(vs) + {} + + constexpr sqmatrix(const std::array<T, S * S> &vs) : + matrix<T, S, S>(vs) + {} + + constexpr sqmatrix(T a) : + matrix<T, S, S>(a) {} + static constexpr sqmatrix identity() { sqmatrix ret(0); @@ -176,6 +188,14 @@ class sqmatrix final : public matrix<T, S, S> template<typename T, std::size_t L> class rowmatrix final : public matrix<T, L, 1> { +public: + constexpr rowmatrix(const std::array<T, L> &vs) : + matrix<T, L, 1>(vs) + {} + + constexpr rowmatrix(T a) : + matrix<T, L, 1>(a) {} + constexpr T &operator[](std::size_t i) const { return this->v[i]; @@ -189,6 +209,14 @@ class rowmatrix final : public matrix<T, L, 1> template<typename T, std::size_t L> class colmatrix final : public matrix<T, 1, L> { +public: + constexpr colmatrix(const std::array<T, L> &vs) : + matrix<T, 1, L>(vs) + {} + + constexpr colmatrix(T a) : + matrix<T, 1, L>(a) {} + constexpr T &operator[](std::size_t i) const { return this->v[i]; |