10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-11-19 04:22:21 +01:00

Double excitation operators

This commit is contained in:
Anthony Scemama 2019-02-16 11:05:38 +01:00
parent 1c5cca608f
commit add68968b6

View File

@ -63,8 +63,16 @@ let annihilation h = function
let single_excitation_reference h p spindet = let single_excitation_reference h p spindet =
creation p @@ annihilation h @@ spindet creation p @@ annihilation h @@ spindet
let single_excitation p q = let single_excitation h p =
single_excitation_reference p q single_excitation_reference h p
let double_excitation_reference h' p' h p spindet =
creation p' @@ creation p @@ annihilation h @@ annihilation h' @@ spindet
let double_excitation h' p' h p =
double_excitation_reference h' p' h p
let of_list l = let of_list l =
List.rev l List.rev l
@ -162,8 +170,17 @@ let test_case () =
let det = of_list l_a in let det = of_list l_a in
let l_b = [ 1 ; 7 ; 3 ; 5 ] in let l_b = [ 1 ; 7 ; 3 ; 5 ] in
let det2 = of_list l_b in let det2 = of_list l_b in
Alcotest.(check bool) "single 1" true (single_excitation 2 7 det = det2); Alcotest.(check bool) "single 1" true (single_excitation_reference 2 7 det = det2);
Alcotest.(check bool) "single 1" true (single_excitation 4 7 det |> is_none); Alcotest.(check bool) "single 2" true (single_excitation 2 7 det = single_excitation_reference 2 7 det);
Alcotest.(check bool) "single 3" true (single_excitation_reference 4 7 det |> is_none);
Alcotest.(check bool) "single 4" true (single_excitation 4 7 det |> is_none);
let l_c = [ 1 ; 7 ; 6 ; 5 ] in
let det3 = of_list l_c in
Alcotest.(check bool) "double 1" true (double_excitation_reference 2 7 3 6 det = det3);
Alcotest.(check bool) "double 2" true (double_excitation 2 7 3 6 det = double_excitation_reference 2 7 3 6 det);
Alcotest.(check bool) "double 3" true (double_excitation_reference 4 7 3 6 det |> is_none);
Alcotest.(check bool) "double 4" true (double_excitation 4 7 3 6 det |> is_none);
in in
[ [
"Creation", `Quick, test_creation; "Creation", `Quick, test_creation;