-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMatrix.h
More file actions
47 lines (37 loc) · 1.44 KB
/
Matrix.h
File metadata and controls
47 lines (37 loc) · 1.44 KB
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
#ifndef MATRIX_H_
#define MATRIX_H_
#include <iostream>
#include <vector>
#include <cstdarg>
class Matrix{
public:
Matrix();
Matrix(std::vector<double> const &v);
Matrix(std::vector<std::vector<double> > const &v);
Matrix(const unsigned rows, const unsigned cols);
Matrix(const unsigned rows, const unsigned cols, double const &num);
Matrix(const unsigned rows, const unsigned cols, double (*initializer)());
double get(const unsigned row, const unsigned col) const;
double& get(const unsigned row, const unsigned col);
Matrix getRow(const unsigned row);
double set(const unsigned row, const unsigned col, const unsigned val);
double rows() const;
double cols() const;
friend std::ostream& operator<<(std::ostream& os, const Matrix &m);
friend Matrix link(int count, ...);
private:
std::vector<std::vector<double> > m;
};
Matrix operator^(Matrix const &m1, Matrix const &m2);
Matrix operator%(Matrix const &m1, Matrix const &m2);
Matrix operator*(Matrix const &m1, Matrix const &m2);
Matrix operator*(const double num, Matrix const &m);
Matrix operator/(Matrix const &m1, Matrix const &m2);
Matrix operator/(Matrix const &m, const double num);
Matrix operator+(Matrix const &m1, Matrix const &m2);
Matrix operator-(Matrix const &m1, Matrix const &m2);
Matrix operator-(const double num, Matrix const &m);
Matrix operator~(Matrix const &m);
double sum(Matrix const &m);
Matrix matrixFunction(Matrix const &m, double (*function)(double num));
#endif