Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional class parameter to ones and filled #189

Open
wants to merge 6 commits into
base: SNAPSHOT
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion main/ejml-simple/src/org/ejml/simple/ConstMatrix.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public interface ConstMatrix<T extends ConstMatrix<T>> {
T plus( double beta, ConstMatrix<?> B );

/**
* Computes the dot product (a.k.a. inner product) between this vector and vector 'v'.
* Computes the dot product (or inner product) between this vector and vector 'v'.
*
* @param v The second vector in the dot product. Not modified.
* @return dot product
Expand Down
50 changes: 49 additions & 1 deletion main/ejml-simple/src/org/ejml/simple/SimpleBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,32 +104,80 @@ protected T createComplexMatrix( int numRows, int numCols ) {
* when an operation is needed that is not provided by this class.
* </p>
*
* @return Reference to the internal DMatrixRMaj.
* @return Reference to the internal matrix.
*/
public <InnerType extends Matrix> InnerType getMatrix() {
return (InnerType)mat;
}

/**
* <p>
* Returns a reference to the matrix that it uses internally if this is a {@link DMatrixRMaj}.
* Otherwise attempts to convert the internal matrix to a {@link DMatrixRMaj}.
* </p>
*
* @return Reference to the internal matrix or converted internal matrix.
*/
public DMatrixRMaj getDDRM() {
return (mat.getType() == MatrixType.DDRM) ? (DMatrixRMaj)mat : (DMatrixRMaj)ConvertMatrixType.convert(mat, MatrixType.DDRM);
}

/**
* <p>
* Returns a reference to the matrix that it uses internally if this is a {@link FMatrixRMaj}.
* Otherwise attempts to convert the internal matrix to a {@link FMatrixRMaj}.
* </p>
*
* @return Reference to the internal matrix or converted internal matrix.
*/
public FMatrixRMaj getFDRM() {
return (mat.getType() == MatrixType.FDRM) ? (FMatrixRMaj)mat : (FMatrixRMaj)ConvertMatrixType.convert(mat, MatrixType.FDRM);
}

/**
* <p>
* Returns a reference to the matrix that it uses internally if this is a {@link ZMatrixRMaj}.
* Otherwise attempts to convert the internal matrix to a {@link ZMatrixRMaj}.
* </p>
*
* @return Reference to the internal matrix or converted internal matrix.
*/
public ZMatrixRMaj getZDRM() {
return (mat.getType() == MatrixType.ZDRM) ? (ZMatrixRMaj)mat : (ZMatrixRMaj)ConvertMatrixType.convert(mat, MatrixType.ZDRM);
}

/**
* <p>
* Returns a reference to the matrix that it uses internally if this is a {@link CMatrixRMaj}.
* Otherwise attempts to convert the internal matrix to a {@link CMatrixRMaj}.
* </p>
*
* @return Reference to the internal matrix or converted internal matrix.
*/
public CMatrixRMaj getCDRM() {
return (mat.getType() == MatrixType.CDRM) ? (CMatrixRMaj)mat : (CMatrixRMaj)ConvertMatrixType.convert(mat, MatrixType.CDRM);
}

/**
* <p>
* Returns a reference to the matrix that it uses internally if this is a {@link DMatrixSparseCSC}.
* Otherwise attempts to convert the internal matrix to a {@link DMatrixSparseCSC}.
* </p>
*
* @return Reference to the internal matrix or converted internal matrix.
*/
public DMatrixSparseCSC getDSCC() {
return (mat.getType() == MatrixType.DSCC) ? (DMatrixSparseCSC)mat : (DMatrixSparseCSC)ConvertMatrixType.convert(mat, MatrixType.DSCC);
}

/**
* <p>
* Returns a reference to the matrix that it uses internally if this is a {@link FMatrixSparseCSC}.
* Otherwise attempts to convert the internal matrix to a {@link FMatrixSparseCSC}.
* </p>
*
* @return Reference to the internal matrix or converted internal matrix.
*/
public FMatrixSparseCSC getFSCC() {
return (mat.getType() == MatrixType.FSCC) ? (FMatrixSparseCSC)mat : (FMatrixSparseCSC)ConvertMatrixType.convert(mat, MatrixType.FSCC);
}
Expand Down
Loading