package gsl

  1. Overview
  2. Docs

Generic variant types for vectors and matrices

Real values

type vec = [
  1. | `V of Vector.vector
  2. | `VF of Vector_flat.vector
]
val vec_convert : ?protect:bool -> [< `A of float array | `VF of Vector_flat.vector | `V of Vector.vector ] -> [> vec ]
type mat = [
  1. | `M of Matrix.matrix
  2. | `MF of Matrix_flat.matrix
]
val mat_convert : ?protect:bool -> [< `M of Matrix.matrix | `MF of Matrix_flat.matrix | `A of float array * int * int | `AA of float array array ] -> [> mat ]
val mat_flat : ?protect:bool -> [< `M of Matrix.matrix | `MF of Matrix_flat.matrix | `A of float array * int * int | `AA of float array array ] -> Matrix_flat.matrix

Complex values

type cvec = [
  1. | `CV of Vector_complex.vector
  2. | `CVF of Vector_complex_flat.vector
]
type cmat = [
  1. | `CM of Matrix_complex.matrix
  2. | `CMF of Matrix_complex_flat.matrix
]
val cmat_convert : ?protect:bool -> [< `CM of Matrix_complex.matrix | `CMF of Matrix_complex_flat.matrix | `CA of Gsl_complex.complex_array * int * int ] -> [> cmat ]

Generic vector operations

val length : [< vec | cvec ] -> int
val to_array : [< vec ] -> float array
val v_copy : [< vec ] -> [> vec ]
val subvector : [< vec ] -> off:int -> len:int -> [> vec ]
val v_memcpy : [< vec ] -> [< vec ] -> unit
val v_add : [< vec ] -> [< vec ] -> unit
val v_sub : [< vec ] -> [< vec ] -> unit
val v_mul : [< vec ] -> [< vec ] -> unit
val v_div : [< vec ] -> [< vec ] -> unit
val v_max : [< vec ] -> float
val v_min : [< vec ] -> float
val v_minmax : [< vec ] -> float * float
val v_max_index : [< vec ] -> int
val v_min_index : [< vec ] -> int
val v_minmax_index : [< vec ] -> int * int

Generic matrix operations

val dims : [< mat | cmat ] -> int * int
val tmp : [< mat ] -> [> `M of Matrix.matrix ]
val to_arrays : [< mat ] -> float array array
val m_copy : [< mat ] -> [> mat ]
val m_memcpy : [< mat ] -> [< mat ] -> unit
val m_add : [< mat ] -> [< mat ] -> unit
val m_sub : [< mat ] -> [< mat ] -> unit
val m_mul : [< mat ] -> [< mat ] -> unit
val m_div : [< mat ] -> [< mat ] -> unit
val m_add_diagonal : [< mat ] -> float -> unit
val swap_rows : [< mat ] -> int -> int -> unit
val swap_columns : [< mat ] -> int -> int -> unit
val swap_rowcol : [< mat ] -> int -> int -> unit
val transpose : [< mat ] -> [< mat ] -> unit
val transpose_in_place : [< mat ] -> unit

Other generic operations

val is_null : [< vec | mat ] -> bool
val scale : [< vec | mat ] -> float -> unit
val add_constant : [< vec | mat ] -> float -> unit
OCaml

Innovation. Community. Security.