Class VectorImpl

  • All Implemented Interfaces:
    Vector

    public class VectorImpl
    extends Object
    implements Vector
    • Constructor Detail

      • VectorImpl

        public VectorImpl​(int size)
      • VectorImpl

        public VectorImpl​(double... values)
    • Method Detail

      • add

        public Vector add​(Vector v2)
        Description copied from interface: Vector
        Add a vector to this vector.
        Specified by:
        add in interface Vector
        Parameters:
        v2 - The vector to add. Must be of same size.
        Returns:
        The result of the operation.
      • times

        public Vector times​(double val)
        Description copied from interface: Vector
        Multiplication to a scalar.
        Specified by:
        times in interface Vector
        Parameters:
        val - The scalar to multiply with.
        Returns:
        The result of the operation.
      • maxIdx

        public int maxIdx()
        Description copied from interface: Vector
        Index at which the vector holds its maximum value.
        Specified by:
        maxIdx in interface Vector
        Returns:
        The index.
      • max

        public double max()
        Description copied from interface: Vector
        The maximum value of the vector.
        Specified by:
        max in interface Vector
        Returns:
        The maximum value of the vector.
      • get

        public double get​(int idx)
        Description copied from interface: Vector
        Get the value of the vector at a specified position.
        Specified by:
        get in interface Vector
        Returns:
      • set

        public void set​(int idx,
                        double value)
        Description copied from interface: Vector
        Set the value at a specified position.
        Specified by:
        set in interface Vector
        Parameters:
        idx - The index where to set a new value.
        value - The value to set to.
      • getSize

        public int getSize()
        Description copied from interface: Vector
        Get the size of the vector.
        Specified by:
        getSize in interface Vector
        Returns:
        Size of the vector.