Class RowVector


  • public class RowVector
    extends Matrix
    From: Java Number Cruncher The Java Programmer's Guide to Numerical Computation by Ronald Mak
    • Constructor Detail

      • RowVector

        public RowVector​(int n)
        Constructor.
        Parameters:
        n - the number of elements
      • RowVector

        public RowVector​(double[] values)
        Constructor.
        Parameters:
        values - the array of values
    • Method Detail

      • size

        public int size()
        Return the row vector's size.
      • copyValues1D

        public double[] copyValues1D()
        Copy the values of this matrix.
        Returns:
        the copied values
      • at

        public double at​(int i)
        Return the i'th value of the vector.
        Parameters:
        i - the index
        Returns:
        the value
      • set

        protected void set​(double[] values)
        Set this row vector from an array of values.
        Parameters:
        values - the array of values
      • set

        public void set​(int i,
                        double value)
        Set the i'th value of the vector.
        Parameters:
        i - the index
        value - the value
      • add

        public RowVector add​(RowVector rv)
                      throws MatrixException
        Add another row vector to this row vector.
        Parameters:
        rv - the other row vector
        Returns:
        the sum row vector
        Throws:
        numbercruncher.MatrixException - for invalid size
        MatrixException
      • subtract

        public RowVector subtract​(RowVector rv)
                           throws MatrixException
        Subtract another row vector from this row vector.
        Parameters:
        rv - the other row vector
        Returns:
        the sum row vector
        Throws:
        numbercruncher.MatrixException - for invalid size
        MatrixException
      • norm

        public double norm()
        Compute the Euclidean norm.
        Returns:
        the norm
      • print

        public void print()
        Print the vector values.