Caustic v0.1.21 Caustic.Field protocol View Source

Protocol on field operations. Mainly to support Caustic.FiniteField.

Link to this section Summary

Functions

Examples

Examples

Examples

Examples

Examples

Examples

Examples

Examples

Check if it is the additive identity

Link to this section Types

Link to this section Functions

Examples

iex> Caustic.Field.add({7, 13}, {12, 13})
{6, 13}

Examples

iex> Caustic.Field.div({2, 5}, {4, 5})
{3, 5}
iex> Caustic.Field.div({1, 5}, {2, 5})
{3, 5}

Examples

iex> Caustic.Field.eq?({7, 13}, {7, 13})
true
iex> Caustic.Field.eq?({7, 13}, {6, 13})
false
iex> Caustic.Field.eq?({7, 13}, {7, 11})
false

Examples

iex> Caustic.Field.inverse({1, 71})
{1, 71}
iex> Caustic.Field.inverse({51, 71})
{39, 71}
iex> Caustic.Field.inverse({39, 71})
{51, 71}
iex> Caustic.Field.mul({51, 71}, {39, 71})
{1, 71}
iex> Caustic.Field.inverse({0, 71})
nil

Examples

iex> Caustic.Field.mul({5, 19}, {3, 19})
{15, 19}
iex> Caustic.Field.mul({8, 19}, {17, 19})
{3, 19}

Examples

iex> Caustic.Field.ne?({7, 13}, {7, 13})
false
iex> Caustic.Field.ne?({7, 13}, {6, 13})
true
iex> Caustic.Field.ne?({7, 13}, {7, 11})
true

Examples

iex> Caustic.Field.pow({7, 19}, {3, 19})
{1, 19}

iex> Caustic.Field.pow({9, 19}, {12, 19})
{7, 19}

Examples

iex> Caustic.Field.sub({7, 13}, {12, 13})
{8, 13}

Check if it is the additive identity.

Examples

iex> Caustic.Field.zero?(0)
true
iex> Caustic.Field.zero?(0.0)
true
iex> Caustic.Field.zero?({0, 5})
true