(* %use "Matrix/mat_mult_iprod.fsh" ;; *) %use "BMF/map1.fsh" ;; %use "Datum/float.fsh";; let rows x = lendim #x ;; let cols x = lendim (preddim #x) ;; let mat_mult_iprod_pr (z:var [a]) (x:var[a]) (y:var [a]) = for i < rows x do for j < cols y do z[i,j] := inner_product_float sub(x,i) (map1 (fun u -> sub(u,j)) y) done done ;; let mat_mult_iprod_sh x y = check (numdim x = 2) check (numdim y = 2) check (lendim (preddim x) = lendim y) (succdim (lendim x) (succdim (lendim (preddim y)) (zerodim float_shape))) ;; let mat_mult_iprod = proc2fun2 mat_mult_iprod_pr mat_mult_iprod_sh ;; (* let mat1 = map (fun x -> int2float x) (fill {2,3:int_shape} with [1,2,3,4,5,6]);; let mat2 = map (fun x -> int2float x) (fill {3,2:int_shape} with [1,2,3,4,5,6]);; let mat3 = mat_mult_iprod mat1 mat2;; *)