diff options
author | Jon Santmyer <jon@jonsantmyer.com> | 2022-11-18 10:12:04 -0500 |
---|---|---|
committer | Jon Santmyer <jon@jonsantmyer.com> | 2022-11-18 10:12:04 -0500 |
commit | fe32cd6b48e5d17ccfc60f6ea69d1345ae8dfa58 (patch) | |
tree | bc467eccded607745011c948c214c8d63892c197 | |
parent | 3d57fbd094468cc2065f724dd3d0dcbb67cb8c85 (diff) | |
download | crmatrix-master.tar.gz crmatrix-master.tar.bz2 crmatrix-master.zip |
-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]; |