Inner Product Implementation in C++

Dear all,

Is there such existing implementation?

Suppose I have three matrices

MATRIX 'X'
 
[1] 1 2 3 4


MATRIX 'Y'

1
2
3
4
5
     [,1] [,2] [,3] [,4]
[1,]    1    0    0    0
[2,]    0    2    0    0
[3,]    0    0    3    0
[4,]    0    0    0    4


MATRIX "Z"

1
2
3
4
5
     [,1] [,2] [,3]
[1,]    1    5    9
[2,]    2    6   10
[3,]    3    7   11
[4,]    4    8   12


Let's call the inner product as 'ip'.
The result of above multiplication would be:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
> y ip z
     [,1] [,2] [,3]
[1,]    1    5    9
[2,]    4   12   20
[3,]    9   21   33
[4,]   16   32   48

y ip x
     [,1]
[1,]    1
[2,]    4
[3,]    9
[4,]   16


x ip z
     [,1] [,2] [,3]
[1,]   30   70  110


The problem is that I can't hold the matrices in memory.
Only can process them line by line.

Is there such implementation exists?
Topic archived. No new replies allowed.