-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmatrixOps.h
More file actions
70 lines (60 loc) · 1.92 KB
/
Copy pathmatrixOps.h
File metadata and controls
70 lines (60 loc) · 1.92 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef MATRIXOPS_H
#define MATRIXOPS_H
#include <iostream>
#include <vector>
#include <utility>
/**
* Determines if a value lies on an closed interval
* @param x value to be evaluated
* @param lo lower bound of the closed interval, inclusive
* @param hi upper bound of the closed interval, inclusive
* @return true if x on the interval, else false
*/
bool between(double lo, double hi, double x);
/**
* Prints a matrix to the console
* @param A matrix to be displayed
* @return Nothing
*/
void displayMat(std::vector<std::vector<double>> A);
/**
* Prints the first 5 rows and 10 columns of a matrix to the console
* for preview
* @param A matrix to be displayed
* @return Nothing
*/
void headMat(std::vector<std::vector<double>> A);
/**
* Prints the size of a matrix to the console as (rows x cols)
* @param A matrix to be displayed
* @return Nothing
*/
void displaySize(std::vector<std::vector<double>> A);
/**
* Returns the size of a matrix to the calling program as {rows, cols}
* @param A matrix from which to get the size
* @return vector containing the rows and cols of A
*/
std::vector<int> getSize(std::vector<std::vector<double>> A);
/**
* Performs matrix multiplication on A and B
* @param A m x n LHS matrix
* @param B n x p RHS matrix
* @return m x p matrix product
*/
std::vector<std::vector<double>> multiply(std::vector<std::vector<double>> A, std::vector<std::vector<double>> B);
/**
* Performs matrix tranpose on A
* @param A m x n matrix
* @return n x m matrix tranpose of A
*/
std::vector<std::vector<double>> transpose(std::vector<std::vector<double>> A);
/**
* Creates a submatrix of A
* @param A m x n matrix
* @param rows vector containing first and last+1 row index of A for submatrix
* @param cols vector containing first and last+1 col index of A for submatrix
* @return p x q submatrix of A
*/
std::vector<std::vector<double>> submatrix(std::vector<std::vector<double>> A, std::vector<int> rows, std::vector<int> cols);
#endif