org.apache.ignite.ml.math.primitives.vector.storage

## Class VectorizedViewMatrixStorage

- java.lang.Object
- - org.apache.ignite.ml.math.primitives.vector.storage.VectorizedViewMatrixStorage

- All Implemented Interfaces:
    Externalizable, Serializable, Destroyable, VectorStorage, StorageOpsMetrics

      public class VectorizedViewMatrixStorage
      extends Object
      implements VectorStorage

  Row, column or diagonal vector-based view of the matrix
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `VectorizedViewMatrixStorage()`
    `VectorizedViewMatrixStorage(Matrix parent, int row, int col, int rowStride, int colStride)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `double[]` | `data()` Gets underlying array if `StorageOpsMetrics.isArrayBased()` returns `true` and all values in vector are Numbers.
    `double` | `get(int i)` Gets element from vector by index and cast it to double.
    `<T extends Serializable> T` | `getRaw(int i)`
    `boolean` | `isArrayBased()` Checks if implementation is based on Java arrays.
    `boolean` | `isDense()` Checks if this implementation should be considered dense so that it explicitly represents every value.
    `boolean` | `isNumeric()`
    `void` | `readExternal(ObjectInput in)`
    `void` | `set(int i, double v)`
    `void` | `setRaw(int i, Serializable v)`
    `int` | `size()`
    `void` | `writeExternal(ObjectOutput out)`

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

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

    - ### Methods inherited from interface org.apache.ignite.ml.math.primitives.vector.VectorStorage

      `rawData`

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

      `destroy`

- - ### Constructor Detail

    - #### VectorizedViewMatrixStorage

          public VectorizedViewMatrixStorage()

    - #### VectorizedViewMatrixStorage

          public VectorizedViewMatrixStorage(Matrix parent,
                                             int row,
                                             int col,
                                             int rowStride,
                                             int colStride)

      Parameters:
        `parent` - Parent matrix.
        `row` - Starting row in the view.
        `col` - Starting column in the view.
        `rowStride` - Rows stride in the view.
        `colStride` - Columns stride in the view.

  - ### Method Detail

    - #### size

          public int size()

      Specified by:
        `size` in interface `VectorStorage`

    - #### get

          public double get(int i)

      Gets element from vector by index and cast it to double.
      Specified by:
        `get` in interface `VectorStorage`
      Parameters:
        `i` - Vector element index.
      Returns:
        Value obtained for given element index.

    - #### set

          public void set(int i,
                          double v)

      Specified by:
        `set` in interface `VectorStorage`
      Parameters:
        `i` - Vector element index.
        `v` - Value to set at given index.

    - #### isDense

          public boolean isDense()

      Checks if this implementation should be considered dense so that it explicitly represents every value.
      Specified by:
        `isDense` in interface `StorageOpsMetrics`

    - #### isNumeric

          public boolean isNumeric()

      Specified by:
        `isNumeric` in interface `StorageOpsMetrics`
      Returns:
        true if all stored data are values of Number class.

    - #### isArrayBased

          public boolean isArrayBased()

      Checks if implementation is based on Java arrays.
      Specified by:
        `isArrayBased` in interface `StorageOpsMetrics`

    - #### data

          public double[] data()

      Gets underlying array if `StorageOpsMetrics.isArrayBased()` returns `true` and all values in vector are Numbers. Returns `null` if in other cases.
      Specified by:
        `data` in interface `VectorStorage`
      See Also:
        `StorageOpsMetrics.isArrayBased()`

    - #### writeExternal

          public void writeExternal(ObjectOutput out)
                             throws IOException

      Specified by:
        `writeExternal` in interface `Externalizable`
      Throws:
        `IOException`

    - #### readExternal

          public void readExternal(ObjectInput in)
                            throws IOException,
                                   ClassNotFoundException

      Specified by:
        `readExternal` in interface `Externalizable`
      Throws:
        `IOException`
        `ClassNotFoundException`

    - #### getRaw

          public <T extends Serializable> T getRaw(int i)

      Specified by:
        `getRaw` in interface `VectorStorage`
      Type Parameters:
        `T` - Type of stored element in vector.
      Parameters:
        `i` - Vector element index.
      Returns:
        Value obtained for given element index.

    - #### setRaw

          public void setRaw(int i,
                             Serializable v)

      Specified by:
        `setRaw` in interface `VectorStorage`
      Parameters:
        `i` - Vector element index.
        `v` - Value to set at given index.

2020 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.9.0
Release Date | : October 15 2020