aerosandbox.numpy.array
#
Module Contents#
Functions#
|
Initializes a new array. Creates a NumPy array if possible; if not, creates a CasADi array. |
|
Join a sequence of arrays along an existing axis. Returns a NumPy array if possible; if not, returns a CasADi array. |
|
Join a sequence of arrays along a new axis. Returns a NumPy array if possible; if not, returns a CasADi array. |
|
|
|
|
|
|
|
Returns the length of an 1D-array-like object. An extension of len() with slightly different functionality. |
|
Extract a diagonal or construct a diagonal array. |
|
Roll array elements along a given axis. |
|
Return the maximum of an array or maximum along an axis. |
|
Return the minimum of an array or minimum along an axis. |
|
Gives a new shape to an array without changing its data. |
|
Returns a contiguous flattened array. |
|
Construct an array by repeating A the number of times given by reps. |
|
Return an array of zeros with the same shape and type as a given array. |
|
Return an array of ones with the same shape and type as a given array. |
|
Return a new array with the same shape and type as a given array. |
|
Return a full array with the same shape and type as a given array. |
|
Assert that all of the given arrays are the same shape. If this is not true, raise a ValueError. |
- aerosandbox.numpy.array.array(array_like, dtype=None)[source]#
Initializes a new array. Creates a NumPy array if possible; if not, creates a CasADi array.
See syntax here: https://numpy.org/doc/stable/reference/generated/numpy.array.html
- aerosandbox.numpy.array.concatenate(arrays, axis=0)[source]#
Join a sequence of arrays along an existing axis. Returns a NumPy array if possible; if not, returns a CasADi array.
See syntax here: https://numpy.org/doc/stable/reference/generated/numpy.concatenate.html
- Parameters:
arrays (Sequence) –
axis (int) –
- aerosandbox.numpy.array.stack(arrays, axis=0)[source]#
Join a sequence of arrays along a new axis. Returns a NumPy array if possible; if not, returns a CasADi array.
See syntax here: https://numpy.org/doc/stable/reference/generated/numpy.stack.html
- Parameters:
arrays (Sequence) –
axis (int) –
- aerosandbox.numpy.array.length(array)[source]#
Returns the length of an 1D-array-like object. An extension of len() with slightly different functionality. :param array:
Returns:
- Return type:
int
- aerosandbox.numpy.array.diag(v, k=0)[source]#
Extract a diagonal or construct a diagonal array.
See syntax here: https://numpy.org/doc/stable/reference/generated/numpy.diag.html
- aerosandbox.numpy.array.roll(a, shift, axis=None)[source]#
Roll array elements along a given axis.
Elements that roll beyond the last position are re-introduced at the first.
See syntax here: https://numpy.org/doc/stable/reference/generated/numpy.roll.html
- Parameters:
a (array_like) – Input array.
shift (int or tuple of ints) – The number of places by which elements are shifted. If a tuple, then axis must be a tuple of the same size, and each of the given axes is shifted by the corresponding number. If an int while axis is a tuple of ints, then the same value is used for all given axes.
axis (int or tuple of ints, optional) – Axis or axes along which elements are shifted. By default, the array is flattened before shifting, after which the original shape is restored.
- Returns:
res – Output array, with the same shape as a.
- Return type:
ndarray
- aerosandbox.numpy.array.max(a, axis=None)[source]#
Return the maximum of an array or maximum along an axis.
See syntax here: https://numpy.org/doc/stable/reference/generated/numpy.max.html
- aerosandbox.numpy.array.min(a, axis=None)[source]#
Return the minimum of an array or minimum along an axis.
See syntax here: https://numpy.org/doc/stable/reference/generated/numpy.min.html
- aerosandbox.numpy.array.reshape(a, newshape, order='C')[source]#
Gives a new shape to an array without changing its data.
See syntax here: https://numpy.org/doc/stable/reference/generated/numpy.reshape.html
- aerosandbox.numpy.array.ravel(a, order='C')[source]#
Returns a contiguous flattened array.
See syntax here: https://numpy.org/doc/stable/reference/generated/numpy.ravel.html
- aerosandbox.numpy.array.tile(A, reps)[source]#
Construct an array by repeating A the number of times given by reps.
See syntax here: https://numpy.org/doc/stable/reference/generated/numpy.tile.html
- aerosandbox.numpy.array.zeros_like(a, dtype=None, order='K', subok=True, shape=None)[source]#
Return an array of zeros with the same shape and type as a given array.
- aerosandbox.numpy.array.ones_like(a, dtype=None, order='K', subok=True, shape=None)[source]#
Return an array of ones with the same shape and type as a given array.
- aerosandbox.numpy.array.empty_like(prototype, dtype=None, order='K', subok=True, shape=None)[source]#
Return a new array with the same shape and type as a given array.
- aerosandbox.numpy.array.full_like(a, fill_value, dtype=None, order='K', subok=True, shape=None)[source]#
Return a full array with the same shape and type as a given array.
- aerosandbox.numpy.array.assert_equal_shape(arrays)[source]#
Assert that all of the given arrays are the same shape. If this is not true, raise a ValueError.
Args: arrays: The arrays to be evaluated.
Can be provided as a:
List, in which case a generic ValueError is thrown
Dictionary consisting of name:array pairs for key:value, in which case the names are given in the ValueError.
Returns: None. Throws an error if leng
- Parameters:
arrays (Union[List[numpy.ndarray], Dict[str, numpy.ndarray]]) –
- Return type:
None