-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmatrix.h
58 lines (50 loc) · 1.3 KB
/
matrix.h
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
50
51
52
53
54
55
56
57
58
//
// matrix.h
//
// Created by Furkanicus on 12/04/15.
// Copyright (c) 2015 Furkan. All rights reserved.
// Learnrope.com
#ifndef __EE_242_Project_2__matrix__
#define __EE_242_Project_2__matrix__
#include <stdio.h>
#include <fstream> // for file access
#include <iostream>
#include <stdlib.h>
#include <sstream>
#include <string>
#include <vector>
#include <tuple>
#include <cmath>
using std::vector;
using std::tuple;
class Matrix {
private:
unsigned m_rowSize;
unsigned m_colSize;
vector<vector<double> > m_matrix;
public:
Matrix(unsigned, unsigned, double);
Matrix(const char *);
Matrix(const Matrix &);
~Matrix();
// Matrix Operations
Matrix operator+(Matrix &);
Matrix operator-(Matrix &);
Matrix operator*(Matrix &);
Matrix transpose();
// Scalar Operations
Matrix operator+(double);
Matrix operator-(double);
Matrix operator*(double);
Matrix operator/(double);
// Aesthetic Methods
double& operator()(const unsigned &, const unsigned &);
void print() const;
unsigned getRows() const;
unsigned getCols() const;
// Power Iteration
tuple<Matrix, double, int> powerIter(unsigned, double);
// Deflation
Matrix deflation(Matrix &, double&);
};
#endif /* defined(__EE_242_Project_2__matrix__) */