Class Arrays

java.lang.Object
gnu.kawa.functions.Arrays

public class Arrays extends Object
Static methods for implementing Scheme (SRFI-25) arrays.
  • Constructor Details

    • Arrays

      public Arrays()
  • Method Details

    • 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.
    • makeFromValues

      public static Array makeFromValues(Array shape, Object[] values)
    • 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)
    • getBuiltArray

      public static <E> Array<E> getBuiltArray(Array shape, Procedure getter, Procedure setter)
    • getTransformed

      public static <E> Array<E> getTransformed(Array<E> base, Procedure transformer, Array shape)