Mordicus.Core.BasicAlgorithms.Interpolation module¶
- Mordicus.Core.BasicAlgorithms.Interpolation.BinarySearch(orderedList, item)[source]¶
- Inspects the sorted list “ordered_list” and returns:
0 if item <= orderedList[0]
the rank of the largest element smaller or equal than item otherwise
- Parameters
ordered_list (list or one-dimensional np.ndarray) – the data sorted in increasing order from which the previous rank is searched
item (float or int) – the item for which the previous rank is searched
- Returns
0 or the rank of the largest element smaller or equal than item in “orderedList”
- Return type
int
- Mordicus.Core.BasicAlgorithms.Interpolation.BinarySearchVectorized(orderedList, items)[source]¶
BinarySearch for more than one call (items is now a list or one-dimensional np.ndarray)
- Mordicus.Core.BasicAlgorithms.Interpolation.PieceWiseLinearInterpolation(item, itemIndices, vectors)[source]¶
Computes a item interpolation for temporal vectors defined either by itemIndices and vectors at these indices
- Parameters
item (float) – the input item at which the interpolation is required
itemIndices (np.ndarray) – the items where the available data is defined, of size (numberOfTimeIndices)
vectors (np.ndarray or dict) – the available data, of size (numberOfVectors, numberOfDofs)
- Returns
interpolated vector, of size (numberOfDofs)
- Return type
np.ndarray
- Mordicus.Core.BasicAlgorithms.Interpolation.PieceWiseLinearInterpolationVectorized(items, itemIndices, vectors)[source]¶
PieceWiseLinearInterpolation for more than one call (items is now a list or one-dimensional np.ndarray)
- Mordicus.Core.BasicAlgorithms.Interpolation.PieceWiseLinearInterpolationVectorizedWithMap(items, itemIndices, vectors, vectorsMap)[source]¶
PieceWiseLinearInterpolation for more than one call (items is now a list or one-dimensional np.ndarray)
- Mordicus.Core.BasicAlgorithms.Interpolation.PieceWiseLinearInterpolationWithMap(item, itemIndices, vectors, vectorsMap)[source]¶
Computes a item interpolation for temporal vectors defined either by itemIndices, some tags at these item indices (vectorsMap), and vectors at those tags.
- Parameters
item (float) – the input item at which the interpolation is required
itemIndices (np.ndarray) – the items where the available data is defined, of size (numberOfTimeIndices)
vectors (np.ndarray or dict) – the available data, of size (numberOfVectors, numberOfDofs)
vectorsMap (list) – list containing the mapping from the numberOfTimeIndices items indices to the numberOfVectors vectors, of size (numberOfTimeIndices,). Default is None, in which case numberOfVectors = numberOfTimeIndices.
- Returns
interpolated vector, of size (numberOfDofs)
- Return type
np.ndarray