yujikawa / numexy

numexy is a library like Python's numpy. It is a library for matrix calculation.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multiplication of matrices of different dimensions fails.

ashneyderman opened this issue · comments

I would expect this to work:

iex(5)> Numexy.mul(Numexy.new([[1,1], [1,1], [1,1], [1,1]]), Numexy.new([[1,1], [1,1]]))
** (ArithmeticError) bad argument in arithmetic expression: 1 * %Numexy.Array{array: [[1, 1], [1, 1]], shape: {2, 2}}
    :erlang.*(1, %Numexy.Array{array: [[1, 1], [1, 1]], shape: {2, 2}})
    (numexy) lib/numexy.ex:164: anonymous fn/2 in Numexy.mul/2
    (elixir) lib/enum.ex:1327: Enum."-map/2-lists^map/1-0-"/2
    (elixir) lib/enum.ex:1327: Enum."-map/2-lists^map/1-0-"/2
    (numexy) lib/numexy.ex:164: Numexy.mul/2

since

[1 1]
[1 1]   [1 1]
[1 1] * [1 1] 
[1 1]    

is a valid matrix operation. I.e. result should be a matrix of 4 rows and two columns.