package prbnmcn-linalg

  1. Overview
  2. Docs

Parameters

module B : Basic_structures.Basic_intf.Lang.Bool with type 'a m = 'a Repr.m
module R : Basic_structures.Basic_intf.Lang.Ring with type 'a m = 'a Repr.m
module R_ord : Basic_structures.Basic_intf.Lang.Infix_order with type 'a m = 'a Repr.m and type t = R.t
module Loop : Basic_structures.Basic_intf.Lang.Loop with type 'a m = 'a Repr.m and type index = R.t
module E : Basic_structures.Basic_intf.Lang.Exn with type 'a m = 'a Repr.m

Signature

type 'a k = 'a Monad.t
include Basic_structures.Basic_intf.Lang.Shape with type 'a m = 'a Repr.m with type pos = R.t
type 'a m = 'a Repr.m
type pos = R.t

The type of (one-dimensional) positions in a shape.

type 'a t

The type of shapes, parametric in the type of positions.

val mem : 'a t -> 'a m -> bool m

mem p s is true iff p is a position in the shape s.

val pos_equal : 'a t -> 'a m -> 'a m -> bool m

pos_equal s p p' is true iff p and p' are equal positions in the shape s.

val equal : 'a t -> 'a t -> bool m

equal s s' is true iff s and s' describe equal shapes.

module type Storage = sig ... end

First-class mutable storage.

type 'elt storage = (module Storage with type elt = 'elt)
val iter : ('a m -> unit m) -> 'a t -> unit m

Iterate on a shape.

val fold : 'acc storage -> ('a m -> 'acc m -> 'acc m) -> 'a t -> 'acc m -> 'acc m

Fold on a shape.

module Path : sig ... end

The type of Path.t allows to specify a rank-one sub-tensor out of a rank-n tensor.

val proj : 'a t -> 'a Path.t -> pos t

proj s p is the rank one component of s at the path specified by p.

val rank_one : pos m -> pos t

Rank one tensor shape with prescribed dimension.

val rank_two : pos m -> pos m -> (pos * pos) t

Rank two tensor shape with prescribed dimensions.

val scalar : pos t

scalar is a rank one tensor shape with dimension one.

val empty : pos t

empty is a rank one tensor shape with dimension zero.

val dim : 'a t -> 'a Path.t -> pos m

Dimension along a one-dimensional slice specified by the given path.

val numel : 'a t -> pos m

Total number of positions in the given shape.

val tensor : 'a t -> 'b t -> ('a * 'b) t

Tensor product of shapes.

val concat : 'a t -> 'a t -> 'a Path.t -> 'a t k

concat s1 s2 p concatenates s1 and s2 along the dimension specified by the path p.

  • raises Dimensions_mismatch

    if s1 and s2 have a different shape along the orthogonal complement to p.

val fst : ('a * 'b) t -> 'a t

Project the first component out of a tensor shape.

val snd : ('a * 'b) t -> 'b t

Project the second component out of a tensor shape.

module Morphism : sig ... end