-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
90 lines (77 loc) · 1.9 KB
/
main.cpp
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/**
* run all tests
*/
#ifndef ADDROWVECTORS_H
#include "tests/addRowVectors.hpp"
#endif
#ifndef ADDCOLUMNVECTORS_H
#include "tests/addColumnVectors.hpp"
#endif
#ifndef ADDMATRICES_H
#include "tests/addMatrices.hpp"
#endif
#ifndef SCALARMULROWVECTOR_H
#include "tests/scalarMulRowVector.hpp"
#endif
#ifndef SCALARMULCOLUMNVECTOR_H
#include "tests/scalarMulColumnVector.hpp"
#endif
#ifndef SCALARMULMATRIX_H
#include "tests/scalarMulMatrix.hpp"
#endif
#ifndef MULROWCOLUMNVECTORS_H
#include "tests/mulRowColumnVectors.hpp"
#endif
#ifndef MULCOLUMNROWVECTORS_H
#include "tests/mulColumnRowVectors.hpp"
#endif
#ifndef MULROWVECTORMATRIX_H
#include "tests/mulRowVectorMatrix.hpp"
#endif
#ifndef MULMATRIXCOLUMNVECTOR_H
#include "tests/mulMatrixColumnVector.hpp"
#endif
#ifndef MULMATRICES_H
#include "tests/mulMatrices.hpp"
#endif
int main()
{
try
{
addRowVectors();
addColumnVectors();
addMatrices();
scalarMulRowVector();
scalarMulColumnVector();
scalarMulMatrix();
mulRowColumnVectors();
mulColumnRowVectors();
mulRowVectorMatrix();
mulMatrixColumnVector();
mulMatrices();
}
catch (IncompatibleDims& error)
{
std::cerr << "Error: Check dimensions of operands.\n";
}
catch (IndexOutOfRange& error)
{
std::cerr << "Error: Check index.\n";
}
catch (Overflow& error)
{
std::cerr << "Error: Result of computation is greater than maximum value that can be stored.\n";
}
catch (Underflow& error)
{
std::cerr << "Error: Result of computation is smaller than minimum value that can be stored.\n";
}
catch (DivisionByZero& error)
{
std::cerr << "Error: Division by zero produces undefined value.\n";
}
catch (InvalidMode& error)
{
std::cerr << "Error: Name of mode must be one of the following: add, sub, mul, or div.\n";
}
}