All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home

Class weka.classifiers.functions.pace.DoubleVector

java.lang.Object
    |
    +----weka.classifiers.functions.pace.DoubleVector

public class DoubleVector
extends java.lang.Object
implements java.lang.Cloneable

Constructor Index

 o DoubleVector()
Constructs a null vector.
 o DoubleVector(double[])
Constructs a vector directly from a double array
 o DoubleVector(int)
Constructs an n-vector of zeros.
 o DoubleVector(int, double)
Constructs a constant n-vector.

Method Index

 o addElement(double)
Adds an element into the vector
 o capacity()
Gets the capacity of the vector.
 o cat(DoubleVector)
Combine two vectors together
 o clone()
Clones the DoubleVector object.
 o copy()
Makes a deep copy of the vector
 o cumulate()
Returns a vector that stores the cumulated values of the original vector
 o cumulateInPlace()
Cumulates the original vector in place
 o dividedBy(DoubleVector)
Divided by another DoubleVector element by element
 o dividedByEquals(DoubleVector)
Divided by another DoubleVector element by element in place
 o get(int)
Gets a single element.
 o getArrayCopy()
Returns a copy of the DoubleVector usng a double array.
 o indexOfMax()
Returns the index of the maximum.
 o innerProduct(DoubleVector)
Returns the inner product of two DoubleVectors
 o isEmpty()
Checks if it is an empty vector
 o main(String[])
 
 o map(String, String)
Applies a method to the vector
 o max()
Returns the maximum value of all elements
 o minus(double)
Subtracts a value
 o minus(DoubleVector)
Subtracts another DoubleVector element by element
 o minusEquals(double)
Subtracts a value in place
 o minusEquals(DoubleVector)
Subtracts another DoubleVector element by element in place
 o norm1()
Returns the L1-norm of the vector
 o norm2()
Returns the L2-norm of the vector
 o plus(double)
Adds a value to all the elements
 o plus(DoubleVector)
Adds another vector element by element
 o plusEquals(double)
Adds a value to all the elements in place
 o plusEquals(DoubleVector)
Adds another vector in place element by element
 o random(int)
Returns a random vector of uniform distribution
 o rev()
Returns the reverse vector
 o set(double)
Set all elements to a value
 o set(DoubleVector)
Set the elements using a DoubleVector
 o set(int, double)
Set a single element.
 o set(int, int, double)
Set some elements to a value
 o set(int, int, double[], int)
Set some elements using a 2-D array
 o set(int, int, DoubleVector, int)
Set some elements using a DoubleVector.
 o setCapacity(int)
Sets the capacity of the vector
 o setPlus(int, double)
Adds a value to an element
 o setSize(int)
Sets the size of the vector
 o setTimes(int, double)
Multiplies a value to an element
 o sign()
Returns the signs of all elements in terms of -1, 0 and +1.
 o size()
Gets the size of the vector.
 o sort()
Sorts the array in place
 o sortWithIndex()
Sorts the array in place with index returned
 o sortWithIndex(int, int, IntVector)
Sorts the array in place with index changed
 o sqrt()
Returns the square-root of all the elements in the vector
 o square()
Returns the squared vector
 o subvector(int, int)
Returns a subvector.
 o subvector(IntVector)
Returns a subvector.
 o sum()
Returns the sum of all elements in the vector.
 o sum2()
Returns the squared sum of all elements in the vector.
 o sum2(DoubleVector)
Returns ||u-v||^2
 o swap(int, int)
Swaps the values stored at i and j
 o times(double)
Multiplies a scalar
 o times(DoubleVector)
Multiplies another DoubleVector element by element
 o timesEquals(double)
Multiply a vector by a scalar in place, u = s * u
 o timesEquals(DoubleVector)
Multiplies another DoubleVector element by element in place
 o toString()
Convert the DoubleVecor to a string
 o toString(int, boolean)
Convert the DoubleVecor to a string
 o unpivoting(IntVector, int)
Returns a vector from the pivoting indices.
 o unsorted()
Returns true if vector not sorted

