package prbnmcn-linalg

  1. Overview
  2. Docs
Functional vector and matrix manipulation

Install

Dune Dependency

Authors

Maintainers

Sources

0.0.1.tar.gz
md5=8b82c3fea93d99b25ba945e0fbda9dd4
sha512=38a673af59c5b775cee2586e826b2f346274fc1bfee0f883d47a911ec6300ce1ed5f205d38f0e06cf260766328dad527d067e182e7f0a90cd45c1f06b09befcf

doc/prbnmcn-linalg/Linalg/Mat/Rational/index.html

Module Mat.RationalSource

Float allows to manipulate Q.t-valued matrices

Sourcetype 'a k = 'a
Sourcetype 'a m = 'a
Sourcetype base_index = Tensor.Int.pos
Sourcetype 'a shape = 'a Tensor.Int.t
type index := base_index * base_index
include Intf.Vec with type 'a k := 'a k and type 'a m := 'a m and type 'a shape := 'a shape with type ('a, 'b) morphism = ('a, 'b) Tensor.Int.Morphism.t with type elt = Q.t
Sourcetype ('a, 'b) morphism = ('a, 'b) Tensor.Int.Morphism.t

Type of shape morphisms.

Sourcetype elt = Q.t

Type of elements.

Sourcetype 'i t = ('i shape, 'i m, elt m) Intf.vec
Sourcetype 'i out = ('i shape, 'i m, elt m, unit m) Intf.ovec
Sourceval idim : 'i t -> 'i shape

Dimensions of an input vector.

Sourceval odim : 'i out -> 'i shape

Dimensions of an output vector.

Sourceval make : 'i shape -> ('i m -> elt m) -> 'i t

Creates an input vector from a dimension and a function.

Sourceval pullback : ('j, 'i) morphism -> 'i t -> 'j t k

Pullback a vector along a shape morphism.

Sourceval get : 'i t -> 'i m -> elt m k

Get an elemement of an input vector.

  • raises Out_of_bounds

    if given index is not in the domain of the vector.

Sourceval unsafe_get : 'i t -> 'i m -> elt m

Get an elemement of an input vector. Does not perform bound checking.

Sourceval set : 'i out -> 'i m -> elt m -> unit m k

Set an elemement in an output vector.

  • raises Out_of_bounds

    if given index is not in the domain of the vector.

Sourceval map : ('a m -> 'b m) -> ('i shape, 'i m, 'a m) Intf.vec -> ('i shape, 'i m, 'b m) Intf.vec
Sourceval mapi : ('i m -> 'a m -> 'b m) -> ('i shape, 'i m, 'a m) Intf.vec -> ('i shape, 'i m, 'b m) Intf.vec
Sourceval map2 : ('a m -> 'b m -> 'c m) -> ('i shape, 'i m, 'a m) Intf.vec -> ('i shape, 'i m, 'b m) Intf.vec -> ('i shape, 'i m, 'c m) Intf.vec k
Sourceval map2i : ('i m -> 'a m -> 'b m -> 'c m) -> ('i shape, 'i m, 'a m) Intf.vec -> ('i shape, 'i m, 'b m) Intf.vec -> ('i shape, 'i m, 'c m) Intf.vec k
Sourceval assign : ('i shape, 'i m, 'a m, unit m) Intf.ovec -> ('i shape, 'i m, 'a m) Intf.vec -> ('i shape, 'i m, unit m) Intf.vec k
Sourceval zero : 'i shape -> 'i t

Everywhere zero vector.

Sourceval one : 'i shape -> 'i t

Everywhere one vector.

Sourceval const : 'i shape -> elt m -> 'i t

Constant vector.

Sourceval basis : 'i shape -> 'i m -> elt m -> 'i t k

basis s i r is the vector of shape s everywhere equal to R.zero except at index i where it is equal to r. Raises Out_of_bounds if i does not belong to s.

Sourceval add : 'i t -> 'i t -> 'i t k

Pointwise addition. Raises Dimensions_mismatch if the shape of operands are not equal.

Sourceval sub : 'i t -> 'i t -> 'i t k

Pointwise subtraction. Raises Dimensions_mismatch if the shape of operands are not equal.

Sourceval mul : 'i t -> 'i t -> 'i t k

Pointwise multiplication. Raises Dimensions_mismatch if the shape of operands are not equal.

Sourceval neg : 'i t -> 'i t

Pointwise negation.

Sourceval smul : elt m -> 'i t -> 'i t

Multiplication by a scalar.

Sourceval swap : 'i m -> 'i m -> 'i t -> 'i t k

Swapping of indices. Raises Out_of_bounds if given indices are invalid.

Sourceval iter : ('i shape, 'i m, unit m) Intf.vec -> unit m

iter v iterates the effectful computation at each index

Sourceval reduce : (elt m -> elt m -> elt m) -> elt m -> ('i shape, 'i m, elt m) Intf.vec -> elt m

reduce op zero v folds the binary, associative operator op over the elements of v with initial value zero. Fold ordering is implementation-dependent: consider using commutative operators.

Sourceval (:=) : ('i shape, 'i m, 'a m, unit m) Intf.ovec -> ('i shape, 'i m, 'a m) Intf.vec -> unit m k

Vector assignement.

  • raises Dimensions_mismatch

    if the size of operands are not equal.

Sourceval add_ : 'i out -> 'i t -> 'i t -> unit m k

Pointwise addition, stores result in first operand.

  • raises Dimensions_mismatch

    if the size of operands are not equal.

Sourceval sub_ : 'i out -> 'i t -> 'i t -> unit m k

Pointwise subtraction, stores result in first operand.

  • raises Dimensions_mismatch

    if the size of operands are not equal.

Sourceval mul_ : 'i out -> 'i t -> 'i t -> unit m k

Pointwise multiplication, stores result in first operand.

  • raises Dimensions_mismatch

    if the size of operands are not equal.

Sourceval dot : 'i t -> 'i t -> elt m k

Dot product.

  • raises Dimensions_mismatch

    if the size of operands are not equal.

Sourcemodule Infix : sig ... end
Sourceval index : c:base_index m -> r:base_index m -> index m

Indexing

cols m returns the shape of the columns of m.

rows m returns the shape of the rows of m

Sourceval identity : base_index shape -> index t

Identity matrix

Square matrix with given vector on diagonal

Get a column.

  • raises Out_of_bounds

    if given indices are invalid.

Convert a vector into a matrix with this vector as single column.

Get a row.

  • raises Out_of_bounds

    if given indices are invalid.

Convert a vector into a matrix with this vector as single row.

Sourceval swap_rows : index t -> base_index m -> base_index m -> index t k

Swap two rows.

  • raises Out_of_bounds

    if given indices are invalid.

Sourceval swap_cols : index t -> base_index m -> base_index m -> index t k

Swap two columns.

  • raises Out_of_bounds

    if given indices are invalid.

Sourceval concat_horiz : index t -> index t -> index t k

Concatenate two matrices horizontally, provided they have the same number of rows.

  • raises Dimensions_mismatch

    if this condition is not verified.

Sourceval concat_vert : index t -> index t -> index t k

Concatenate two matrices vertically, provided they have the same number of columns.

  • raises Dimensions_mismatch

    if this condition is not verified.

Sourceval mm : index t -> index t -> index t k

Matrix multiplication.

  • raises Dimensions_mismatch

    if the nummber of columns of the left-hand side is not equal to the number of rows of the right-hand side.

OCaml

Innovation. Community. Security.