mirror of
https://gitlab.com/scemama/QCaml.git
synced 2024-08-30 00:03:42 +02:00
Fixed tests in determinants
This commit is contained in:
parent
796c696a8a
commit
6711bc6b99
@ -44,31 +44,32 @@ let test_case () =
|
|||||||
let det = of_lists l_a l_b in
|
let det = of_lists l_a l_b in
|
||||||
let z_a = alpha det
|
let z_a = alpha det
|
||||||
and z_b = beta det in
|
and z_b = beta det in
|
||||||
Alcotest.(check (list int )) "alpha" (to_list z_a) l_a;
|
Alcotest.(check (list int )) "alpha" (Spindeterminant.to_list z_a) l_a;
|
||||||
Alcotest.(check (list int )) "beta" (to_list z_b) l_b;
|
Alcotest.(check (list int )) "beta" (Spindeterminant.to_list z_b) l_b;
|
||||||
Alcotest.(check bool) "phase" (sgn det = 1.) true;
|
Alcotest.(check bool) "phase" (phase det = Phase.Pos) true;
|
||||||
in
|
in
|
||||||
|
|
||||||
let test_phase () =
|
let test_phase () =
|
||||||
let l_a = [ 1 ; 2 ; 3 ; 64 ; 5 ]
|
let l_a = [ 1 ; 2 ; 3 ; 64 ; 5 ]
|
||||||
and l_b = [ 2 ; 3 ; 5 ; 65 ] in
|
and l_b = [ 2 ; 3 ; 5 ; 65 ] in
|
||||||
let det = of_lists l_a l_b 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 ]
|
let l_a = [ 1 ; 2 ; 3 ; 64 ; 5 ]
|
||||||
and l_b = [ 3 ; 2 ; 5 ; 65 ] in
|
and l_b = [ 3 ; 2 ; 5 ; 65 ] in
|
||||||
let det = of_lists l_a l_b 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 ]
|
let l_a = [ 1 ; 3 ; 2 ; 64 ; 5 ]
|
||||||
and l_b = [ 3 ; 2 ; 5 ; 65 ] in
|
and l_b = [ 3 ; 2 ; 5 ; 65 ] in
|
||||||
let det = of_lists l_a l_b 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 ]
|
let l_a = [ 1 ; 3 ; 2 ; 64 ; 5 ]
|
||||||
and l_b = [ 3 ; 2 ; 65 ; 5 ] in
|
and l_b = [ 3 ; 2 ; 65 ; 5 ] in
|
||||||
let det = of_lists l_a l_b 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
|
in
|
||||||
[
|
[
|
||||||
"Creation", `Quick, test_creation;
|
"Creation", `Quick, test_creation;
|
||||||
"Phase" , `Quick, test_phase;
|
"Phase", `Quick, test_phase;
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,12 +10,12 @@ type t
|
|||||||
|
|
||||||
val phase : t -> Phase.t
|
val phase : t -> Phase.t
|
||||||
(** Phase factor.
|
(** 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
|
val bitstring : t -> Z.t
|
||||||
(** Bit string.
|
(** 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
|
val is_none : t -> bool
|
||||||
|
Loading…
Reference in New Issue
Block a user