Constructor Detail

 o DoubleVector
public DoubleVector()
          Constructs a null vector.
 o DoubleVector
public DoubleVector(int n)
          Constructs an n-vector of zeros.
Parameters:
n - length.
 o DoubleVector
public DoubleVector(int n,
                    double s)
          Constructs a constant n-vector.
Parameters:
n - length.
s - the scalar value used to fill the vector
 o DoubleVector
public DoubleVector(double v[])
          Constructs a vector directly from a double array
Parameters:
v - the array

Method Detail

 o set
public void set(int i,
                double s)
          Set a single element.
Parameters:
i - Index.
s - a[i].
 o set
public void set(double s)
          Set all elements to a value
Parameters:
s - the value
 o set
public void set(int i0,
                int i1,
                double s)
          Set some elements to a value
Parameters:
i0 - the index of the first element
i1 - the index of the second element
s - the value
 o set
public void set(int i0,
                int i1,
                double v[],
                int j0)
          Set some elements using a 2-D array
Parameters:
i0 - the index of the first element
i1 - the index of the second element
j0 - the index of the starting element in the 2-D array
s - the value
 o set
public void set(DoubleVector v)
          Set the elements using a DoubleVector
Parameters:
v - the DoubleVector
 o set
public void set(int i0,
                int i1,
                DoubleVector v,
                int j0)
          Set some elements using a DoubleVector.
Parameters:
i0 - the index of the first element
i1 - the index of the second element
v - the DoubleVector
j0 - the index of the starting element in the DoubleVector
 o getArrayCopy
public double[] getArrayCopy()
          Returns a copy of the DoubleVector usng a double array.
Returns:
the one-dimensional array.
 o sort
public void sort()
          Sorts the array in place
 o sortWithIndex
public IntVector sortWithIndex()
          Sorts the array in place with index returned
 o sortWithIndex
public void sortWithIndex(int xi,
                          int xj,
                          IntVector index)
          Sorts the array in place with index changed
Parameters:
xi - first index
xj - last index
index - array that stores all indices
 o size
public int size()
          Gets the size of the vector.
Returns:
the size
 o setSize
public void setSize(int m)
          Sets the size of the vector
Parameters:
m - the size
 o capacity
public int capacity()
          Gets the capacity of the vector.
Returns:
the capacity.
 o setCapacity
public void setCapacity(int n)
          Sets the capacity of the vector
Parameters:
n - the capacity.
 o get
public double get(int i)
          Gets a single element.
Parameters:
i - Index.
Returns:
the value of the i-th element
 o setPlus
public void setPlus(int i,
                    double s)
          Adds a value to an element
Parameters:
i - the index of the element
s - the value
 o setTimes
public void setTimes(int i,
                     double s)
          Multiplies a value to an element
Parameters:
i - the index of the element
s - the value
 o addElement
public void addElement(double x)
          Adds an element into the vector
Parameters:
x - the value of the new element
 o square
public DoubleVector square()
          Returns the squared vector
 o sqrt
public DoubleVector sqrt()
          Returns the square-root of all the elements in the vector
 o copy
public DoubleVector copy()
          Makes a deep copy of the vector
 o clone
public java.lang.Object clone()
          Clones the DoubleVector object.
 o innerProduct
public double innerProduct(DoubleVector v)
          Returns the inner product of two DoubleVectors
Parameters:
v - the second DoubleVector
Returns:
the product
 o sign
public DoubleVector sign()
          Returns the signs of all elements in terms of -1, 0 and +1.
 o sum
public double sum()
          Returns the sum of all elements in the vector.
 o sum2
public double sum2()
          Returns the squared sum of all elements in the vector.
 o norm1
public double norm1()
          Returns the L1-norm of the vector
 o norm2
public double norm2()
          Returns the L2-norm of the vector
 o sum2
public double sum2(DoubleVector v)
          Returns ||u-v||^2
Parameters:
v - the second vector
 o subvector
public DoubleVector subvector(int i0,
                              int i1)
          Returns a subvector.
