Class DenseConcat

java.lang.Object
org.flag4j.linalg.ops.dense.DenseConcat

public final class DenseConcat extends Object
This utility class provides implementations for the concatenation of dense tensors.
  • Method Details

    • concat

      public static Object[] concat(Object[] src1, Object[] src2, Object[] dest)
      Concatenates two arrays and stores the result in dest.
      Parameters:
      src1 - First array in the concatenation.
      src2 - Second array in the concatenation.
      dest - The array to store the array concatenation in. May be null. If not null, must be at least as large as src1.length + src2.length.
      Returns:
      If dest != null a reference to dest is returned. Otherwise, a new array is created and returned.
      Throws:
      IllegalArgumentException - If dest != null && dest.length < (src1.length + src2.length).
    • repeat

      public static Object[] repeat(Object[] src, int n, int axis, Object[] dest)
      Repeats a vector n times along a certain axis to create a matrix.
      Parameters:
      src - Source array to repeat.
      n - Number of times to repeat the array.
      axis - Axis along which to repeat array:
      • If axis=0, then the vector will be treated as a row vector and stacked vertically n times.
      • If axis=1 then the vector will be treated as a column vector and stacked horizontally n times.
      dest - The array to store the array repeated src array in. May be null. If not null, must be at least as large as src1.length + src2.length.
      Returns:
      If dest != null a reference to dest is returned. Otherwise, a new array is created and returned.
      Throws:
      IllegalArgumentException - If dest != null && dest.length < (src1.length + src2.length).
    • stack

      public static Object[] stack(Object[] src1, Object[] src2, int axis, Object[] dest)

      Stacks two vectors along specified axis.

      Stacking two vectors of length n along axis 0 stacks the vectors as if they were row vectors resulting in a 2&times;n matrix.

      Stacking two vectors of length n along axis 1 stacks the vectors as if they were column vectors resulting in a n&times;2 matrix.

      Parameters:
      src1 - Entries of the first vector. Must be the same size as src2.
      src2 - Entries of the second vector. Must be the same size as src1.
      axis - Axis along which to stack vectors. Must be 1 or 0.
      • If axis=0, then vectors are stacked as if they are row vectors.
      • If axis=1, then vectors are stacked as if they are column vectors.
      dest - Array to store the stacked vectors in. May be null. If not null, must be at least as large as the sum of the src array lengths.
      Returns:
      If dest != null a reference to dest is returned. Otherwise, a new array is created and returned.
      Throws:
      IllegalArgumentException - If src1.length != src2.length.
      IllegalArgumentException - If axis is not either 0 or 1.
      IllegalArgumentException - If dest != null and dest.length < src1.length + src2.length.