mirror of
https://gitlab.com/scemama/QCaml.git
synced 2024-12-22 04:13:33 +01:00
Changed integral storage to Float32
This commit is contained in:
parent
b5b6010bbf
commit
f4f31db614
@ -2,8 +2,9 @@ let max_index = 1 lsl 14
|
||||
|
||||
type index_pair = { first : int ; second : int }
|
||||
|
||||
|
||||
type storage_t =
|
||||
| Dense of (float, Bigarray.float64_elt, Bigarray.fortran_layout) Bigarray.Genarray.t
|
||||
| Dense of (float, Bigarray.float32_elt, Bigarray.fortran_layout) Bigarray.Genarray.t
|
||||
| Sparse of (int, float) Hashtbl.t
|
||||
|
||||
type t =
|
||||
@ -81,7 +82,7 @@ let create ~size sparsity =
|
||||
match sparsity with
|
||||
| `Dense ->
|
||||
let result =
|
||||
Bigarray.Genarray.create Float64 Bigarray.fortran_layout [| size ; size ; size ; size |]
|
||||
Bigarray.Genarray.create Float32 Bigarray.fortran_layout [| size ; size ; size ; size |]
|
||||
in
|
||||
Bigarray.Genarray.fill result 0.;
|
||||
Dense result
|
||||
|
25
Utils/FourIdxStorage.mli
Normal file
25
Utils/FourIdxStorage.mli
Normal file
@ -0,0 +1,25 @@
|
||||
(** Storage for four-index data (integrals, density matrices, ...).
|
||||
|
||||
There are two kinds of ordering of indices:
|
||||
|
||||
- Physicist's : { \[ \langle i j | k l \rangle \] }
|
||||
- Chemist's : { \[ ( i j | k l ) \] }
|
||||
|
||||
*)
|
||||
|
||||
type t
|
||||
|
||||
val create : size:int -> [< `Dense | `Sparse ] -> t
|
||||
(** If [`Dense] is chosen, internally the data is stored as a 4-dimensional
|
||||
[Bigarray]. Else, it is stored as a hash table.
|
||||
*)
|
||||
|
||||
(** {2 Accessors} *)
|
||||
val get_chem : t -> int -> int -> int -> int -> float
|
||||
val get_phys : t -> int -> int -> int -> int -> float
|
||||
val set_chem : t -> int -> int -> int -> int -> float -> unit
|
||||
val set_phys : t -> int -> int -> int -> int -> float -> unit
|
||||
|
||||
(** {2 I/O} *)
|
||||
val to_file : ?cutoff:float -> filename:string -> t -> unit
|
||||
(** Write the data to file, using the physicist's ordering. *)
|
Loading…
Reference in New Issue
Block a user