-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmatrix.hpp
49 lines (37 loc) · 1.07 KB
/
matrix.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
* Copyright 2020 Casey Sanchez
*/
#pragma once
#include <vector>
#include <complex>
#include <cmath>
#include <algorithm>
#include <memory>
#include <stdexcept>
#include <variant>
#include "node.hpp"
class Matrix
{
size_t m_rows;
size_t m_cols;
std::vector<Scalar> m_elements;
public:
static Matrix Identity(size_t const &dim);
Matrix();
Matrix(size_t const &rows, size_t const &cols);
Matrix(size_t const &rows, size_t const &cols, std::vector<Scalar> const &elements);
size_t Rows() const;
size_t Cols() const;
Scalar &operator()(size_t const &row, size_t const &col);
Scalar operator()(size_t const &row, size_t const &col) const;
/*
Matrix Pow(int32_t const &other) const;
*/
Matrix Submatrix(size_t const &row, size_t const &col) const;
Matrix Transpose() const;
Scalar Minor(size_t const &row, size_t const &col) const;
Scalar Determinant() const;
Matrix Cofactor() const;
Matrix Inverse() const;
friend std::ostream &operator<<(std::ostream &ostream, Matrix const &matrix);
};