-
Notifications
You must be signed in to change notification settings - Fork 1
/
P7_Matrix Multiplication Strassen.cpp
63 lines (56 loc) · 1.07 KB
/
P7_Matrix Multiplication Strassen.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
#include <bits/stdc++.h>
using namespace std;
int main()
{
//Matrix Multiplication Strassen
ios::sync_with_stdio(false), cin.tie(), cout.tie();
cout << "Coordinates x then y: ";
int x, y;
cin >> x >> y;
cout << "1. Translate\n2. Scale\n";
int choice;
cin >> choice;
/*
* Translation:
* [xNew] [1, 0, Tx] [xOld]
* [yNew] = [0, 1, Ty] * [yOld]
* [1 ] [0, 0, 1 ] [1 ]
*
* (Tx = translated value on x axis)
* (Ty = translated value on y axis)
*
* Deduced Equations:
* xNew = xOld + Tx
* yNew = yOld + Ty
*/
/*
* Sacling:
* [xNew] [a, 0, 0] [xOld]
* [yNew] = [0, b, 0] * [yOld]
* [1 ] [0, 0, 1] [1 ]
*
* (a, b = scaling factor)
*
* Deduced Equations:
* xNew = a * xOld
* yNew = b * yOld
*/
switch (choice)
{
case 1:
int tx, ty;
cout << "transtation value Tx then Ty\n";
cin >> tx >> ty;
cout << "New Coordinate: " << x + tx << ' ' << y + ty << endl;
break;
case 2:
int a, b;
cout << "Scaling value a then b\n";
cin >> a >> b;
cout << "New Coordinate: " << x * a << ' ' << y * b << endl;
break;
default:
break;
}
return 0;
}