stdlib.sc
stdlib.sc
Module with standard general functions.
Functions:
abs
Function for finding the absolute value of the input.
argument
Function for accessing the named program arguments of public types.
arrayToString
Function for converting an array to a string.
erf
Error function.
exp
Exponential function.
flatten
Function for converting arrays to 1 dimensional.
iota
Function for generating a vector of consecutive integers.
isNegligible
Function for finding if the error is small enough to neglect.
isPrefixOf
Function for checking if a string is a prefix of another string.
isSuffixOf
Function for checking if a string is a suffix of another string.
ln
Natural logarthim.
print3dArray
Function for printing out 3-dimensional arrays.
Detailed Description
T - any data type |
Parameters
arr |
- a 3-dimensional array |
prints out a string representation of the input array. |
see also printArray |
printArray
Function for printing out any dimension arrays.
Detailed Description
T - any data type |
Parameters
arr |
- any dimension array |
prints out a string representation of the input array. |
see also printVector / printMatrix / print3dArray |
printMatrix
Function for printing out matrices.
Detailed Description
T - any data type |
Parameters
mat |
- a 2-dimensional matrix |
prints out a string representation of the input matrix. |
see also printArray |
printVector
Function for printing out vectors.
Detailed Description
T - any data type |
Parameters
vec |
- a 1-dimensional array |
prints out a string representation of the input vector |
see also printArray |
publish
Function for publishing the named values of public types.
round
Function for rounding values.
shapesAreEqual
Function for checking the shape equality of two arrays.
Detailed Description
D1 - all protection domains |
D2 - all protection domains |
D3 - all protection domains |
N - any array size of any dimension |
T1 - any data type |
T2 - any data type |
T3 - any data type |
Parameters
first |
- first input |
second |
- second input |
returns a bool type value, whether the input arrays are of equal shape (true) or are not of equal shape (false) |
sin
Function for finding sine.
sizeof
Function for getting the size of a public value in bytes based on its type.
all
Function for checking if all elements in a boolean vector are true.
Functions:
D - all protection domains |
all
Function for checking if all elements in a boolean vector are true.
all(parts)
Function for checking if all elements in a boolean vector are true in specified parts.
Detailed Description
D - all protection domains |
Supported types - bool |
Parameters
vec |
- a vector of supported type |
k |
- an uint type value for specifying from how many subarrays all must be found |
returns a boolean vector that evaluates every subarray seperately for all |
iteratively checks all elements in input vector and returns false when the first 0-bit is found. |
None |
any
Function for checking if any element in a boolean vector is true.
Functions:
D - all protection domains |
any
Function for checking if any element in a boolean vector is true.
any(parts)
Function for checking if any element in a boolean vector is true in specified parts.
Detailed Description
D - all protection domains |
Supported types - bool |
Parameters
vec |
- a vector of supported type |
k |
- an uint type value for specifying from how many subarrays any must be found |
returns a boolean vector that evaluates every subarray seperately for any |
iteratively checks all elements in input vector and returns true when the first 1-bit is found. |
None |
max
Function for finding the maximum value of the input.
Functions:
max
Function for finding the maximum value of the input.
max(parts)
Function for finding the maximum value of the input in specified parts.
max(pointwise)
Function for finding the pointwise maximum of two input vectors.
min
Function for finding the minimum values.
Functions:
min
Function for finding the minimum value of the input.
min(parts)
Function for finding the minimum value of the input in specified parts.
Detailed Description
D - all protection domains |
Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int |
Parameters
vec |
- input vector on supported type |
k |
- an uint type value for specifying from how many subarrays min must be found |
returns the minimum value of every subarray in the input |
None |
min(pointwise)
Function for finding the pointwise minimum value of the two input vectors.
product
Function for finding the product of all elements in the input vector.
Functions:
D - all protection domains |
Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / float32 / float64 |
product
Function for finding the product of the input vector.
Detailed Description
D - all protection domains |
Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / float32 / float64 |
Parameters
x |
- input |
the product of the input vector |
None |
Function Overloads
D T product(D T x)
D uint8 product(D uint8[[1]] x)
D uint16 product(D uint16[[1]] x)
D uint32 product(D uint32[[1]] x)
D uint product(D uint[[1]] x)
D int8 product(D int8[[1]] x)
D int16 product(D int16[[1]] x)
D int32 product(D int32[[1]] x)
D int product(D int[[1]] x)
D float32 product(D float32[[1]] x)
D float64 product(D float64[[1]] x)
product(parts)
Function for finding the product of the input vector in parts.
Detailed Description
D - all protection domains |
Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / float32 / float64 |
Parameters
vec |
- input vector |
k |
- an uint type scalar which specifies in how many parts the product is found. For example if k = 2 then the input vector is split into two parts and the products of those parts are found seperately. |
a vector with the product of the specified number of parts in the input vector |
None |
Function Overloads
D uint8 product(D uint8[[1]] vec, uint k)
D uint16 product(D uint16[[1]] vec, uint k)
D uint32 product(D uint32[[1]] vec, uint k)
D uint product(D uint[[1]] vec, uint k)
D int8 product(D int8[[1]] vec, uint k)
D int16 product(D int16[[1]] vec, uint k)
D int32 product(D int32[[1]] vec, uint k)
D int product(D int[[1]] vec, uint k)
D float32 product(D float32[[1]] vec, uint k)
D float64 product(D float64[[1]] vec, uint k)
sort
Public sorting functions.
Functions:
Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / float32 / float64 |
sort
Sort a public vector.
sort(direction)
Sort a public vector.
Detailed Description
Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / float32 / float64 |
Parameters
x |
- vector to be sorted |
ascending |
- boolean indicating if the input should be sorted in ascending or descending order |
|
sum
Function for finding the sum of all elements in the input vector.
Functions:
D - all protection domains |
Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / float32 / float64 |
sum
Function for finding the sum of all elements in the input vector.
Detailed Description
D - all protection domains |
Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / float32 / float64 |
Uses accumulator to calculate sum. May be very inefficient for private domains. |
Parameters
x |
- input |
returns the sum of all elements in input vector |
None |
Function Overloads
D T sum(D T x)
D uint sum(D bool[[1]] x)
D uint8 sum(D uint8[[1]] x)
D uint16 sum(D uint16[[1]] x)
D uint32 sum(D uint32[[1]] x)
D uint sum(D uint[[1]] x)
D int8 sum(D int8[[1]] x)
D int16 sum(D int16[[1]] x)
D int32 sum(D int32[[1]] x)
D int sum(D int[[1]] x)
D float32 sum(D float32[[1]] x)
D float64 sum(D float64[[1]] x)
sum(parts)
Function for finding the sum of all elements in the input vector in specified parts.
Detailed Description
D - all protection domains |
Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / float32 / float64 |
Uses accumulator to calculate sum. May be very inefficient for private domains. |
Parameters
vec |
- input |
k |
- an uint type scalar which specifies in how many parts the sum is found. For example if k = 2 then the input vector is split into two parts and the sums of those parts are found seperately. |
returns a vector with the sum of the specified number of parts in the input vector |
None |
Function Overloads
D uint sum(D bool[[1]] vec, uint k)
D uint8 sum(D uint8[[1]] vec, uint k)
D uint16 sum(D uint16[[1]] vec, uint k)
D uint32 sum(D uint32[[1]] vec, uint k)
D uint sum(D uint[[1]] vec, uint k)
D int8 sum(D int8[[1]] vec, uint k)
D int16 sum(D int16[[1]] vec, uint k)
D int32 sum(D int32[[1]] vec, uint k)
D int sum(D int[[1]] vec, uint k)
D float32 sum(D float32[[1]] vec, uint k)
D float64 sum(D float64[[1]] vec, uint k)