org.apache.ignite.ml.math.primitives.matrix.impl

## Class DenseMatrix

- java.lang.Object
- - org.apache.ignite.ml.math.primitives.matrix.AbstractMatrix
  - - org.apache.ignite.ml.math.primitives.matrix.impl.DenseMatrix

- All Implemented Interfaces:
    Externalizable, Serializable, Destroyable, MetaAttributes, Matrix, OrderedMatrix, StorageOpsMetrics

      public class DenseMatrix
      extends AbstractMatrix
      implements OrderedMatrix

  Basic implementation for matrix. This is a trivial implementation for matrix assuming dense logic, local on-heap JVM storage based on `double[][]` array. It is only suitable for data sets where local, non-distributed execution is satisfactory and on-heap JVM storage is enough to keep the entire data set.
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.apache.ignite.ml.math.primitives.matrix.Matrix

      `Matrix.Element`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DenseMatrix()`
    `DenseMatrix(double[][] mtx)`
    `DenseMatrix(double[][] mtx, int acsMode)`
    `DenseMatrix(double[] mtx, int rows)` Build new matrix from flat raw array.
    `DenseMatrix(double[] mtx, int rows, int acsMode)`
    `DenseMatrix(int rows, int cols)`
    `DenseMatrix(int rows, int cols, int acsMode)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `accessMode()` Get access mode.
    `Matrix` | `copy()` Clones this matrix.
    `Matrix` | `like(int rows, int cols)` Creates new empty matrix of the same underlying class but of different size.
    `Vector` | `likeVector(int crd)` Creates new empty vector of compatible properties (similar or the same flavor) to this matrix.

    - ### Methods inherited from class org.apache.ignite.ml.math.primitives.matrix.AbstractMatrix

      `allSpliterator, assign, assign, assign, assign, assignColumn, assignRow, columnSize, compute, density, destroy, determinant, divide, equals, foldColumns, foldMap, foldRows, get, getCol, getElement, getMetaStorage, getRow, getStorage, getX, guid, hashCode, inverse, isArrayBased, isDense, likeIdentity, map, map, maxElement, maxValue, minElement, minus, minValue, nonZeroElements, nonZeroSpliterator, plus, plus, readExternal, rowSize, set, setColumn, setRow, setStorage, setX, storageGet, storageSet, sum, swapColumns, swapRows, times, times, times, toString, transpose, viewColumn, viewDiagonal, viewRow, writeExternal`

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.apache.ignite.ml.math.primitives.matrix.Matrix

      `isNumeric`

    - ### Methods inherited from interface org.apache.ignite.ml.math.MetaAttributes

      `getAttribute, hasAttribute, removeAttribute, setAttribute`

- - ### Constructor Detail

    - #### DenseMatrix

          public DenseMatrix()

    - #### DenseMatrix

          public DenseMatrix(int rows,
                             int cols)

      Parameters:
        `rows` - Amount of rows in matrix.
        `cols` - Amount of columns in matrix.

    - #### DenseMatrix

          public DenseMatrix(int rows,
                             int cols,
                             int acsMode)

      Parameters:
        `rows` - Amount of rows in matrix.
        `cols` - Amount of columns in matrix.
        `acsMode` - Storage order (row or column-based).

    - #### DenseMatrix

          public DenseMatrix(double[][] mtx,
                             int acsMode)

      Parameters:
        `mtx` - Backing data array.
        `acsMode` - Access mode.

    - #### DenseMatrix

          public DenseMatrix(double[][] mtx)

      Parameters:
        `mtx` - Backing data array.

    - #### DenseMatrix

          public DenseMatrix(double[] mtx,
                             int rows,
                             int acsMode)

      Parameters:
        `mtx` - Backing data array.
        `acsMode` - Access mode.

    - #### DenseMatrix

          public DenseMatrix(double[] mtx,
                             int rows)

      Build new matrix from flat raw array.

  - ### Method Detail

    - #### copy

          public Matrix copy()

      Clones this matrix.

      NOTE: new matrix will have the same flavor as the this matrix but a different ID.

      Specified by:
        `copy` in interface `Matrix`
      Overrides:
        `copy` in class `AbstractMatrix`
      Returns:
        New matrix of the same underlying class, the same size and the same values.

    - #### like

          public Matrix like(int rows,
                             int cols)

      Creates new empty matrix of the same underlying class but of different size.

      NOTE: new matrix will have the same flavor as the this matrix but a different ID.

      Specified by:
        `like` in interface `Matrix`
      Parameters:
        `rows` - Number of rows for new matrix.
        `cols` - Number of columns for new matrix.
      Returns:
        New matrix of the same underlying class and size.

    - #### likeVector

          public Vector likeVector(int crd)

      Creates new empty vector of compatible properties (similar or the same flavor) to this matrix.
      Specified by:
        `likeVector` in interface `Matrix`
      Parameters:
        `crd` - Cardinality of the vector.
      Returns:
        Newly created empty vector "compatible" to this matrix.

    - #### accessMode

          public int accessMode()

      Get access mode.
      Specified by:
        `accessMode` in interface `OrderedMatrix`

2021 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.10.0
Release Date | : March 10 2021