File: linalg.ml

package info (click to toggle)
ocamlgsl 0.3.5-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,444 kB
  • ctags: 2,901
  • sloc: ml: 7,956; ansic: 6,796; makefile: 303; sh: 87; awk: 13
file content (18 lines) | stat: -rw-r--r-- 392 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

let mA = [|
  0.18; 0.60; 0.57; 0.96; 
  0.41; 0.24; 0.99; 0.58; 
  0.14; 0.30; 0.97; 0.66; 
  0.51; 0.13; 0.19; 0.85; |]

let vB = [| 1.0; 2.0; 3.0; 4.0; |]

let test () =
  let x = Gsl_linalg.solve_LU ~protect:true
      (`A (mA, 4, 4)) (`A vB) in
  Printf.printf "x = \n" ;
  Array.iter (fun v -> Printf.printf " %g\n" v) x 

let _ = 
  Gsl_error.init () ;
  Gsl_error.handle_exn test ()