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


Vocabulary
tensors.private

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


Outputs
None

Definition


TYPED:: 2d-matmul-mixed
( vec1: float-array vec2: float-array res: float-array m: fixnum n: fixnum p: fixnum start: fixnum -- )
{ n p } vec2 <tensor> 2d-transpose vec>> :> vec2 start m n *
* :> start1 start n p * * :> start2 m [
:> i i n * :> in 4 4 in start1 + 4 mod - swap mod
:> in4m i p * :> ip vec1 in n make-subseq
:> sub1 sub1 in4m <simd-slice> :> slice1 p [
:> j j n * :> jn 4 4 jn 4 mod - swap mod
:> jn4m vec2 jn n make-subseq in4m jn4m = [
jn4m <simd-slice> slice1 swap 2dup
[ first-slice>> ] bi@ 0.0 [ * + ] 2reduce
[ 2dup [ simd-slice>> ] bi@ ] dip
[ vdot + ] 2reduce [ [ end-slice>> ] bi@ ] dip
[ * + ] 2reduce
] [ sub1 swap 0.0 [ * + ] 2reduce ] if ip j +
res set-nth-unsafe
] each-integer
] each-integer ;