...
No Format |
---|
/**
* Basic vector interface.
*/
public interface VectorInterface {
/**
* @return size of the vector
*/
public int size();
/**
* @param index
* @return v(index)
*/
public double get(int index);
/**
* v(index) = value
*
* @param index
* @param value
*/
public void set(int index, double value);
/**
* @param v
* @return x = v
*/
public Vector set(Vector v);
/**
* v(index) += value
*
* @param index
* @param value
*/
public void add(int index, double value);
/**
* @param alpha
* @param v
* @return x = alpha*v + x
*/
public boolean add(double alpha, Vector v);
/**
* @param v
* @return x = v + x
*/
public Vector add(Vector v);
/**
* @param v
* @return x dot v
*/
public double dot(Vector v);
/**
* Computes the given norm of the vector
*
* @param type
* @return norm of the vector
*/
public double norm(Norm type);
/**
* Supported vector-norms.
*/
enum Norm {
/** Sum of the absolute values of the entries */
One,
/** The root of sum of squares */
Two,
/**
* As the 2 norm may overflow, an overflow resistant version is also
* available. Note that it may be slower.
*/
TwoRobust,
/** Largest entry in absolute value */
Infinity
}
}
|
Matrix
No Format |
---|
/**
* Basic matrix interface.
*/
public interface MatrixInterface {
/**
* @param i ith row of the matrix
* @param j jth column of the matrix
* @return A(i, j)
*/
public double get(int i, int j);
/**
* Get a number of row of the matrix
*
* @return a number of rows of the matrix
*/
public int getRows();
/**
* Get a number of column of the matrix
*
* @return a number of columns of the matrix
*/
public int getColumns();
/**
* A(i, j) = value
*
* @param i ith row of the matrix
* @param j jth column of the matrix
* @param value the value of entry
*/
public void set(int i, int j, double value);
/**
* A=alpha*B
*
* @param alpha
* @param B
* @return A
*/
public Matrix set(double alpha, Matrix B);
/**
* A=B
*
* @param B
* @return A
*/
public Matrix set(Matrix B);
/**
* Sets the dimension of matrix
*
* @param the number of rows
* @param the number of columns
*/
public void setDimension(int i, int j);
/**
* A(i, j) += value
*
* @param i
* @param j
* @param value
*/
public void add(int i, int j, double value);
/**
* A = B + A
*
* @param B
* @return
*/
public Matrix add(Matrix B);
/**
* A = alpha*B + A
*
* @param alpha
* @param B
* @return A
*/
public Matrix add(double alpha, Matrix B);
/**
* C = A*B
*
* @param B
* @return C
*/
public Matrix mult(Matrix B);
/**
* C = alpha*A*B + C
*
* @param alpha
* @param B
* @param C
* @return C
*/
public Matrix multAdd(double alpha, Matrix B, Matrix C)
/**
* Computes the given norm of the matrix
*
* @param type
* @return norm of the matrix
*/
public double norm(Matrix.Norm type);
}
|