jingyuzhu / efficient-java-matrix-library

Automatically exported from code.google.com/p/efficient-java-matrix-library
0 stars 0 forks source link

Add support for matrices with zero dimensions #34

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
It would be nice if EJML were able to handle matrices with zero dimensions.

Example:
A is 6 x 0
B = 0 x 6

A * B should result in a matrix of dimension 6 x 6 containing all zeros
B * A should result in a matrix of dimension 0 x 0

Matlab is able to handle this kind of thing:
>> A = zeros(6, 0);
>> B = zeros(0, 6);
>> A * B
ans =
     0     0     0     0     0     0
     0     0     0     0     0     0
     0     0     0     0     0     0
     0     0     0     0     0     0
     0     0     0     0     0     0
     0     0     0     0     0     0

>> B * A
ans =
     []

>> size(B * A)

ans =
     0     0

This saves a lot of if statements when sizes of matrices happen to be zero.

Original issue reported on code.google.com by Koolen.T...@gmail.com on 29 Apr 2013 at 8:01

GoogleCodeExporter commented 8 years ago
done.  See commit d5950a3ebb075b0e07086ef6b46487cdf4ecfa98

Original comment by peter.ab...@gmail.com on 9 Sep 2014 at 7:45