Package gnu.kawa.functions
Class Arrays
- java.lang.Object
-
- gnu.kawa.functions.Arrays
-
public class Arrays extends Object
Static methods for implementing Scheme (SRFI-25) arrays.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Arrays.BuiltArray<E>
Class for implementing computed (virtual) array.static class
Arrays.ProcTransformedArray<E>
General array "view" class using a Procedure index transformer.
-
Constructor Summary
Constructors Constructor Description Arrays()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static GeneralArray
allocateArray(Array shape)
Convenience method for resolving shape specifiers.static <E> Array<E>
getBuiltArray(Array shape, Procedure getter)
static <E> Array<E>
getBuiltArray(Array shape, Procedure getter, Procedure setter)
static <E> Array<E>
getTransformed(Array<E> base, Procedure transformer, Array shape)
static int[]
handleShapeSpecifier(Array shape, int rank, int[] dimensions, boolean toShape)
Process a shape specifier.static Array
makeFromSimple(int[] dimensions, int[] lowBounds, Object buffer, PrimType elementType)
static Array
makeFromValues(Array shape, Object[] values)
static Array
makeSimple(Array shape, SimpleVector base)
static Array
shape(Object[] vals)
Convert a sequence of (lower,upper) bounds to a SRFI-25 shape.static Array
shareArray(Array array, Array shape, Procedure proc)
-
-
-
Method Detail
-
shape
public static Array shape(Object[] vals)
Convert a sequence of (lower,upper) bounds to a SRFI-25 shape.
-
handleShapeSpecifier
public static int[] handleShapeSpecifier(Array shape, int rank, int[] dimensions, boolean toShape)
Process a shape specifier.- Parameters:
shape
- A canonical shape (rank*2 array) or a shape specifier (vector whose length is the rank).rank
- The rank of arrays of that shape.dimensions
- Ignored if toShape. Otherwise, must have length==rank, and is modified with (hi-lo).toShape
- : True if used by->shape
.- Returns:
- If toShape: a rank*2 shape array as an int[]; otherwise: vector of low-bounds (or null if all zero).
-
allocateArray
public static GeneralArray allocateArray(Array shape)
Convenience method for resolving shape specifiers.
-
makeFromSimple
public static Array makeFromSimple(int[] dimensions, int[] lowBounds, Object buffer, PrimType elementType)
-
makeSimple
public static Array makeSimple(Array shape, SimpleVector base)
-
shareArray
public static Array shareArray(Array array, Array shape, Procedure proc) throws Throwable
- Throws:
Throwable
-
getBuiltArray
public static <E> Array<E> getBuiltArray(Array shape, Procedure getter, Procedure setter)
-
-