2
votes

I have 2 matrices of dimension 1*280000.

I wanted to multiply one matrix with transposed second matrix using opencv.

I tried to multiply them using Multiplication operator(*).

But it is giving me error :'The total size matrix does not fit to size_t type'

As after multiplication the size will be 280000*28000 of matrix.

So,I am thinking multiplication should 32 bit.

Is there any method to do the 32bit multiplication?

1
That matrix would have 78,400,000,000 elements. Assuming it has 32bit elements, that'd take 313,6 GB of RAM. Is that really what you want ?tux3
Do you have sparse matrices?Micka
If you have general matrices you might need some kind of "big matrix linear algebra" library (not sure uf one exists). But you will probably need a lot of processing time to work with such matrices.Micka
Actually,I am working on Sparse Representation classifier.In that training images has to be stored as a vector and then using optimization technique classification is done.So, that's why vector size is so large.Gunjan naik

1 Answers

1
votes

Why do you want to multiply them like that? But because this is an answer, I would like to help you thinking more than just do it:

  • supposing that you have the two matrix: A and B (A.size() == B.size() == [1x280000]).
  • and A * B.t() = AB (AB is the result)
  • then AB = [A[0][0]*B A[0][1]*B ... A[0][279999]*B] (each column is the transposed matrix multiplied by the corresponding element of the other matrix)

AB may also be written as:

[ B[0][0]*A
  B[0][1]*A
  ...
  B[0][279999]*A]

(each row of the result will be the row matrix multiplied by the corresponding element of the column (transposed) matrix)

Hope that this will help you in what you are doing... Using a for loop you can print, or store, or what you need with the result