package reedsolomon

  1. Overview
  2. Docs

polynomial with primitive field coefficients

type elt

polynomial coefficient type

an array of 'elt's representing the polynomial. powers are at index position (ie lowest first)

type t

an array of 'elt's representing the polynomial. powers are at index position (ie lowest first)

val degree : t -> int

the degree of the polynomial

this is represented as |E.zero|

val zero : t

this is represented as |E.zero|

this is represented as |E.one|

val one : t

this is represented as |E.one|

this is represented as |E.zero;E.one|

val x : t

this is represented as |E.zero;E.one|

convert to poly

val to_poly : elt array -> t

convert to poly

convert from poly

val of_poly : t -> elt array

convert from poly

make a copy of the poly

val copy : t -> t

make a copy of the poly

type poly_format = {
  1. coef : elt -> string;
  2. indet : int -> string;
}

control over print formatting

val poly_format : poly_format
val string_format : bool -> poly_format -> int -> elt -> string
val to_string : ?down:bool -> ?str:(int -> elt -> string) -> t -> string

create string of poly

val trim : t -> t

legalise the poly. high order powers which are 0 are removed.

val slice : t -> int -> t
val (+:) : t -> t -> t

poly addition

poly subtraction

val (-:) : t -> t -> t

poly subtraction

poly multiplication

val (*:) : t -> t -> t

poly multiplication

poly division

val (/:) : t -> t -> t * t

poly division

scalar multiplication

val (*:.) : t -> elt -> t

scalar multiplication

scalar division

val (/:.) : t -> elt -> t

scalar division

multiply poly by x^n

val (^:) : t -> int -> t

multiply poly by x^n

raise poly to power n

val (**:) : t -> int -> t

raise poly to power n

val ext_gcd : t -> t -> t * t

extended gcd algorithm

val eval : t -> elt -> elt

evaluate polynomial

OCaml

Innovation. Community. Security.