package smol

  1. Overview
  2. Docs

Define arithmetic operations on vectors with values in a ring.

Parameters

module K : Algebra.Ring_S

Signature

include sig ... end
type t = K.t v
exception Vector_incompatible of t * t
val zero : Literal.t list -> t

The zero vector for the given basis

val is_zero : t -> bool
val equal : t -> t -> bool

Equality of vectors

val neq : t -> t -> bool

Not equal

val add : t -> t -> t

Addition

  • raises [Vector_incompatible

    (a,b)] if the vectors do not have the same basis.

val mul_dot : t -> t -> K.t

Dot product, used for the matrix product.

  • raises [Vector_incompatible

    (a,b)] if the vectors do not have the same basis.

val mul_scalar : K.t -> t -> t

Multiplies every entry in a vector with the given scalar

val to_string : t -> string

Returns the string representation of a given vector

val neg : t -> t

Negation

val sub : t -> t -> t

Substraction

  • raises [Vector_incompatible

    (a,b)] if the vectors do not have the same basis.

module Infix : sig ... end
OCaml

Innovation. Community. Security.