package octez-bls12-381-polynomial

  1. Overview
  2. Docs

Module Carray.MakeSource

Note that an unsafe type casting is performed by this module. USE WITH CARE! The type of get and set changes with whatever Elt.t is given as input. This works because Elt also indicates the size in bytes which would be read/written and because Elt is assumed to be backed by a custom block (it is accessed with Data_custom_val).

Parameters

module Elt : Elt_sig

Signature

Sourcetype t
Sourcetype elt = Elt.t
Sourceval t : t Repr.t
Sourceval empty : t
Sourceval allocate : int -> t

allocate len creates a C array of size len initialized with zeros.

Sourceval init : int -> (int -> elt) -> t

init n f returns a fresh C array of length n, with element number i initialized to the result of f i.

Sourceval degree : t -> int

degree p returns the index of the last non-zero element of p. Returns -1 if all elements of p are zero.

Sourceval erase : t -> int -> unit

erase p n fills with zeros the first n elements of p.

Sourceval length : t -> int

length c returns the length of a C array c

Sourceval get : t -> int -> elt

get c i returns the i-th element of a C array c

Sourceval get_inplace : t -> int -> elt -> unit

get_inplace c i res copies the i-th element of a C array c in res

Sourceval iter_copy_elt : (elt -> unit) -> t -> unit

iter_copy_elt f a applies function f in turn to a **copy** of all the elements of a. It is equivalent to f a.(0); f a.(1); ...; f a.(length a - 1); ().

Sourceval iteri_copy_elt : (int -> elt -> unit) -> t -> unit

Same as iter_copy_elt, but the function is applied to the index of the element as first argument, and a **copy** of the element itself as second argument.

Sourceval set : t -> elt -> int -> unit
Sourceval copy : ?offset:int -> ?len:int -> t -> t

copy c copies len elements from a C array c starting from position offset

Sourceval blit : t -> src_off:int -> t -> dst_off:int -> len:int -> unit

blit src src_off dst dst_off len copies len elements from src to dst starting at the respective offsets.

Sourceval equal : t -> offset1:int -> t -> offset2:int -> len:int -> bool

equal a offset1 b offset2 returns true if the segments of len elements of a and b are equal starting from their respective offsets offset1 (for a) and offset2 (for b).

Sourceval to_array : ?offset:int -> ?len:int -> t -> elt array

to_array c converts a C array c to an OCaml array

Sourceval of_array : elt array -> t

of_array c converts an OCaml array c to a C array

Sourceval of_bigstring : Bigstringaf.t -> t
Sourceval to_bigstring : t -> Bigstringaf.t
Sourceval eq : t -> t -> bool

eq a b returns true if C arrays a and b are equals

Sourceval sub : t -> off:int -> len:int -> t

sub a off len extracts a sub-array of a

Sourceval fold_left_map : ('acc -> elt -> 'acc * elt) -> 'acc -> t -> 'acc * t

fold_left_map is a combination of fold_left and map that threads an accumulator through calls to f.

OCaml

Innovation. Community. Security.