Index Module¶
The index module exposes the \(1\)-dimensional indexer utilized in freud at the C++ level.
At the C++ level, freud utilizes “flat” arrays, i.e. an \(n\)-dimensional array with \(n_i\) elements in each index is represented as a \(1\)-dimensional array with \(\prod\limits_i n_i\) elements.
Index2D¶
-
class
freud.index.
Index2D
(*args)¶ freud-style indexer for flat arrays.
freud utilizes “flat” arrays at the C++ level i.e. an \(n\)-dimensional array with \(n_i\) elements in each index is represented as a \(1\)-dimensional array with \(\prod\limits_i n_i\) elements.
Note
freud indexes column-first i.e. Index2D(i, j) will return the \(1\)-dimensional index of the \(i^{th}\) column and the \(j^{th}\) row. This is the opposite of what occurs in a numpy array, in which array[i, j] returns the element in the \(i^{th}\) row and the \(j^{th}\) column
Module author: Joshua Anderson <joaander@umich.edu>
Parameters: - w (unsigned int) – width of 2D array (number of columns)
- h (unsigned int) – height of 2D array (number of rows)
Constructor Calls:
Initialize with all dimensions identical:
freud.index.Index2D(w)
Initialize with each dimension specified:
freud.index.Index2D(w, h)
-
__call__
(self, i, j)¶ Parameters: - i (unsigned int) – column index
- j (unsigned int) – row index
Returns: \(1\)-dimensional index in flat array
Return type: unsigned int
-
getNumElements
(self)¶ Returns: number of elements in the array Return type: unsigned int
-
num_elements
¶ return – number of elements in the array :rtype: unsigned int
Index3D¶
-
class
freud.index.
Index3D
(*args)¶ freud-style indexer for flat arrays.
freud utilizes “flat” arrays at the C++ level i.e. an \(n\)-dimensional array with \(n_i\) elements in each index is represented as a \(1\)-dimensional array with \(\prod\limits_i n_i\) elements.
Note
freud indexes column-first i.e. Index3D(i, j, k) will return the \(1\)-dimensional index of the \(i^{th}\) column, \(j^{th}\) row, and the \(k^{th}\) frame. This is the opposite of what occurs in a numpy array, in which array[i, j, k] returns the element in the \(i^{th}\) frame, \(j^{th}\) row, and the \(k^{th}\) column.
Module author: Joshua Anderson <joaander@umich.edu>
Parameters: - w (unsigned int) – width of 2D array (number of columns)
- h (unsigned int) – height of 2D array (number of rows)
- d (unsigned int) – depth of 2D array (number of frames)
Constructor Calls:
Initialize with all dimensions identical:
freud.index.Index3D(w)
Initialize with each dimension specified:
freud.index.Index3D(w, h, d)
-
__call__
(self, i, j, k)¶ Parameters: - i (unsigned int) – column index
- j (unsigned int) – row index
- k (unsigned int) – frame index
Returns: \(1\)-dimensional index in flat array
Return type: unsigned int
-
getNumElements
(self)¶ Returns: number of elements in the array Return type: unsigned int
-
num_elements
¶ return – number of elements in the array :rtype: unsigned int