org.eclipse.january.dataset

## Class DatasetFactory

- java.lang.Object
- - org.eclipse.january.dataset.DatasetFactory

-     public class DatasetFactory
      extends Object

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DatasetFactory()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <T extends CompoundDataset> T` | `compoundZeros(int itemSize, Class<T> clazz, int... shape)`
    `static CompoundDataset` | `compoundZeros(int itemSize, int[] shape, int dtype)` Deprecated. Please use the class-based methods in DatasetFactory, such as `#compoundZeros(int, Class, int)`
    `static <T extends Dataset> T` | `createComplexDataset(Class<T> clazz, Object real, Object imag)` Create complex dataset of given class from real and imaginary parts
    `static CompoundDataset` | `createComplexDataset(int dtype, Object real, Object imag)` Deprecated. Please use the class-based methods in DatasetFactory, such as `createComplexDataset(Class, Object, Object)`
    `static <T extends Dataset> T` | `createCompoundDataset(Class<T> clazz, Object... objects)` Create compound dataset of given class from given parts
    `static CompoundDataset` | `createCompoundDataset(int dtype, Object... objects)` Deprecated. Please use the class-based methods in DatasetFactory, such as `createCompoundDataset(Class, Object...)`
    `static CompoundDataset` | `createCompoundDataset(Object... objects)` Create compound dataset of given type from given parts
    `static <T extends Dataset> T` | `createFromList(Class<T> clazz, List<?> objectList)` Create dataset of given class from list
    `static Dataset` | `createFromList(int dtype, List<?> objectList)` Deprecated. Please use the class-based methods in DatasetFactory, such as `createFromList(Class, List<?>)`
    `static Dataset` | `createFromList(List<?> objectList)` Create dataset of appropriate type from list
    `static Dataset` | `createFromObject(boolean isUnsigned, Object obj)` Create a dataset from object (automatically detect dataset type)
    `static <T extends Dataset> T` | `createFromObject(Class<T> clazz, Object obj, int... shape)` Create a dataset from object
    `static <T extends Dataset> T` | `createFromObject(int itemSize, Class<T> clazz, Object obj, int... shape)` Create a compound dataset from object
    `static Dataset` | `createFromObject(int itemSize, int dtype, Object obj, int... shape)` Deprecated. Please use the class-based methods in DatasetFactory, such as `createFromObject(int, Class, Object, int...)`
    `static Dataset` | `createFromObject(int dtype, Object obj)` Deprecated. Please use the class-based methods in DatasetFactory, such as `#createFromObject(Class, Object, int)`
    `static Dataset` | `createFromObject(int dtype, Object obj, int... shape)` Deprecated. Please use the class-based methods in DatasetFactory, such as `createFromObject(Class, Object, int...)`
    `static Dataset` | `createFromObject(Object obj)` Create a dataset from object (automatically detect dataset type)
    `static Dataset` | `createFromObject(Object obj, int... shape)` Create a dataset from object (automatically detect dataset type)
    `static <T extends Dataset> T` | `createLinearSpace(Class<T> clazz, double start, double stop, int length)` Create a 1D dataset of linearly spaced values in closed interval
    `static Dataset` | `createLinearSpace(double start, double stop, int length, int dtype)` Deprecated. Please use the class-based methods in DatasetFactory, such as `createLinearSpace(Class, double, double, int)`
    `static <T extends Dataset> T` | `createLogSpace(Class<T> clazz, double start, double stop, int length, double base)` Create a 1D dataset of logarithmically spaced values in closed interval.
    `static Dataset` | `createLogSpace(double start, double stop, int length, double base, int dtype)` Deprecated. Please use the class-based methods in DatasetFactory, such as `createLogSpace(Class, double, double, int, double)`
    `static <T extends Dataset> T` | `createRange(Class<T> clazz, double stop)` Create dataset with items ranging from 0 to given stop in steps of 1
    `static <T extends Dataset> T` | `createRange(Class<T> clazz, double start, double stop, double step)` Create dataset with items ranging from given start to given stop in given steps
    `static DoubleDataset` | `createRange(double stop)` Create dataset with items ranging from 0 to given stop in steps of 1
    `static Dataset` | `createRange(double start, double stop, double step, int dtype)` Deprecated. Please use the class-based methods in DatasetFactory, such as `createRange(Class, double, double, double)`
    `static Dataset` | `createRange(double stop, int dtype)` Deprecated. Please use the class-based methods in DatasetFactory, such as `createRange(Class, double)`
    `static CompoundDataset` | `createRange(int itemSize, double start, double stop, double step, int dtype)` Deprecated. Please use the class-based methods in DatasetFactory, such as `createRange(Class, double, double, double)`
    `static CompoundDataset` | `createRange(int itemSize, double stop, int dtype)` Deprecated. Please use the class-based methods in DatasetFactory, such as `createRange(Class, double, double, double)`
    `static <T extends Dataset> T` | `ones(Class<T> clazz, int... shape)`
    `static <T extends Dataset> T` | `ones(Dataset dataset, Class<T> clazz)`
    `static Dataset` | `ones(Dataset dataset, int dtype)` Deprecated. Please use the class-based methods in DatasetFactory, such as `createRange(Class, double, double, double)`
    `static DoubleDataset` | `ones(int... shape)`
    `static Dataset` | `ones(int[] shape, int dtype)` Deprecated. Please use the class-based methods in DatasetFactory, such as `#ones(int[], Class)`
    `static <T extends Dataset> T` | `ones(int itemSize, Class<T> clazz, int... shape)`
    `static Dataset` | `ones(int itemSize, int[] shape, int dtype)` Deprecated. Please use the class-based methods in DatasetFactory, such as `ones(Class, int...)`
    `static <T extends Dataset> T` | `ones(T dataset)`
    `static <T extends Dataset> T` | `zeros(Class<T> clazz, int... shape)`
    `static <T extends Dataset> T` | `zeros(Dataset dataset, Class<T> clazz)`
    `static Dataset` | `zeros(Dataset dataset, int dtype)` Deprecated. Please use the class-based methods in DatasetFactory, such as `zeros(Dataset, Class)`
    `static DoubleDataset` | `zeros(int... shape)`
    `static Dataset` | `zeros(int[] shape, int dtype)` Deprecated. Please use the class-based methods in DatasetFactory, such as `zeros(Class, int...)`
    `static <T extends Dataset> T` | `zeros(int itemSize, Class<T> clazz, int... shape)`
    `static Dataset` | `zeros(int itemSize, int[] shape, int dtype)` Deprecated. Please use the class-based methods in DatasetFactory, such as `zeros(int, Class, int...)`
    `static <T extends Dataset> T` | `zeros(T dataset)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DatasetFactory

          public DatasetFactory()

  - ### Method Detail

    - #### createRange

          public static DoubleDataset createRange(double stop)

      Create dataset with items ranging from 0 to given stop in steps of 1
      Parameters:
        `stop` -
      Returns:
        a new double dataset of given shape and type, filled with values determined by parameters

    - #### createRange

          @Deprecated
          public static Dataset createRange(double stop,
                                       int dtype)

      Deprecated. Please use the class-based methods in DatasetFactory, such as `createRange(Class, double)`
      Create dataset with items ranging from 0 to given stop in steps of 1
      Parameters:
        `stop` -
        `dtype` -
      Returns:
        a new dataset of given shape and type, filled with values determined by parameters

    - #### createRange

          @Deprecated
          public static Dataset createRange(double start,
                                       double stop,
                                       double step,
                                       int dtype)

      Deprecated. Please use the class-based methods in DatasetFactory, such as `createRange(Class, double, double, double)`
      Create dataset with items ranging from given start to given stop in given steps
      Parameters:
        `start` -
        `stop` -
        `step` - spacing between items
        `dtype` -
      Returns:
        a new 1D dataset of given type, filled with values determined by parameters

    - #### createRange

          @Deprecated
          public static CompoundDataset createRange(int itemSize,
                                               double stop,
                                               int dtype)

      Deprecated. Please use the class-based methods in DatasetFactory, such as `createRange(Class, double, double, double)`
      Create compound dataset with items of given size ranging from 0 to given stop in steps of 1
      Parameters:
        `itemSize` -
        `stop` -
        `dtype` -
      Returns:
        a new dataset of given shape and type, filled with values determined by parameters

    - #### createRange

          @Deprecated
          public static CompoundDataset createRange(int itemSize,
                                               double start,
                                               double stop,
                                               double step,
                                               int dtype)

      Deprecated. Please use the class-based methods in DatasetFactory, such as `createRange(Class, double, double, double)`
      Create compound dataset with items of given size ranging from given start to given stop in given steps
      Parameters:
        `itemSize` -
        `start` -
        `stop` -
        `step` - spacing between items
        `dtype` -
      Returns:
        a new 1D dataset of given type, filled with values determined by parameters

    - #### createFromObject

          public static Dataset createFromObject(Object obj)

      Create a dataset from object (automatically detect dataset type)
      Parameters:
        `obj` - can be Java list, array or Number
      Returns:
        dataset

    - #### createFromObject

          public static Dataset createFromObject(Object obj,
                                 int... shape)

      Create a dataset from object (automatically detect dataset type)
      Parameters:
        `obj` - can be Java list, array or Number
        `shape` - can be null
      Returns:
        dataset

    - #### createFromObject

          public static Dataset createFromObject(boolean isUnsigned,
                                 Object obj)

      Create a dataset from object (automatically detect dataset type)
      Parameters:
        `isUnsigned` - if true, interpret integer values as unsigned by increasing element bit width
        `obj` - can be a Java list, array or Number
      Returns:
        dataset

    - #### createFromObject

          @Deprecated
          public static Dataset createFromObject(int dtype,
                                            Object obj)

      Deprecated. Please use the class-based methods in DatasetFactory, such as `#createFromObject(Class, Object, int)`
      Create a dataset from object
      Parameters:
        `dtype` -
        `obj` - can be a Java list, array or Number
      Returns:
        dataset
      Throws:
        `IllegalArgumentException` - if dataset type is not known

    - #### createFromObject

          @Deprecated
          public static Dataset createFromObject(int dtype,
                                            Object obj,
                                            int... shape)

      Deprecated. Please use the class-based methods in DatasetFactory, such as `createFromObject(Class, Object, int...)`
      Create a dataset from object
      Parameters:
        `dtype` -
        `obj` - can be a Java list, array or Number
        `shape` - can be null
      Returns:
        dataset
      Throws:
        `IllegalArgumentException` - if dataset type is not known

    - #### createFromObject

          @Deprecated
          public static Dataset createFromObject(int itemSize,
                                            int dtype,
                                            Object obj,
                                            int... shape)

      Deprecated. Please use the class-based methods in DatasetFactory, such as `createFromObject(int, Class, Object, int...)`
      Create a dataset from object
      Parameters:
        `itemSize` -
        `dtype` -
        `obj` - can be a Java list, array or Number
        `shape` - can be null
      Returns:
        dataset
      Throws:
        `IllegalArgumentException` - if dataset type is not known

    - #### createFromList

          public static Dataset createFromList(List<?> objectList)

      Create dataset of appropriate type from list
      Parameters:
        `objectList` -
      Returns:
        dataset filled with values from list

    - #### createFromList

          @Deprecated
          public static Dataset createFromList(int dtype,
                                          List<?> objectList)

      Deprecated. Please use the class-based methods in DatasetFactory, such as `createFromList(Class, List<?>)`
      Create dataset of given type from list
      Parameters:
        `dtype` -
        `objectList` -
      Returns:
        dataset filled with values from list

    - #### createCompoundDataset

          public static CompoundDataset createCompoundDataset(Object... objects)

      Create compound dataset of given type from given parts
      Parameters:
        `objects` -
      Returns:
        compound dataset

    - #### createCompoundDataset

          @Deprecated
          public static CompoundDataset createCompoundDataset(int dtype,
                                                         Object... objects)

      Deprecated. Please use the class-based methods in DatasetFactory, such as `createCompoundDataset(Class, Object...)`
      Create compound dataset of given type from given parts
      Parameters:
        `dtype` -
        `objects` -
      Returns:
        compound dataset

    - #### createComplexDataset

          @Deprecated
          public static CompoundDataset createComplexDataset(int dtype,
                                                        Object real,
                                                        Object imag)

      Deprecated. Please use the class-based methods in DatasetFactory, such as `createComplexDataset(Class, Object, Object)`
      Create complex dataset of given type from real and imaginary parts
      Parameters:
        `dtype` -
        `real` -
        `imag` -
      Returns:
        complex dataset

    - #### zeros

          public static DoubleDataset zeros(int... shape)

      Parameters:
        `shape` -
      Returns:
        a new double dataset of given shape, filled with zeros

    - #### zeros

          @Deprecated
          public static Dataset zeros(int[] shape,
                                 int dtype)

      Deprecated. Please use the class-based methods in DatasetFactory, such as `zeros(Class, int...)`
      Parameters:
        `shape` -
        `dtype` -
      Returns:
        a new dataset of given shape and type, filled with zeros

    - #### zeros

          @Deprecated
          public static Dataset zeros(int itemSize,
                                 int[] shape,
                                 int dtype)

      Deprecated. Please use the class-based methods in DatasetFactory, such as `zeros(int, Class, int...)`
      Parameters:
        `itemSize` - if equal to 1, then non-compound dataset is returned
        `shape` -
        `dtype` -
      Returns:
        a new dataset of given item size, shape and type, filled with zeros

    - #### compoundZeros

          @Deprecated
          public static CompoundDataset compoundZeros(int itemSize,
                                                 int[] shape,
                                                 int dtype)

      Deprecated. Please use the class-based methods in DatasetFactory, such as `#compoundZeros(int, Class, int)`
      Parameters:
        `itemSize` -
        `shape` -
        `dtype` -
      Returns:
        a new dataset of given item size, shape and type, filled with zeros
      Since:
        2.0

    - #### zeros

          public static <T extends Dataset> T zeros(T dataset)

      Parameters:
        `dataset` -
      Returns:
        a new dataset of same shape and type as input dataset, filled with zeros

    - #### zeros

          @Deprecated
          public static Dataset zeros(Dataset dataset,
                                 int dtype)

      Deprecated. Please use the class-based methods in DatasetFactory, such as `zeros(Dataset, Class)`
      Create a new dataset of same shape as input dataset, filled with zeros. If dtype is not explicitly compound then an elemental dataset is created
      Parameters:
        `dataset` -
        `dtype` -
      Returns:
        a new dataset

    - #### ones

          public static <T extends Dataset> T ones(T dataset)

      Parameters:
        `dataset` -
      Returns:
        a new dataset of same shape and type as input dataset, filled with ones

    - #### ones

          @Deprecated
          public static Dataset ones(Dataset dataset,
                                int dtype)

      Deprecated. Please use the class-based methods in DatasetFactory, such as `createRange(Class, double, double, double)`
      Create a new dataset of same shape as input dataset, filled with ones. If dtype is not explicitly compound then an elemental dataset is created
      Parameters:
        `dataset` -
        `dtype` -
      Returns:
        a new dataset

    - #### ones

          public static DoubleDataset ones(int... shape)

      Parameters:
        `shape` -
      Returns:
        a new double dataset of given shape, filled with ones

    - #### ones

          @Deprecated
          public static Dataset ones(int[] shape,
                                int dtype)

      Deprecated. Please use the class-based methods in DatasetFactory, such as `#ones(int[], Class)`
      Parameters:
        `shape` -
        `dtype` -
      Returns:
        a new dataset of given shape and type, filled with ones

    - #### ones

          @Deprecated
          public static Dataset ones(int itemSize,
                                int[] shape,
                                int dtype)

      Deprecated. Please use the class-based methods in DatasetFactory, such as `ones(Class, int...)`
      Parameters:
        `itemSize` - if equal to 1, then non-compound dataset is returned
        `shape` -
        `dtype` -
      Returns:
        a new dataset of given item size, shape and type, filled with ones

    - #### createLinearSpace

          @Deprecated
          public static Dataset createLinearSpace(double start,
                                             double stop,
                                             int length,
                                             int dtype)

      Deprecated. Please use the class-based methods in DatasetFactory, such as `createLinearSpace(Class, double, double, int)`
      Create a 1D dataset of linearly spaced values in closed interval
      Parameters:
        `start` -
        `stop` -
        `length` - number of points
        `dtype` -
      Returns:
        dataset with linearly spaced values

    - #### createLogSpace

          @Deprecated
          public static Dataset createLogSpace(double start,
                                          double stop,
                                          int length,
                                          double base,
                                          int dtype)

      Deprecated. Please use the class-based methods in DatasetFactory, such as `createLogSpace(Class, double, double, int, double)`
      Create a 1D dataset of logarithmically spaced values in closed interval. The base value is used to determine the factor between values: factor = base ** step, where step is the interval between linearly spaced sequence of points
      Parameters:
        `start` -
        `stop` -
        `length` - number of points
        `base` -
        `dtype` -
      Returns:
        dataset with logarithmically spaced values

    - #### createRange

          public static <T extends Dataset> T createRange(Class<T> clazz,
                                          double stop)

      Create dataset with items ranging from 0 to given stop in steps of 1
      Parameters:
        `clazz` -
        `stop` -
      Returns:
        a new dataset of given shape and type, filled with values determined by parameters

    - #### createRange

          public static <T extends Dataset> T createRange(Class<T> clazz,
                                          double start,
                                          double stop,
                                          double step)

      Create dataset with items ranging from given start to given stop in given steps
      Parameters:
        `clazz` - dataset class
        `start` -
        `stop` -
        `step` - spacing between items
      Returns:
        a new 1D dataset of given class, filled with values determined by parameters

    - #### createFromObject

          public static <T extends Dataset> T createFromObject(Class<T> clazz,
                                               Object obj,
                                               int... shape)

      Create a dataset from object
      Parameters:
        `clazz` - dataset class
        `obj` - can be a Java list, array or Number
        `shape` - can be null
      Returns:
        dataset
      Throws:
        `IllegalArgumentException` - if dataset type is not known

    - #### createFromObject

          public static <T extends Dataset> T createFromObject(int itemSize,
                                               Class<T> clazz,
                                               Object obj,
                                               int... shape)

      Create a compound dataset from object
      Parameters:
        `itemSize` -
        `clazz` - dataset class
        `obj` - can be a Java list, array or Number
        `shape` - can be null
      Returns:
        dataset
      Throws:
        `IllegalArgumentException` - if dataset type is not known

    - #### createFromList

          public static <T extends Dataset> T createFromList(Class<T> clazz,
                                             List<?> objectList)

      Create dataset of given class from list
      Parameters:
        `clazz` - dataset class
        `objectList` -
      Returns:
        dataset filled with values from list

    - #### createCompoundDataset

          public static <T extends Dataset> T createCompoundDataset(Class<T> clazz,
                                                    Object... objects)

      Create compound dataset of given class from given parts
      Parameters:
        `clazz` -
        `objects` -
      Returns:
        compound dataset

    - #### createComplexDataset

          public static <T extends Dataset> T createComplexDataset(Class<T> clazz,
                                                   Object real,
                                                   Object imag)

      Create complex dataset of given class from real and imaginary parts
      Parameters:
        `clazz` - dataset class
        `real` -
        `imag` -
      Returns:
        complex dataset

    - #### zeros

          public static <T extends Dataset> T zeros(Class<T> clazz,
                                    int... shape)

      Parameters:
        `clazz` - dataset class
        `shape` -
      Returns:
        a new dataset of given shape and class, filled with zeros

    - #### zeros

          public static <T extends Dataset> T zeros(int itemSize,
                                    Class<T> clazz,
                                    int... shape)

      Parameters:
        `itemSize` - if equal to 1, then non-compound dataset is returned
        `clazz` - dataset class
        `shape` -
      Returns:
        a new dataset of given item size, shape and class, filled with zeros

    - #### zeros

          public static <T extends Dataset> T zeros(Dataset dataset,
                                    Class<T> clazz)

      Parameters:
        `dataset` -
        `clazz` - dataset class
      Returns:
        a new dataset of given class with same shape as input dataset, filled with zeros

    - #### compoundZeros

          public static <T extends CompoundDataset> T compoundZeros(int itemSize,
                                                    Class<T> clazz,
                                                    int... shape)

      Parameters:
        `itemSize` -
        `clazz` - compound dataset class
        `shape` -
      Returns:
        a new compound dataset of given item size, shape and class, filled with zeros
      Since:
        2.0

    - #### ones

          public static <T extends Dataset> T ones(Class<T> clazz,
                                   int... shape)

      Parameters:
        `clazz` - dataset class
        `shape` -
      Returns:
        a new dataset of given shape and class, filled with ones

    - #### ones

          public static <T extends Dataset> T ones(int itemSize,
                                   Class<T> clazz,
                                   int... shape)

      Parameters:
        `itemSize` - if equal to 1, then non-compound dataset is returned
        `clazz` - dataset class
        `shape` -
      Returns:
        a new dataset of given item size, shape and class, filled with ones

    - #### ones

          public static <T extends Dataset> T ones(Dataset dataset,
                                   Class<T> clazz)

      Parameters:
        `dataset` -
        `clazz` - dataset class
      Returns:
        a new dataset of given class with same shape as input dataset, filled with ones

    - #### createLinearSpace

          public static <T extends Dataset> T createLinearSpace(Class<T> clazz,
                                                double start,
                                                double stop,
                                                int length)

      Create a 1D dataset of linearly spaced values in closed interval
      Parameters:
        `clazz` - dataset class
        `start` -
        `stop` -
        `length` - number of points
      Returns:
        dataset with linearly spaced values

    - #### createLogSpace

          public static <T extends Dataset> T createLogSpace(Class<T> clazz,
                                             double start,
                                             double stop,
                                             int length,
                                             double base)

      Create a 1D dataset of logarithmically spaced values in closed interval. The base value is used to determine the factor between values: factor = base ** step, where step is the interval between linearly spaced sequence of points
      Parameters:
        `start` -
        `stop` -
        `length` - number of points
        `base` -
      Returns:
        dataset with logarithmically spaced values

Copyright © 2017. All rights reserved.