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

58 lines
1.1 KiB
OCaml
Raw Normal View History

2018-02-25 00:53:09 +01:00
(** Contains powers of x, y and z describing the polynomials in atomic basis sets. *)
type t = private {
x : int ;
y : int ;
z : int ;
tot : int ; (* x + y + z *)
}
2018-02-19 11:24:15 +01:00
val of_int_tuple : int * int * int -> t
2018-02-25 00:53:09 +01:00
(** Example:
[of_int_tuple (2,3,1) -> { x=2 ; y=3 ; z=1 ; tot=6 }]
@raise Invalid_argument if x, y or z < 0.
*)
2018-02-19 11:24:15 +01:00
val to_int_tuple : t -> int * int * int
2018-02-25 00:53:09 +01:00
(** Example:
[to_int_tuple { x=2 ; y=3 ; z=1 ; tot=6 } -> (2,3,1) ]
*)
2018-02-19 11:24:15 +01:00
val get : Coordinate.axis -> t -> int
2018-02-25 00:53:09 +01:00
(** Example:
[Powers.get Coordinate.Y { x=2 ; y=3 ; z=1 ; tot=6 } -> 3]
*)
2018-02-19 16:01:13 +01:00
val incr : Coordinate.axis -> t -> t
2018-02-25 00:53:09 +01:00
(** Returns a new {!Powers.t} with the power on the given axis incremented.
Example:
{[
Powers.incr Coordinate.Y { x=2 ; y=3 ; z=1 ; tot=6 } ->
{ x=2 ; y=4 ; z=1 ; tot=7 }
]}
*)
2018-02-19 11:24:15 +01:00
val decr : Coordinate.axis -> t -> t
2018-02-25 00:53:09 +01:00
(** Returns a new {!Powers.t} with the power on the given axis decremented.
As opposed to {!of_int_tuple}, the values may become negative.
Example:
{[
Powers.incr Coordinate.Y { x=2 ; y=3 ; z=1 ; tot=6 } ->
{ x=2 ; y=2 ; z=1 ; tot=5 }
]}
*)
2018-02-19 11:24:15 +01:00