10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-11-07 06:33:39 +01:00
QCaml/linear_algebra/lib/four_idx_storage.mli

81 lines
2.6 KiB
OCaml
Raw Normal View History

2018-03-27 19:32:37 +02:00
(** Storage for four-index data (integrals, density matrices, ...).
There are two kinds of ordering of indices:
2018-03-28 01:50:19 +02:00
- Physicist's : {% $\langle i j | k l \rangle$ %}
- Chemist's : {% $(ij|kl)$ %}
2018-03-27 19:32:37 +02:00
*)
2020-10-02 18:55:19 +02:00
type 'a t
2018-03-27 19:32:37 +02:00
2020-09-26 12:02:53 +02:00
(** Element for the stream *)
type element =
2018-06-28 14:43:24 +02:00
{
i_r1: int ;
j_r2: int ;
k_r1: int ;
l_r2: int ;
value: float
}
2020-10-02 18:55:19 +02:00
val create : size:int -> [< `Dense | `Sparse ] -> 'a t
2018-03-27 19:32:37 +02:00
(** If [`Dense] is chosen, internally the data is stored as a 4-dimensional
[Bigarray]. Else, it is stored as a hash table.
*)
(** {2 Accessors} *)
2020-05-05 00:29:00 +02:00
2020-10-02 18:55:19 +02:00
val size : 'a t -> int
2020-09-26 12:02:53 +02:00
(** Number of stored elements *)
2020-10-02 18:55:19 +02:00
val get_chem : 'a t -> int -> int -> int -> int -> float
2018-06-29 16:04:40 +02:00
(** Get an integral using the Chemist's convention {% $(ij|kl)$ %}. *)
2020-10-02 18:55:19 +02:00
val get_phys : 'a t -> int -> int -> int -> int -> float
2018-06-29 16:04:40 +02:00
(** Get an integral using the Physicist's convention {% $\langle ij|kl \rangle$ %}. *)
2020-10-02 18:55:19 +02:00
val set_chem : 'a t -> int -> int -> int -> int -> float -> unit
2018-06-29 16:04:40 +02:00
(** Set an integral using the Chemist's convention {% $(ij|kl)$ %}. *)
2020-10-02 18:55:19 +02:00
val set_phys : 'a t -> int -> int -> int -> int -> float -> unit
2018-06-29 16:04:40 +02:00
(** Set an integral using the Physicist's convention {% $\langle ij|kl \rangle$ %}. *)
2018-03-27 19:32:37 +02:00
2020-10-02 18:55:19 +02:00
val increment_chem : 'a t -> int -> int -> int -> int -> float -> unit
2019-10-03 16:58:15 +02:00
(** Increments an integral using the Chemist's convention {% $(ij|kl)$ %}. *)
2020-10-02 18:55:19 +02:00
val increment_phys : 'a t -> int -> int -> int -> int -> float -> unit
2019-10-03 16:58:15 +02:00
(** Increments an integral using the Physicist's convention {% $\langle ij|kl \rangle$ %}. *)
2020-10-02 18:55:19 +02:00
val get_chem_all_i : 'a t -> j:int -> k:int -> l:int -> 'a Vector.t
2019-04-05 16:54:38 +02:00
(** Get all integrals in an array [a.{i} =] {% $(\cdot j|kl)$ %} . *)
2018-07-20 16:09:06 +02:00
2020-10-02 18:55:19 +02:00
val get_phys_all_i : 'a t -> j:int -> k:int -> l:int -> 'a Vector.t
2019-04-05 16:54:38 +02:00
(** Get all integrals in an array [a.{i} =] {% $\langle \cdot j|kl \rangle$ %} . *)
2018-07-20 16:09:06 +02:00
2020-10-02 18:55:19 +02:00
val get_chem_all_ij : 'a t -> k:int -> l:int -> ('a,'a) Matrix.t
2019-04-05 16:54:38 +02:00
(** Get all integrals in an array [a.{i,j} =] {% $(\cdot \cdot|kl)$ %} . *)
2018-07-20 16:09:06 +02:00
2020-10-02 18:55:19 +02:00
val get_phys_all_ij : 'a t -> k:int -> l:int -> ('a,'a) Matrix.t
2019-04-05 16:54:38 +02:00
(** Get all integrals in an array [a.{i,j} =] {% $\langle \cdot \cdot|kl \rangle$ %} . *)
2018-07-20 16:09:06 +02:00
2020-10-02 18:55:19 +02:00
val to_stream : 'a t -> element Stream.t
2018-07-05 00:39:17 +02:00
(** Retrun the data structure as a stream. *)
2020-10-02 18:55:19 +02:00
val to_list : 'a t -> element list
2018-07-05 00:39:17 +02:00
(** Retrun the data structure as a list. *)
2018-06-29 16:04:40 +02:00
2020-10-02 18:55:19 +02:00
val four_index_transform : ('a,'b) Matrix.t -> 'a t -> 'b t
2019-03-21 00:44:10 +01:00
(** Perform a four-index transformation *)
2018-06-28 14:43:24 +02:00
2018-03-27 19:32:37 +02:00
(** {2 I/O} *)
2018-06-29 16:04:40 +02:00
2020-10-02 18:55:19 +02:00
val to_file : ?cutoff:float -> filename:string -> 'a t -> unit
2018-03-27 19:32:37 +02:00
(** Write the data to file, using the physicist's ordering. *)
2018-07-05 00:39:17 +02:00
val of_file : size:int -> sparsity:[< `Dense | `Sparse ]
2020-10-02 18:55:19 +02:00
-> Scanf.Scanning.file_name -> 'a t
2018-07-05 00:39:17 +02:00
(** Read from a text file with format ["%d %d %d %d %f"]. *)
2020-10-07 17:54:15 +02:00
val relabel : 'a t -> 'b t