Bug in matrix multiplication (SPT-1114)

[Old posts from the commercial version of ArrayFire] Discussion of ArrayFire using CUDA or OpenCL.

Moderator: pavanky

Bug in matrix multiplication (SPT-1114)

Postby jabhiji » Fri Sep 27, 2013 2:26 pm

An ArrayFire user came across the following issue while using matrix multiplication:

Code: Select all
array A = randu(70000, 8);
array AtA = matmul(A, A, B_transpose);

I received an error stating that the inner dimensions must match. Since I am taking a transpose of one of the matrices, the dimensions will match. The routine seems to be error checking before applying the matopts.

This was indeed a bug that has been fixed. Thanks for bringing this to our attention.

However, note that if we want to implement the product of A-transpose with A, the correct syntax is:
Code: Select all
array AtA = matmul(A, A, A_transpose);

Another (not-so-fast) alternative is to use the transpose function:
Code: Select all
array AtA = matmul(A.T(), A);
Abhijit Joshi (abhijit@accelereyes.com)
ArrayFire Developer
User avatar
Posts: 6
Joined: Fri Apr 12, 2013 3:36 pm

Return to [archive-commercial] Programming & Development with ArrayFire