2d-matmul ( vec1: float-array vec2: float-array res: float-array m: fixnum n: fixnum p: fixnum -- )


Vocabulary
tensors.private

Inputs
vec1a float-array
vec2a float-array
resa float-array
ma fixnum
na fixnum
pa fixnum


Outputs
None

Definition


TYPED:: 2d-matmul
( vec1: float-array vec2: float-array res: float-array m: fixnum n: fixnum p: fixnum -- )
{ n p } vec2 <tensor> 2d-transpose vec>> :> vec2 m [
:> i i n * :> in i p * :> ip vec1 in n make-subseq p [
:> j dup vec2 j n * n make-subseq 0.0
[ * + ] 2reduce ip j + res set-nth-unsafe
] each-integer drop
] each-integer ;