protocol
numberlistp
List of numbers protocol.
logtalk_load(types(loader))
static
Public predicates
min/2
Determines the minimum value in a list using arithmetic order. Fails if the list is empty.
static
min(List,Minimum)
min(+list(number),-number)
- zero_or_one
max/2
Determines the list maximum value using arithmetic order. Fails if the list is empty.
static
max(List,Maximum)
max(+list(number),-number)
- zero_or_one
min_max/3
Determines the minimum and maximum values in a list using arithmetic order. Fails if the list is empty.
static
min_max(List,Minimum,Maximum)
min_max(+list(number),-number,-number)
- zero_or_one
product/2
Calculates the product of all list numbers. Fails if the list is empty.
static
product(List,Product)
product(+list(number),-number)
- zero_or_one
sum/2
Calculates the sum of all list numbers. Returns the integer zero if the list is empty.
static
sum(List,Sum)
sum(+list(number),-number)
- one
average/2
Calculates the average (i.e. arithmetic mean) of a list of numbers. Fails if the list is empty.
static
average(List,Average)
average(+list(number),-float)
- zero_or_one
median/2
Calculates the median of a list of numbers. Fails if the list is empty.
static
median(List,Median)
median(+list(number),-float)
- zero_or_one
modes/2
Returns the list of modes of a list of numbers in ascending order. Fails if the list is empty.
static
modes(List,Modes)
modes(+list(number),-list(number))
- zero_or_one
euclidean_norm/2
Calculates the Euclidean norm of a list of numbers. Fails if the list is empty.
static
euclidean_norm(List,Norm)
euclidean_norm(+list(number),-float)
- zero_or_one
chebyshev_norm/2
Calculates the Chebyshev norm of a list of numbers. Fails if the list is empty.
static
chebyshev_norm(List,Norm)
chebyshev_norm(+list(integer),-integer)
- zero_or_one
chebyshev_norm(+list(float),-float)
- zero_or_one
manhattan_norm/2
Calculates the Manhattan norm of a list of numbers. Fails if the list is empty.
static
manhattan_norm(List,Norm)
manhattan_norm(+list(integer),-integer)
- zero_or_one
manhattan_norm(+list(float),-float)
- zero_or_one
euclidean_distance/3
Calculates the Euclidean distance between two lists of numbers. Fails if the two lists are empty or not of the same length.
static
euclidean_distance(List1,List2,Distance)
euclidean_distance(+list(number),+list(number),-float)
- zero_or_one
chebyshev_distance/3
Calculates the Chebyshev distance between two lists of numbers. Fails if the two lists are empty or not of the same length.
static
chebyshev_distance(List1,List2,Distance)
chebyshev_distance(+list(integer),+list(integer),-integer)
- zero_or_one
chebyshev_distance(+list(float),+list(float),-float)
- zero_or_one
manhattan_distance/3
Calculates the Manhattan distance between two lists of numbers. Fails if the two lists are empty or not of the same length.
static
manhattan_distance(List1,List2,Distance)
manhattan_distance(+list(integer),+list(integer),-integer)
- zero_or_one
manhattan_distance(+list(float),+list(float),-float)
- zero_or_one
scalar_product/3
Calculates the scalar product of two lists of numbers. Fails if the two lists are empty or not of the same length.
static
scalar_product(List1,List2,Product)
scalar_product(+list(integer),+list(integer),-integer)
- zero_or_one
scalar_product(+list(float),+list(float),-float)
- zero_or_one
normalize_range/2
Normalizes a list of numbers into the [0.0,1.0]
range. Caller must handle arithmetic exceptions if the input list if not normalizable.
static
normalize_range(List,NormalizedList)
normalize_range(+list(number),-list(float))
- one
normalize_range/4
Normalizes a list of numbers into the given range. Caller must handle arithmetic exceptions if the input list if not normalizable.
static
normalize_range(List,Minimum,Maximum,NormalizedList)
normalize_range(+list(number),+number,+number,-list(float))
- one
normalize_unit/2
Normalizes a list of numbers returning its unit vector (i.e. a list with Euclidean norm equal to one). Caller must handle arithmetic exceptions if the input list if not normalizable.
static
normalize_unit(List,NormalizedList)
normalize_unit(+list(number),-list(float))
- one
normalize_scalar/2
Normalizes a list of numbers such that the sum of all numbers is equal to one. Caller must handle arithmetic exceptions if the input list if not normalizable.
static
normalize_scalar(List,NormalizedList)
normalize_scalar(+list(number),-list(float))
- one
rescale/3
Rescales all numbers in a list by the given factor.
static
rescale(List,Factor,RescaledList)
rescale(+list(integer),+integer,-list(integer))
- one
rescale(+list(number),+float,-list(float))
- one
least_common_multiple/2
Computes the least common multiple of a list of two or more positive integers. Fails if the list is empty or contains a single element. Fails also if any of the elements is zero. May require backend support for unbound integer arithmetic.
static
least_common_multiple(Integers,LeastCommonMultiple)
least_common_multiple(+list(positive_integer),-positive_integer)
- zero_or_one
Protected predicates
(none)
Private predicates
(none)
Operators
(none)
See also