Class Q


  • public class Q
    extends java.lang.Object
    Configuration vector
    • Constructor Summary

      Constructors 
      Constructor Description
      Q()
      Default constructor.

      The vector will be of dimension zero.
      Q​(int n, double a0)
      Creates a Q of length n and initialize all values in Q to value

      Q​(int n, double a0, double a1)
      Creates a Q of length n and initialize all values in Q to the values specified after n

      The number of arguments after n must match the number n.

      Q​(int n, double a0, double a1, double a2)
      Creates a Q of length n and initialize all values in Q to the values specified after n

      The number of arguments after n must match the number n.

      Q​(int n, double a0, double a1, double a2, double a3)
      Creates a Q of length n and initialize all values in Q to the values specified after n

      The number of arguments after n must match the number n.

      Q​(int n, double a0, double a1, double a2, double a3, double a4)
      Creates a Q of length n and initialize all values in Q to the values specified after n

      The number of arguments after n must match the number n.

      Q​(int n, double a0, double a1, double a2, double a3, double a4, double a5)
      Creates a Q of length n and initialize all values in Q to the values specified after n

      The number of arguments after n must match the number n.

      Q​(int n, double a0, double a1, double a2, double a3, double a4, double a5, double a6)
      Creates a Q of length n and initialize all values in Q to the values specified after n

      The number of arguments after n must match the number n.

      Q​(int n, double a0, double a1, double a2, double a3, double a4, double a5, double a6, double a7)
      Creates a Q of length n and initialize all values in Q to the values specified after n

      The number of arguments after n must match the number n.

      Q​(int n, double a0, double a1, double a2, double a3, double a4, double a5, double a6, double a7, double a8)
      Creates a Q of length n and initialize all values in Q to the values specified after n

      The number of arguments after n must match the number n.

      Q​(int n, double a0, double a1, double a2, double a3, double a4, double a5, double a6, double a7, double a8, double a9)
      Creates a Q of length n and initialize all values in Q to the values specified after n

      The number of arguments after n must match the number n.

      Q​(long dim)
      A configuration of vector of length dim.
      Q​(long cPtr, boolean cMemoryOwn)  
      Q​(long n, double[] values)
      Creates a Q of length n and initialized with values from values

      The method reads n values from values and do not check whether reading out of bounds.

      Q​(VectorDouble r)
      Construct a configuration vector from a std::vector
      expression.

      Q​(EigenVectorXd q)
      Construct from Eigen base.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Q add​(Q b)
      Vector addition.
      void delete()  
      Q divide​(double s)
      Scalar division.
      EigenVectorXd e()
      Accessor for the internal Eigen vector state.
      boolean empty()
      True if the configuration is of dimension zero.
      double get​(long i)  
      static long getCPtr​(Q obj)  
      Q getSubPart​(long start, long cnt)
      Extracts a sub part (range) of this Q.
      boolean leessThan​(Q q)
      Compares whether this is less than q

      The less operator is defined such that the first index is the most significant.
      Q multiply​(double s)
      Scalar multiplication.
      Q negate()  
      double norm1()
      Returns the Manhatten norm (1-norm) of the configuration
      double norm2()
      Returns the Euclidean norm (2-norm) of the configuration
      double normInf()
      Returns the infinte norm ( \inf -norm) of the configuration
      void set​(long i, double d)  
      void setSubPart​(long index, Q part)
      Set subpart of vector.
      int size()
      The dimension of the configuration vector.
      Q subtract​(Q b)
      Vector subtraction.
      VectorDouble toStdVector()
      Convert to a standard vector.
      void toStdVector​(VectorDouble v)
      Convert to a standard vector.
      java.lang.String toString()  
      static Q zero​(long n)
      Returns Q of length n initialized with 0's
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Q

        public Q​(long cPtr,
                 boolean cMemoryOwn)
      • Q

        public Q​(long dim)
        A configuration of vector of length dim.
      • Q

        public Q()
        Default constructor.

        The vector will be of dimension zero.
      • Q

        public Q​(long n,
                 double[] values)
        Creates a Q of length n and initialized with values from values

        The method reads n values from values and do not check whether reading out of bounds.

        Parameters:
        n - [in] Length of q.
        values - [in] Array of values to initialize with
      • Q

        public Q​(int n,
                 double a0)
        Creates a Q of length n and initialize all values in Q to value

        Parameters:
        n - [in] Length of q.
      • Q

        public Q​(int n,
                 double a0,
                 double a1)
        Creates a Q of length n and initialize all values in Q to the values specified after n

        The number of arguments after n must match the number n.

        Parameters:
        n - [in] Length of q.
        a0 - [in] Value to initialize q(0)
        a1 - [in] Value to initialize q(1)
      • Q

        public Q​(int n,
                 double a0,
                 double a1,
                 double a2)
        Creates a Q of length n and initialize all values in Q to the values specified after n

        The number of arguments after n must match the number n.

        Parameters:
        n - [in] Length of q.
        a0 - [in] Value to initialize q(0)
        a1 - [in] Value to initialize q(1)
        a2 - [in] Values to initialize q(2)
      • Q

        public Q​(int n,
                 double a0,
                 double a1,
                 double a2,
                 double a3)
        Creates a Q of length n and initialize all values in Q to the values specified after n

        The number of arguments after n must match the number n.

        Parameters:
        n - [in] Length of q.
        a0 - [in] Value to initialize q(0)
        a1 - [in] Value to initialize q(1)
        a2 - [in] Values to initialize q(2)
        a3 - [in] Values to initialize q(3)
      • Q

        public Q​(int n,
                 double a0,
                 double a1,
                 double a2,
                 double a3,
                 double a4)
        Creates a Q of length n and initialize all values in Q to the values specified after n

        The number of arguments after n must match the number n.

        Parameters:
        n - [in] Length of q.
        a0 - [in] Value to initialize q(0)
        a1 - [in] Value to initialize q(1)
        a2 - [in] Values to initialize q(2)
        a3 - [in] Values to initialize q(3)
        a4 - [in] Values to initialize q(4)
      • Q

        public Q​(int n,
                 double a0,
                 double a1,
                 double a2,
                 double a3,
                 double a4,
                 double a5)
        Creates a Q of length n and initialize all values in Q to the values specified after n

        The number of arguments after n must match the number n.

        Parameters:
        n - [in] Length of q.
        a0 - [in] Value to initialize q(0)
        a1 - [in] Value to initialize q(1)
        a2 - [in] Values to initialize q(2)
        a3 - [in] Values to initialize q(3)
        a4 - [in] Values to initialize q(4)
        a5 - [in] Values to initialize q(5)
      • Q

        public Q​(int n,
                 double a0,
                 double a1,
                 double a2,
                 double a3,
                 double a4,
                 double a5,
                 double a6)
        Creates a Q of length n and initialize all values in Q to the values specified after n

        The number of arguments after n must match the number n.

        Parameters:
        n - [in] Length of q.
        a0 - [in] Value to initialize q(0)
        a1 - [in] Value to initialize q(1)
        a2 - [in] Values to initialize q(2)
        a3 - [in] Values to initialize q(3)
        a4 - [in] Values to initialize q(4)
        a5 - [in] Values to initialize q(5)
        a6 - [in] Values to initialize q(6)
      • Q

        public Q​(int n,
                 double a0,
                 double a1,
                 double a2,
                 double a3,
                 double a4,
                 double a5,
                 double a6,
                 double a7)
        Creates a Q of length n and initialize all values in Q to the values specified after n

        The number of arguments after n must match the number n.

        Parameters:
        n - [in] Length of q.
        a0 - [in] Value to initialize q(0)
        a1 - [in] Value to initialize q(1)
        a2 - [in] Values to initialize q(2)
        a3 - [in] Values to initialize q(3)
        a4 - [in] Values to initialize q(4)
        a5 - [in] Values to initialize q(5)
        a6 - [in] Values to initialize q(6)
        a7 - [in] Values to initialize q(7)
      • Q

        public Q​(int n,
                 double a0,
                 double a1,
                 double a2,
                 double a3,
                 double a4,
                 double a5,
                 double a6,
                 double a7,
                 double a8)
        Creates a Q of length n and initialize all values in Q to the values specified after n

        The number of arguments after n must match the number n.

        Parameters:
        n - [in] Length of q.
        a0 - [in] Value to initialize q(0)
        a1 - [in] Value to initialize q(1)
        a2 - [in] Values to initialize q(2)
        a3 - [in] Values to initialize q(3)
        a4 - [in] Values to initialize q(4)
        a5 - [in] Values to initialize q(5)
        a6 - [in] Values to initialize q(6)
        a7 - [in] Values to initialize q(7)
        a8 - [in] Values to initialize q(8)
      • Q

        public Q​(int n,
                 double a0,
                 double a1,
                 double a2,
                 double a3,
                 double a4,
                 double a5,
                 double a6,
                 double a7,
                 double a8,
                 double a9)
        Creates a Q of length n and initialize all values in Q to the values specified after n

        The number of arguments after n must match the number n.

        Parameters:
        n - [in] Length of q.
        a0 - [in] Value to initialize q(0)
        a1 - [in] Value to initialize q(1)
        a2 - [in] Values to initialize q(2)
        a3 - [in] Values to initialize q(3)
        a4 - [in] Values to initialize q(4)
        a5 - [in] Values to initialize q(5)
        a6 - [in] Values to initialize q(6)
        a7 - [in] Values to initialize q(7)
        a8 - [in] Values to initialize q(8)
        a9 - [in] Values to initialize q(9)
      • Q

        public Q​(VectorDouble r)
        Construct a configuration vector from a std::vector
        expression.

        Parameters:
        r - [in] An expression for a vector of doubles
      • Q

        public Q​(EigenVectorXd q)
        Construct from Eigen base.
        Parameters:
        q - [in] Eigen base.
    • Method Detail

      • getCPtr

        public static long getCPtr​(Q obj)
      • delete

        public void delete()
      • zero

        public static Q zero​(long n)
        Returns Q of length n initialized with 0's
      • size

        public int size()
        The dimension of the configuration vector.
      • empty

        public boolean empty()
        True if the configuration is of dimension zero.
      • e

        public EigenVectorXd e()
        Accessor for the internal Eigen vector state.
      • getSubPart

        public Q getSubPart​(long start,
                            long cnt)
        Extracts a sub part (range) of this Q.
        Parameters:
        start - [in] Start index
        cnt - [in] the number of elements to include
        Returns:
      • setSubPart

        public void setSubPart​(long index,
                               Q part)
        Set subpart of vector.
        Parameters:
        index - [in] the initial index.
        part - [in] the part to insert beginning from index.
      • norm2

        public double norm2()
        Returns the Euclidean norm (2-norm) of the configuration
        Returns:
        the norm
      • norm1

        public double norm1()
        Returns the Manhatten norm (1-norm) of the configuration
        Returns:
        the norm
      • normInf

        public double normInf()
        Returns the infinte norm ( \inf -norm) of the configuration
        Returns:
        the norm
      • negate

        public Q negate()
      • subtract

        public Q subtract​(Q b)
        Vector subtraction.
      • add

        public Q add​(Q b)
        Vector addition.
      • multiply

        public Q multiply​(double s)
        Scalar multiplication.
      • divide

        public Q divide​(double s)
        Scalar division.
      • leessThan

        public boolean leessThan​(Q q)
        Compares whether this is less than q

        The less operator is defined such that the first index is the most significant. That is
        if (*this)[0] < q[0] then true is returned. If (*this)[0] > q[0] false is returned and
        only if (*this)[0] == q[0] is the next index considered.
      • toStdVector

        public void toStdVector​(VectorDouble v)
        Convert to a standard vector.
        Parameters:
        v - [out] the result.
      • toStdVector

        public VectorDouble toStdVector()
        Convert to a standard vector.
        Returns:
        the result.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • get

        public double get​(long i)
      • set

        public void set​(long i,
                        double d)