.TH "Bigarray.Array1" 3o source: 2019-01-25 OCamldoc "OCaml library" .SH NAME Bigarray.Array1 \- One-dimensional arrays. .SH Module Module Bigarray.Array1 .SH Documentation .sp Module .BI "Array1" : .B sig end .sp One\-dimensional arrays\&. The .B Array1 structure provides operations similar to those of .B Bigarray\&.Genarray , but specialized to the case of one\-dimensional arrays\&. (The .B Bigarray\&.Array2 and .B Bigarray\&.Array3 structures below provide operations specialized for two\- and three\-dimensional arrays\&.) Statically knowing the number of dimensions of the array allows faster operations, and more precise static type\-checking\&. .sp .sp .sp .I type .B ('a, 'b, 'c) .I t .sp The type of one\-dimensional big arrays whose elements have OCaml type .B \&'a , representation kind .B \&'b , and memory layout .B \&'c \&. .sp .I val create : .B ('a, 'b) Bigarray.kind -> .B 'c Bigarray.layout -> int -> ('a, 'b, 'c) t .sp .B Array1\&.create kind layout dim returns a new bigarray of one dimension, whose size is .B dim \&. .B kind and .B layout determine the array element kind and the array layout as described for .B Bigarray\&.Genarray\&.create \&. .sp .I val dim : .B ('a, 'b, 'c) t -> int .sp Return the size (dimension) of the given one\-dimensional big array\&. .sp .I val kind : .B ('a, 'b, 'c) t -> ('a, 'b) Bigarray.kind .sp Return the kind of the given big array\&. .sp .I val layout : .B ('a, 'b, 'c) t -> 'c Bigarray.layout .sp Return the layout of the given big array\&. .sp .I val size_in_bytes : .B ('a, 'b, 'c) t -> int .sp .B size_in_bytes a is the number of elements in .B a multiplied by .B a \&'s .B Bigarray\&.kind_size_in_bytes \&. .sp .B "Since" 4.03.0 .sp .I val get : .B ('a, 'b, 'c) t -> int -> 'a .sp .B Array1\&.get a x , or alternatively .B a\&.{x} , returns the element of .B a at index .B x \&. .B x must be greater or equal than .B 0 and strictly less than .B Array1\&.dim a if .B a has C layout\&. If .B a has Fortran layout, .B x must be greater or equal than .B 1 and less or equal than .B Array1\&.dim a \&. Otherwise, .B Invalid_argument is raised\&. .sp .I val set : .B ('a, 'b, 'c) t -> int -> 'a -> unit .sp .B Array1\&.set a x v , also written .B a\&.{x} <\- v , stores the value .B v at index .B x in .B a \&. .B x must be inside the bounds of .B a as described in .B Bigarray\&.Array1\&.get ; otherwise, .B Invalid_argument is raised\&. .sp .I val sub : .B ('a, 'b, 'c) t -> .B int -> int -> ('a, 'b, 'c) t .sp Extract a sub\-array of the given one\-dimensional big array\&. See .B Bigarray\&.Genarray\&.sub_left for more details\&. .sp .I val slice : .B ('a, 'b, 'c) t -> int -> ('a, 'b, 'c) Bigarray.Array0.t .sp Extract a scalar (zero\-dimensional slice) of the given one\-dimensional big array\&. The integer parameter is the index of the scalar to extract\&. See .B Bigarray\&.Genarray\&.slice_left and .B Bigarray\&.Genarray\&.slice_right for more details\&. .sp .B "Since" 4.05.0 .sp .I val blit : .B ('a, 'b, 'c) t -> ('a, 'b, 'c) t -> unit .sp Copy the first big array to the second big array\&. See .B Bigarray\&.Genarray\&.blit for more details\&. .sp .I val fill : .B ('a, 'b, 'c) t -> 'a -> unit .sp Fill the given big array with the given value\&. See .B Bigarray\&.Genarray\&.fill for more details\&. .sp .I val of_array : .B ('a, 'b) Bigarray.kind -> .B 'c Bigarray.layout -> 'a array -> ('a, 'b, 'c) t .sp Build a one\-dimensional big array initialized from the given array\&. .sp .I val map_file : .B Unix.file_descr -> .B ?pos:int64 -> .B ('a, 'b) Bigarray.kind -> .B 'c Bigarray.layout -> bool -> int -> ('a, 'b, 'c) t .sp Memory mapping of a file as a one\-dimensional big array\&. See .B Bigarray\&.Genarray\&.map_file for more details\&. .sp .I val unsafe_get : .B ('a, 'b, 'c) t -> int -> 'a .sp Like .B Bigarray\&.Array1\&.get , but bounds checking is not always performed\&. Use with caution and only when the program logic guarantees that the access is within bounds\&. .sp .I val unsafe_set : .B ('a, 'b, 'c) t -> int -> 'a -> unit .sp Like .B Bigarray\&.Array1\&.set , but bounds checking is not always performed\&. Use with caution and only when the program logic guarantees that the access is within bounds\&. .sp