Documentation of 'mikera.vectorz.Scalar' Java class
Scalar
mikera.vectorz

Class Scalar

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<INDArray>, java.lang.Iterable<java.lang.Object>, IDense, INDArray, IScalar


    public final class Scalar
    extends AScalar
    Basic Scalar class containing a single mutable double value
    See Also:
    Serialized Form
    • Field Detail

      • value

        public double value
    • Constructor Detail

      • Scalar

        public Scalar(double value)
    • Method Detail

      • create

        public static Scalar create(double value)
      • create

        public static INDArray create(java.lang.Number number)
      • get

        public double get()
        Description copied from interface: INDArray
        Returns the double value of a scalar array
        Specified by:
        get in interface INDArray
        Specified by:
        get in interface IScalar
        Specified by:
        get in class AScalar
      • set

        public void set(double value)
        Description copied from interface: INDArray
        Sets all elements of an array to a specific double value
        Specified by:
        set in interface INDArray
        Specified by:
        set in interface IScalar
        Specified by:
        set in class AScalar
      • abs

        public void abs()
        Description copied from interface: INDArray
        Replaces all elements of this array with their absolute values, according to Math.abs(double)
        Specified by:
        abs in interface INDArray
        Overrides:
        abs in class AScalar
      • add

        public void add(double d)
        Description copied from interface: INDArray
        Adds a double value to all elements in this array. Implementations may optimize the case of 0.0
        Specified by:
        add in interface INDArray
        Overrides:
        add in class AScalar
      • sub

        public void sub(double d)
        Description copied from interface: INDArray
        Subtracts a double value from all elements in this array
        Specified by:
        sub in interface INDArray
        Overrides:
        sub in class AScalar
      • multiply

        public void multiply(double factor)
        Description copied from interface: INDArray
        Multiplies all elements of the array in place by a given double value
        Specified by:
        multiply in interface INDArray
        Overrides:
        multiply in class AScalar
      • negate

        public void negate()
        Description copied from interface: INDArray
        Negates all elements in the array in place
        Specified by:
        negate in interface INDArray
        Overrides:
        negate in class AScalar
      • scaleAdd

        public void scaleAdd(double factor,
                             double constant)
        Description copied from interface: INDArray
        Scales all elements of the array by a given double value and adds a constant value
        Specified by:
        scaleAdd in interface INDArray
        Overrides:
        scaleAdd in class AbstractArray<java.lang.Object>
      • isView

        public boolean isView()
        Description copied from interface: INDArray
        Return true if this array is considered as a view type. This indicates (but does not guarantee): a) Data is *likely* to be shared with other arrays, so mutation of one may affect others b) It is *unlikely* to be in the most efficient general purpose format isView is intended to be used as for heuristics. It should *not* be used where the outcome might affect correctness.
      • isZero

        public boolean isZero()
        Description copied from interface: INDArray
        Returns true if the array is zero (all elements equal to zero)
        Specified by:
        isZero in interface INDArray
        Overrides:
        isZero in class AScalar
      • getElements

        public void getElements(double[] dest,
                                int offset)
        Description copied from interface: INDArray
        Copies all elements of this array a double array at the specified offset
        Specified by:
        getElements in interface INDArray
        Overrides:
        getElements in class AScalar
      • exactClone

        public Scalar exactClone()
        Description copied from interface: INDArray
        Creates a deep clone of an array, using the same class implementation as the original array
        Specified by:
        exactClone in interface INDArray
        Specified by:
        exactClone in class AScalar
        Returns:
        A clone of the original array
      • createFromVector

        public static Scalar createFromVector(AVector data)
        Creates a new Scalar using the elements in the specified vector. Zero-pads the data as required to define the Scalar
        Parameters:
        data -
        rows -
        columns -
        Returns:
      • mutable

        public Scalar mutable()
        Description copied from interface: INDArray
        Coerces this INDArray to a fully mutable format. May return the same INDArray if already fully mutable
        Specified by:
        mutable in interface INDArray
        Specified by:
        mutable in interface IScalar
        Overrides:
        mutable in class AScalar
      • immutable

        public ImmutableScalar immutable()
        Description copied from interface: INDArray
        Returns an immutable version of this array. May return the same array if already immutable. Guarantees a defensive copy if the array is mutable.
        Specified by:
        immutable in interface INDArray
        Specified by:
        immutable in interface IScalar
        Overrides:
        immutable in class AScalar
      • addSparse

        public void addSparse(double c)
        Description copied from interface: INDArray
        Adds to the non-sparse elements of this array
        Specified by:
        addSparse in interface INDArray
        Overrides:
        addSparse in class AbstractArray<java.lang.Object>

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.