10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-12-22 04:13:33 +01:00

Fixed tests in determinants

This commit is contained in:
Anthony Scemama 2019-02-16 10:09:42 +01:00
parent 796c696a8a
commit 6711bc6b99
2 changed files with 11 additions and 10 deletions

View File

@ -44,31 +44,32 @@ let test_case () =
let det = of_lists l_a l_b in
let z_a = alpha det
and z_b = beta det in
Alcotest.(check (list int )) "alpha" (to_list z_a) l_a;
Alcotest.(check (list int )) "beta" (to_list z_b) l_b;
Alcotest.(check bool) "phase" (sgn det = 1.) true;
Alcotest.(check (list int )) "alpha" (Spindeterminant.to_list z_a) l_a;
Alcotest.(check (list int )) "beta" (Spindeterminant.to_list z_b) l_b;
Alcotest.(check bool) "phase" (phase det = Phase.Pos) true;
in
let test_phase () =
let l_a = [ 1 ; 2 ; 3 ; 64 ; 5 ]
and l_b = [ 2 ; 3 ; 5 ; 65 ] in
let det = of_lists l_a l_b in
Alcotest.(check bool) "phase" (sgn det = -1.) true;
Alcotest.(check bool) "phase" (phase det = Phase.Neg) true;
let l_a = [ 1 ; 2 ; 3 ; 64 ; 5 ]
and l_b = [ 3 ; 2 ; 5 ; 65 ] in
let det = of_lists l_a l_b in
Alcotest.(check bool) "phase" (sgn det = 1.) true;
Alcotest.(check bool) "phase" (phase det = Phase.Pos) true;
let l_a = [ 1 ; 3 ; 2 ; 64 ; 5 ]
and l_b = [ 3 ; 2 ; 5 ; 65 ] in
let det = of_lists l_a l_b in
Alcotest.(check bool) "phase" (sgn det = -1.) true;
Alcotest.(check bool) "phase" (phase det = Phase.Neg) true;
let l_a = [ 1 ; 3 ; 2 ; 64 ; 5 ]
and l_b = [ 3 ; 2 ; 65 ; 5 ] in
let det = of_lists l_a l_b in
Alcotest.(check bool) "phase" (sgn det = 1.) true;
Alcotest.(check bool) "phase" (phase det = Phase.Pos) true;
in
[
"Creation", `Quick, test_creation;
"Phase" , `Quick, test_phase;
"Phase", `Quick, test_phase;
]

View File

@ -10,12 +10,12 @@ type t
val phase : t -> Phase.t
(** Phase factor.
@raise [Invalid_argument] if the spin-determinant is [None].
@raise Invalid_argument if the spin-determinant is [None].
*)
val bitstring : t -> Z.t
(** Bit string.
@raise [Invalid_argument] if the spin-determinant is [None].
@raise Invalid_argument if the spin-determinant is [None].
*)
val is_none : t -> bool