Numy v0.1.3 Numy.Enumy View Source

Extend Enum for homogeneous enumerables.

Link to this section Summary

Functions

Check if all elements of a list are floats.

Check if all elements of a list are integers.

Convert all numerical elements of a list to float type.

The dot product is the sum of the products of the corresponding entries of the two sequences of numbers.

Get mean (average) of a sequence of numbers.

Sort elements with Quicksort

Link to this section Functions

Link to this function

all_floats?(enumerable)

View Source
all_floats?(Enumerable.t()) :: boolean()

Check if all elements of a list are floats.

Examples

iex(10)> import Numy.Enumy
Numy.Enumy
iex(11)> all_floats?([1.1, 2.2, 3.3])
true
iex(12)> all_floats?([1.1, 2.2, 3])
false
Link to this function

all_integers?(enumerable)

View Source
all_integers?(Enumerable.t()) :: boolean()

Check if all elements of a list are integers.

Examples

iex(1)> import Numy.Enumy
Numy.Enumy
iex(2)> all_integers?([1, 2, 3])
true
iex(3)> all_integers?([1.1, 2, 3])
false
Link to this function

all_numbers?(enumerable)

View Source
all_numbers?(Enumerable.t()) :: boolean()
Link to this function

all_to_float(enumerable)

View Source
all_to_float(Enumerable.t()) :: [float()]

Convert all numerical elements of a list to float type.

Examples

iex(13)> all_to_float([1.1, 2.2, 3])
[1.1, 2.2, 3.0]
Link to this function

dot_product(vec1, vec2)

View Source
dot_product([number()], [number()]) :: number()

The dot product is the sum of the products of the corresponding entries of the two sequences of numbers.

Examples

iex> dot_product([1,2,3],[2,3,0])
8

Get mean (average) of a sequence of numbers.

Examples

iex(14)> mean([1,2,3,4,5,6,7,8,9])
5.0

Sort elements with Quicksort