package slap
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=93a320eefbb8a8d06c08804aea49df944fcbbe5142f58e9c38b66f4d8bc46c5d
md5=a982b3ef7e0a137d8f583a30065d8443
doc/slap.ppx/Slap_ppx/index.html
Module Slap_ppx
PPX syntactic extensions for SLAP. (This is a dummy module.)
For use of the extensions, you need to pass -ppx ppx_slap to the OCaml compiler, or specify -package slap.ppx to OCamlfind. You can also use by
#use "topfind";;
#require "slap.ppx";;on interactive mode.
Literals
Vector literals
Vector literals like [%vec.kind [e1; e2; ...; eN]] are supported where e1 ... eN are elements and kind specifies the type and precision of the elements. It corresponds to Bigarray kind:
float32,Sors: 32-bit real number (Bigarray.float32)float64,Dord: 64-bit real number (Bigarray.float64)complex32,Corc: 32-bit complex number (Bigarray.complex32)complex64,Zorz: 64-bit complex number (Bigarray.complex64)int8_signedorsint8: 8-bit signed integer (Bigarray.int8_signed)int8_unsignedoruint8: 8-bit unsigned integer (Bigarray.int8_unsigned)int16_signedorsint16: 16-bit signed integer (Bigarray.int16_signed)int16_unsignedoruint16: 16-bit unsigned integer (Bigarray.int16_unsigned)int: 31-bit integer (Bigarray.int)int32: 32-bit integer (Bigarray.int32)int64: 64-bit integer (Bigarray.int64)nativeint: native integer (Bigarray.nativeint)char: character (Bigarray.char)
You can omit a kind if you open Slap.[SDCZ]:
[%vec [...]](referringSlap.[SDCZ].precasBigarraykind, corresponding to an opened module)[%rvec [...]](referringSlap.[SDCZ].rprecasBigarraykind, corresponding to an opened module)
For examples, [%vec.float64 [42.0; 123.0; 456.0]] is a three-dimensional vector that has 64-bit real numbers 42.0, 123.0 and 456.0. If you open Slap.D, the vector literal is the same as [%vec [42.0; 123.0; 456.0]].
Matrix literals
Matrix literals can be written as
[%mat.kind [ [e11; e12; ...; e1N];
[e21; e22; ...; e2N];
[...; ...; ...; ...];
[eM1; eM2; ...; eMN] ]]or
[%mat.kind [ e11, e12, ..., e1N;
e21, e22, ..., e2N;
..., ..., ..., ...;
eM1, eM2, ..., eMN ]]where kind is one of the above-mentioned identifiers. You can also use [%mat ...] and [%rmat ...] (referring Slap.[SDCZ].prec and Slap.[SDCZ].rprec respectively) as similar to vector literals.