peakml.math
Class DataFrame.Double

java.lang.Object
  extended by peakml.math.DataFrame
      extended by peakml.math.DataFrame.Double
Enclosing class:
DataFrame

public static class DataFrame.Double
extends DataFrame

Implementation of the data-frame with the double data-type.


Nested Class Summary
 
Nested classes/interfaces inherited from class peakml.math.DataFrame
DataFrame.Double
 
Constructor Summary
DataFrame.Double(int rows, int cols)
          Constructs a new data-frame with the given number of rows and columns.
 
Method Summary
 double get(int row, int col)
          Returns the value at the given row and column.
 double get(int row, java.lang.String col)
          Returns the value at the given row and column.
 double get(java.lang.String row, int col)
          Returns the value at the given row and column.
 double get(java.lang.String row, java.lang.String col)
          Returns the value at the given row and column.
 double[] getCol(int col)
          Returns the complete column with the given name.
 double[] getCol(java.lang.String colname)
          Returns the complete column with the given name.
 double[][] getMatrix()
          Returns a matrix with all the data in the dataframe.
 double[] getRow(int row)
          Returns the complete row at the given index.
 double[] getRow(java.lang.String rowname)
          Returns the complete row with the given name.
 void set(int row, int col, double val)
          Sets the given value at the given row and column.
 void set(int row, java.lang.String col, double val)
          Sets the given value at the given row and column.
 void set(java.lang.String row, int col, double val)
          Sets the given value at the given row and column.
 void set(java.lang.String row, java.lang.String col, double val)
          Sets the given value at the given row and column.
 
Methods inherited from class peakml.math.DataFrame
getColIndexOf, getColName, getColNames, getNrColumns, getNrRows, getRowIndexOf, getRowName, getRowNames, setColName, setColNames, setColNames, setRowName, setRowNames, setRowNames
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataFrame.Double

public DataFrame.Double(int rows,
                        int cols)
Constructs a new data-frame with the given number of rows and columns.

Parameters:
rows - The number of rows.
cols - The number of columns.
Method Detail

set

public void set(int row,
                int col,
                double val)
         throws java.lang.IndexOutOfBoundsException
Sets the given value at the given row and column.

Parameters:
row - The row index.
col - The column index.
val - The value.
Throws:
java.lang.IndexOutOfBoundsException - Thrown when the row and/or column index does not match the range.

set

public void set(java.lang.String row,
                int col,
                double val)
         throws java.lang.IndexOutOfBoundsException
Sets the given value at the given row and column.

Parameters:
row - The row name.
col - The column index.
val - The value.
Throws:
java.lang.IndexOutOfBoundsException - Thrown when the row and/or column index does not match the range.

set

public void set(int row,
                java.lang.String col,
                double val)
         throws java.lang.IndexOutOfBoundsException
Sets the given value at the given row and column.

Parameters:
row - The row index.
col - The column name.
val - The value.
Throws:
java.lang.IndexOutOfBoundsException - Thrown when the row and/or column index does not match the range.

set

public void set(java.lang.String row,
                java.lang.String col,
                double val)
         throws java.lang.IndexOutOfBoundsException
Sets the given value at the given row and column.

Parameters:
row - The row name.
col - The column name.
val - The value.
Throws:
java.lang.IndexOutOfBoundsException - Thrown when the row and/or column index does not match the range.

get

public double get(int row,
                  int col)
           throws java.lang.IndexOutOfBoundsException
Returns the value at the given row and column.

Parameters:
row - The row index.
col - The column index.
Returns:
The value.
Throws:
java.lang.IndexOutOfBoundsException - Thrown when the row and/or column index does not match the range.

get

public double get(java.lang.String row,
                  int col)
           throws java.lang.IndexOutOfBoundsException
Returns the value at the given row and column.

Parameters:
row - The row name.
col - The column index.
Returns:
The value.
Throws:
java.lang.IndexOutOfBoundsException - Thrown when the row and/or column index does not match the range.

get

public double get(int row,
                  java.lang.String col)
           throws java.lang.IndexOutOfBoundsException
Returns the value at the given row and column.

Parameters:
row - The row index.
col - The column name.
Returns:
The value.
Throws:
java.lang.IndexOutOfBoundsException - Thrown when the row and/or column index does not match the range.

get

public double get(java.lang.String row,
                  java.lang.String col)
           throws java.lang.IndexOutOfBoundsException
Returns the value at the given row and column.

Parameters:
row - The row name.
col - The column name.
Returns:
The value.
Throws:
java.lang.IndexOutOfBoundsException - Thrown when the row and/or column index does not match the range.

getRow

public double[] getRow(java.lang.String rowname)
Returns the complete row with the given name. This is an array with the number of columns as its size.

Parameters:
rowname - The row name.
Returns:
An array with all the row values.

getRow

public double[] getRow(int row)
Returns the complete row at the given index. This is an array with the number of columns as its size.

Parameters:
row - The row index.
Returns:
An array with all the row values.

getCol

public double[] getCol(java.lang.String colname)
Returns the complete column with the given name. This is an array with the number of rows as its size.

Parameters:
colname - The column name.
Returns:
An array with all the column values.

getCol

public double[] getCol(int col)
Returns the complete column with the given name. This is an array with the number of rows as its size.

Parameters:
col - The column index.
Returns:
An array with all the column values.

getMatrix

public double[][] getMatrix()
Returns a matrix with all the data in the dataframe.

Returns:
The matrix making up the data of the dataframe.