Page
Library
Module
Module type
Parameter
Class
Class type
Source
Gg.BaSourceLinear bigarrays and bigarray buffers.
WARNING. This interface is subject to change in the future.
This module has a few convenience functions for linear (1D) bigarrays.
The purpose of buffer is to allow to specify a few more data types than bigarrays are able to express and facilitate the generic handling of linear bigarrays.
type ('a, 'b) ba_scalar_type = | Int8 : (int, Bigarray.int8_signed_elt) ba_scalar_type| Int16 : (int, Bigarray.int16_signed_elt) ba_scalar_type| Int32 : (int32, Bigarray.int32_elt) ba_scalar_type| Int64 : (int64, Bigarray.int64_elt) ba_scalar_type| UInt8 : (int, Bigarray.int8_unsigned_elt) ba_scalar_type| UInt16 : (int, Bigarray.int16_unsigned_elt) ba_scalar_type| UInt32 : (int32, Bigarray.int32_elt) ba_scalar_type| UInt64 : (int64, Bigarray.int64_elt) ba_scalar_type| Float16 : (int, Bigarray.int16_unsigned_elt) ba_scalar_type| Float32 : (float, Bigarray.float32_elt) ba_scalar_type| Float64 : (float, Bigarray.float64_elt) ba_scalar_typeThe type for bigarray scalar types.
ba_kind_of_ba_scalar_type st is the bigarray kind corresponding to st.
The type for buffer scalar types.
scalar_type_of_ba_scalar_type st is the scalar type corresponding to st.
scalar_type_byte_count st is the number of bytes used by a scalar of type st.
pp_scalar_type ppf st prints a textual representation of st on ppf.
create k count is a bigarray of kind k with count scalars.
sub ba i len are the ith to ith + n scalars of ba as a bigarray. Note, this is not a copy.
blit src si dst di len copies len scalar values starting at si in src to dst starting at di.
of_array st a is a bigarray from array a.
of_list st l is a bigarray from list l.
of_bytes be s k is a bigarray of kind k from s. if be is true data is assumed to be in big endian order (defaults to false).
TODO For now only Int8 and UInt8 are supported.
Raises Invalid_argument if given an unsupported kind or if the data length is not a multiple of the requested scalar type.
val pp :
?count:int ->
?stride:int ->
?first:int ->
?dim:int ->
pp_scalar:(Format.formatter -> 'a -> unit) ->
Format.formatter ->
('a, 'b) bigarray ->
unitpp count stride first dim pp_scalar ppf b prints on ppf, count groups of size dim of scalars of b, starting at first using pp_scalar, and striding stride scalars to go from group to group. If count is unspecified prints as much as possible. stride defaults to dim, first defaults to 0 and dim to 1.
get_v2 b i is the ith to i+1th scalars of b as a vector.
get_v3 b i is the ith to i+2th scalars of b as a vector.
get_v4 b i is the ith to i+3th scalars of b as a vector.
get_v3 b i is the ith to i+2th scalars of b.
get_v4 b i is the ith to i+3th scalars of b.
get_v2 b i is the ith to i+1th scalars of b. The integers are converted with Int32.to_int.
get_v3 b i is the ith to i+2th scalars of b. The integers are converted with Int32.to_int
set_v2 b i v sets the ith to i+1th scalars of b with v.
set_v3 b i v sets the ith to i+2th scalars of b with v.
set_v4 b i v sets the ith to i+3th scalars of b with v.
set_2d b i s1 s2 sets the ith to i+1th scalar of b to s1, s2.
set_3d b i s1 s2 s3 sets the ith to i+2th scalar of b to s1, s2, s3.
set_4d b i s1 s2 s3 s4 sets the ith to i+3th scalar of b to s1, s2, s3, s4.
set_2d b i s1 s2 sets the ith to i+1th scalar of b to s1, s2.