Parameters:
i0 - the index of the first element
i1 - the index of the last element
Returns:
v[i0:i1]
 o subvector
public DoubleVector subvector(IntVector index)
          Returns a subvector.
Parameters:
index - stores the indices of the needed elements
Returns:
v[index]
 o unpivoting
public DoubleVector unpivoting(IntVector index,
                               int length)
          Returns a vector from the pivoting indices. Elements not indexed are set to zero.
Parameters:
index - stores the pivoting indices
length - the total number of the potential elements
Returns:
the subvector
 o plus
public DoubleVector plus(double x)
          Adds a value to all the elements
Parameters:
x - the value
 o plusEquals
public DoubleVector plusEquals(double x)
          Adds a value to all the elements in place
Parameters:
x - the value
 o plus
public DoubleVector plus(DoubleVector v)
          Adds another vector element by element
Parameters:
v - the second vector
 o plusEquals
public DoubleVector plusEquals(DoubleVector v)
          Adds another vector in place element by element
Parameters:
v - the second vector
 o minus
public DoubleVector minus(double x)
          Subtracts a value
Parameters:
x - the value
 o minusEquals
public DoubleVector minusEquals(double x)
          Subtracts a value in place
Parameters:
x - the value
 o minus
public DoubleVector minus(DoubleVector v)
          Subtracts another DoubleVector element by element
Parameters:
v - the second DoubleVector
 o minusEquals
public DoubleVector minusEquals(DoubleVector v)
          Subtracts another DoubleVector element by element in place
Parameters:
v - the second DoubleVector
 o times
public DoubleVector times(double s)
          Multiplies a scalar
Parameters:
s - scalar
Returns:
s * v
 o timesEquals
public DoubleVector timesEquals(double s)
          Multiply a vector by a scalar in place, u = s * u
Parameters:
s - scalar
Returns:
replace u by s * u
 o times
public DoubleVector times(DoubleVector v)
          Multiplies another DoubleVector element by element
Parameters:
v - the second DoubleVector
 o timesEquals
public DoubleVector timesEquals(DoubleVector v)
          Multiplies another DoubleVector element by element in place
Parameters:
v - the second DoubleVector
 o dividedBy
public DoubleVector dividedBy(DoubleVector v)
          Divided by another DoubleVector element by element
Parameters:
v - the second DoubleVector
 o dividedByEquals
public DoubleVector dividedByEquals(DoubleVector v)
          Divided by another DoubleVector element by element in place
Parameters:
v - the second DoubleVector
 o isEmpty
public boolean isEmpty()
          Checks if it is an empty vector
 o cumulate
public DoubleVector cumulate()
          Returns a vector that stores the cumulated values of the original vector
 o cumulateInPlace
public DoubleVector cumulateInPlace()
          Cumulates the original vector in place
 o indexOfMax
public int indexOfMax()
          Returns the index of the maximum.

If multiple maximums exist, the index of the first is returned.

 o unsorted
public boolean unsorted()
          Returns true if vector not sorted
 o cat
public DoubleVector cat(DoubleVector v)
          Combine two vectors together
Parameters:
v - the second vector
 o swap
public void swap(int i,
                 int j)
          Swaps the values stored at i and j
Parameters:
i - the index i
j - the index j
 o max
public double max()
          Returns the maximum value of all elements
 o map
public DoubleVector map(java.lang.String className,
                        java.lang.String method)
          Applies a method to the vector
Parameters:
className - the class name
method - the method
 o rev
public DoubleVector rev()
          Returns the reverse vector
 o random
public static DoubleVector random(int n)
          Returns a random vector of uniform distribution
Parameters:
n - the size of the vector
 o toString
public java.lang.String toString()
          Convert the DoubleVecor to a string
Overrides:
toString in class java.lang.Object
 o toString
public java.lang.String toString(int digits,
                       boolean trailing)
          Convert the DoubleVecor to a string
Parameters:
digits - the number of digits after decimal point
trailing - true if trailing zeros are to be shown
 o main
public static void main(java.lang.String args[])

All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home