(* Generalized Cross Product *) exception Ragged let cross a = let n = Array.length a in (for i = 0 to n-1 do if Array.length a.(i) <> n+1 then raise Ragged done; let x = Matrix.trans a in let d = Array.init n (fun j -> x.(j+1)) and b = Array.make (n+1) 0. and s = ref 1. in for i = 0 to n do b.(i) <- !s *. Matrix.determ d; if i [|0.; 0.; -1.|] cross [|[|1.; 0.; 0.|]; [|0.; 1.; 0.|]|];; => [|0.; 0.; +1.|] cross [|[|0.; 1.; 0.|]; [|0.; 0.; 1.|]|];; => [|1.; 0.; -0.|] cross [|[|0.; 2.; 0.; 0.|]; [|0.; 0.; 0.; 3.|]; [|4.; 0.; 0.; 0.|]|];; => [|-0.; 0.; 24.; -0.|] cross [|[|0.; 0.; 2.; 0.|]; [|3.; 0.; 0.; 0.|]; [|0.; 4.; 0.; 0.|]|];; => [|-0.; -0.; 0.; -24.|] *)