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

## Class VectorViewStorage

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

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

      public class VectorViewStorage
      extends Object
      implements VectorStorage

  `VectorStorage` implementation that delegates to parent matrix.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `VectorViewStorage()`
    `VectorViewStorage(VectorStorage sto, int off, int len)`

  - ### 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.
    `VectorStorage` | `delegate()`
    `boolean` | `equals(Object o)`
    `double` | `get(int i)` Gets element from vector by index and cast it to double.
    `<T extends Serializable> T` | `getRaw(int i)`
    `int` | `hashCode()`
    `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()`
    `int` | `length()`
    `int` | `offset()`
    `Serializable[]` | `rawData()`
    `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, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

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

      `destroy`

- - ### Constructor Detail

    - #### VectorViewStorage

          public VectorViewStorage()

    - #### VectorViewStorage

          public VectorViewStorage(VectorStorage sto,
                                   int off,
                                   int len)

      Parameters:
        `sto` - Vector storage to delegate to.
        `off` - Offset in the parent vector.
        `len` - Size of the vector.

  - ### Method Detail

    - #### delegate

          public VectorStorage delegate()

      Returns:
        Backing vector storage.

    - #### offset

          public int offset()

      Returns:
        Offset into the backing vector.

    - #### length

          public int length()

      Returns:
        Vector length.

    - #### 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.

    - #### 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.

    - #### 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.

    - #### 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.

    - #### 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()`

    - #### rawData

          public Serializable[] rawData()

      Specified by:
        `rawData` in interface `VectorStorage`
      Returns:
        Underlying array of serializable objects `StorageOpsMetrics.isArrayBased()` returns `true`. Returns `null` if in other cases.

    - #### 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`

    - #### isArrayBased

          public boolean isArrayBased()

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

    - #### isNumeric

          public boolean isNumeric()

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

    - #### 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`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

2022 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.12.0
Release Date | : January 10 2022