Get value directly from memory for contiguous numeric SubArrays.
This is faster than value for contiguous SubArrays but only works
for primitive numeric types.
Check if the SubArray's memory layout is contiguous.
Contiguous SubArrays can be more efficiently converted to TypedArrays.
Total number of elements in the SubArray.
Number of dimensions.
Get the parent array of this SubArray.
Get the parent indices (how this SubArray maps to the parent).
Get pointer to SubArray data if contiguous.
Warning: Only valid for contiguous SubArrays. The pointer becomes invalid if the parent array is garbage collected.
Size (shape) of the SubArray.
Get the SubArray data as a JavaScript array or TypedArray.
Note: For non-contiguous SubArrays, this collects the data first.
Iterate over the SubArray elements.
Collect the SubArray into a contiguous Julia Array.
This is similar to copy() but ensures the result is a standard Array.
Copy SubArray data to a new Array.
Unlike value, this creates a Julia Array rather than a JS array.
Fill the SubArray with a value.
Value to fill with.
Get element at the given linear index (0-based).
Linear index (column-major order).
Get element at the given multi-dimensional indices (0-based).
Indices for each dimension.
Map a function over the SubArray and get a new array.
Julia function to apply.
A new JuliaArray with the mapped values.
Set element at the given linear index (0-based).
Changes propagate to the parent array.
Linear index.
Value to set.
Set element at the given multi-dimensional indices (0-based).
Indices followed by the value.
Create a contiguous view (slice) of elements from start to stop (0-based, inclusive).
Start index (0-based, inclusive).
Stop index (0-based, inclusive).
A new JuliaSubArray.
Create a view (SubArray) of this SubArray with specified indices.
Views can be nested - a view of a view is still a valid SubArray.
Index specifications (same as static view() method).
A new JuliaSubArray.
StaticsliceCreate a contiguous view of elements from start to stop (0-based, inclusive).
This is a convenience method for 1D array views.
The source 1D array.
Start index (0-based, inclusive).
Stop index (0-based, inclusive).
A new JuliaSubArray.
StaticviewCreate a view (SubArray) of an array with specified indices.
The source array.
Index specifications. Can be:
number: Single index (0-based, converted to 1-based for Julia)":": All elements in that dimension (equivalent to Julia's :)[start, stop]: Range (0-based, inclusive)[start, step, stop]: Stepped range (0-based)A new JuliaSubArray.
const arr = JuliaArray.from(new Float64Array([1, 2, 3, 4, 5]));
// View elements 1..3 (0-based indices)
const sub1 = JuliaSubArray.view(arr, [1, 3]);
// View every other element
const sub2 = JuliaSubArray.view(arr, [0, 2, 4]); // step=2
// For multi-dimensional arrays
const matrix = Julia.eval("reshape(1:12, 3, 4)");
const sub3 = JuliaSubArray.view(matrix, ":", 0); // All rows, first column
Wrapper for Julia
SubArray- a view into an existing array.SubArray provides zero-copy access to a portion of an array. Changes to a SubArray are reflected in the parent array and vice versa.
Key Characteristics
Example
Example
Example