2D array vector(matricies) multiplication?

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
91
92
#include <iostream>
#include <vector>

using namespace std;

void DisplayMatrix(vector <vector<double> > x)
{
    for(int row = 0; row < x.size(); row++)
    {
        for(int col = 0; col < x[row].size(); col++)
        {
                cout << x[row][col] << " ";
        }
        cout << endl;
    }
    cout << endl;
}

void MultiplyingMatrix(vector <vector<double> > x1, vector <vector<double> > x2)
{
    for(int row = 0; row1 < x1.size();)

    double [][]answer = double []

}


int main()
{
////////////////////////// MatrixA
vector <vector<double> > MatrixA; // 2x3 matrix

vector <double> rowA;
for(int i=0; i<3; i++)
rowA.push_back(0.0);

for(int i=0; i<2;i++)
MatrixA.push_back(rowA);

MatrixA[0][0] = 1;
MatrixA[0][1] = 2;
MatrixA[0][2] = 3;

MatrixA[1][0] = 4;
MatrixA[1][1] = 5;
MatrixA[1][2] = 6;


/////////////////////////// MatrixB
vector <vector<double> > MatrixB; 3x4 matrix
vector <double> rowB;

for(int i=0; i<4; i++)
rowB.push_back(0.0);

for(int i=0; i<3;i++)
MatrixB.push_back(rowB);

MatrixB[0][0] = 1;
MatrixB[0][1] = 2;
MatrixB[0][2] = 3;
MatrixB[0][3] = 4;

MatrixB[1][0] = 5;
MatrixB[1][1] = 6;
MatrixB[1][2] = 7;
MatrixB[1][3] = 8;

MatrixB[2][0] = 9;
MatrixB[2][1] = 10;
MatrixB[2][2] = 11;
MatrixB[2][3] = 12;

///////////////////////////// MatrixC
vector <vector<double> > MatrixC; 2x4

vector <double> rowC;

for(int i=0; i<4; i++)
rowC.push_back(0.0);
for(int i=0; i<2;i++)
MatrixC.push_back(rowC);


DisplayMatrix(MatrixA);
DisplayMatrix(MatrixB);

MultiplyingMatrix(MatrixA);
MultiplyingMatrix(MatrixB);

return 0;
}


I created a function for multiplying MatrixA and MatrixB but I don't know how to multiply things together..(it's confusing the hell out of me :/) Anyone help?
Topic archived. No new replies allowed.