repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
lessthanoptimal/ejml | main/ejml-core/src/org/ejml/data/DMatrixSparseCSC.java | DMatrixSparseCSC.growMaxLength | public void growMaxLength( int arrayLength , boolean preserveValue ) {
if( arrayLength < 0 )
throw new IllegalArgumentException("Negative array length. Overflow?");
// see if multiplying numRows*numCols will cause an overflow. If it won't then pick the smaller of the two
if( numRows ... | java | public void growMaxLength( int arrayLength , boolean preserveValue ) {
if( arrayLength < 0 )
throw new IllegalArgumentException("Negative array length. Overflow?");
// see if multiplying numRows*numCols will cause an overflow. If it won't then pick the smaller of the two
if( numRows ... | [
"public",
"void",
"growMaxLength",
"(",
"int",
"arrayLength",
",",
"boolean",
"preserveValue",
")",
"{",
"if",
"(",
"arrayLength",
"<",
"0",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Negative array length. Overflow?\"",
")",
";",
"// see if multiplying ... | Increases the maximum size of the data array so that it can store sparse data up to 'length'. The class
parameter nz_length is not modified by this function call.
@param arrayLength Desired maximum length of sparse data
@param preserveValue If true the old values will be copied into the new arrays. If false that ste... | [
"Increases",
"the",
"maximum",
"size",
"of",
"the",
"data",
"array",
"so",
"that",
"it",
"can",
"store",
"sparse",
"data",
"up",
"to",
"length",
".",
"The",
"class",
"parameter",
"nz_length",
"is",
"not",
"modified",
"by",
"this",
"function",
"call",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/data/DMatrixSparseCSC.java#L332-L354 | train |
lessthanoptimal/ejml | main/ejml-core/src/org/ejml/data/DMatrixSparseCSC.java | DMatrixSparseCSC.growMaxColumns | public void growMaxColumns( int desiredColumns , boolean preserveValue ) {
if( col_idx.length < desiredColumns+1 ) {
int[] c = new int[ desiredColumns+1 ];
if( preserveValue )
System.arraycopy(col_idx,0,c,0,col_idx.length);
col_idx = c;
}
} | java | public void growMaxColumns( int desiredColumns , boolean preserveValue ) {
if( col_idx.length < desiredColumns+1 ) {
int[] c = new int[ desiredColumns+1 ];
if( preserveValue )
System.arraycopy(col_idx,0,c,0,col_idx.length);
col_idx = c;
}
} | [
"public",
"void",
"growMaxColumns",
"(",
"int",
"desiredColumns",
",",
"boolean",
"preserveValue",
")",
"{",
"if",
"(",
"col_idx",
".",
"length",
"<",
"desiredColumns",
"+",
"1",
")",
"{",
"int",
"[",
"]",
"c",
"=",
"new",
"int",
"[",
"desiredColumns",
"... | Increases the maximum number of columns in the matrix.
@param desiredColumns Desired number of columns.
@param preserveValue If the array needs to be expanded should it copy the previous values? | [
"Increases",
"the",
"maximum",
"number",
"of",
"columns",
"in",
"the",
"matrix",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/data/DMatrixSparseCSC.java#L361-L368 | train |
lessthanoptimal/ejml | main/ejml-core/src/org/ejml/data/DMatrixSparseCSC.java | DMatrixSparseCSC.histogramToStructure | public void histogramToStructure(int histogram[] ) {
col_idx[0] = 0;
int index = 0;
for (int i = 1; i <= numCols; i++) {
col_idx[i] = index += histogram[i-1];
}
nz_length = index;
growMaxLength( nz_length , false);
if( col_idx[numCols] != nz_length )
... | java | public void histogramToStructure(int histogram[] ) {
col_idx[0] = 0;
int index = 0;
for (int i = 1; i <= numCols; i++) {
col_idx[i] = index += histogram[i-1];
}
nz_length = index;
growMaxLength( nz_length , false);
if( col_idx[numCols] != nz_length )
... | [
"public",
"void",
"histogramToStructure",
"(",
"int",
"histogram",
"[",
"]",
")",
"{",
"col_idx",
"[",
"0",
"]",
"=",
"0",
";",
"int",
"index",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<=",
"numCols",
";",
"i",
"++",
")",
"{"... | Given the histogram of columns compute the col_idx for the matrix. nz_length is automatically set and
nz_values will grow if needed.
@param histogram histogram of column values in the sparse matrix. modified, see above. | [
"Given",
"the",
"histogram",
"of",
"columns",
"compute",
"the",
"col_idx",
"for",
"the",
"matrix",
".",
"nz_length",
"is",
"automatically",
"set",
"and",
"nz_values",
"will",
"grow",
"if",
"needed",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/data/DMatrixSparseCSC.java#L375-L385 | train |
lessthanoptimal/ejml | main/ejml-core/src/org/ejml/data/DMatrixSparseCSC.java | DMatrixSparseCSC.sortIndices | public void sortIndices(SortCoupledArray_F64 sorter ) {
if( sorter == null )
sorter = new SortCoupledArray_F64();
sorter.quick(col_idx,numCols+1,nz_rows,nz_values);
indicesSorted = true;
} | java | public void sortIndices(SortCoupledArray_F64 sorter ) {
if( sorter == null )
sorter = new SortCoupledArray_F64();
sorter.quick(col_idx,numCols+1,nz_rows,nz_values);
indicesSorted = true;
} | [
"public",
"void",
"sortIndices",
"(",
"SortCoupledArray_F64",
"sorter",
")",
"{",
"if",
"(",
"sorter",
"==",
"null",
")",
"sorter",
"=",
"new",
"SortCoupledArray_F64",
"(",
")",
";",
"sorter",
".",
"quick",
"(",
"col_idx",
",",
"numCols",
"+",
"1",
",",
... | Sorts the row indices in ascending order.
@param sorter (Optional) Used to sort rows. If null a new instance will be declared internally. | [
"Sorts",
"the",
"row",
"indices",
"in",
"ascending",
"order",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/data/DMatrixSparseCSC.java#L391-L397 | train |
lessthanoptimal/ejml | main/ejml-core/src/org/ejml/data/DMatrixSparseCSC.java | DMatrixSparseCSC.copyStructure | public void copyStructure( DMatrixSparseCSC orig ) {
reshape(orig.numRows, orig.numCols, orig.nz_length);
this.nz_length = orig.nz_length;
System.arraycopy(orig.col_idx,0,col_idx,0,orig.numCols+1);
System.arraycopy(orig.nz_rows,0,nz_rows,0,orig.nz_length);
} | java | public void copyStructure( DMatrixSparseCSC orig ) {
reshape(orig.numRows, orig.numCols, orig.nz_length);
this.nz_length = orig.nz_length;
System.arraycopy(orig.col_idx,0,col_idx,0,orig.numCols+1);
System.arraycopy(orig.nz_rows,0,nz_rows,0,orig.nz_length);
} | [
"public",
"void",
"copyStructure",
"(",
"DMatrixSparseCSC",
"orig",
")",
"{",
"reshape",
"(",
"orig",
".",
"numRows",
",",
"orig",
".",
"numCols",
",",
"orig",
".",
"nz_length",
")",
";",
"this",
".",
"nz_length",
"=",
"orig",
".",
"nz_length",
";",
"Sys... | Copies the non-zero structure of orig into "this"
@param orig Matrix who's structure is to be copied | [
"Copies",
"the",
"non",
"-",
"zero",
"structure",
"of",
"orig",
"into",
"this"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/data/DMatrixSparseCSC.java#L403-L408 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/block/decomposition/bidiagonal/BidiagonalHelper_DDRB.java | BidiagonalHelper_DDRB.bidiagOuterBlocks | public static boolean bidiagOuterBlocks( final int blockLength ,
final DSubmatrixD1 A ,
final double gammasU[],
final double gammasV[])
{
// System.out.println("---------- Or... | java | public static boolean bidiagOuterBlocks( final int blockLength ,
final DSubmatrixD1 A ,
final double gammasU[],
final double gammasV[])
{
// System.out.println("---------- Or... | [
"public",
"static",
"boolean",
"bidiagOuterBlocks",
"(",
"final",
"int",
"blockLength",
",",
"final",
"DSubmatrixD1",
"A",
",",
"final",
"double",
"gammasU",
"[",
"]",
",",
"final",
"double",
"gammasV",
"[",
"]",
")",
"{",
"// System.out.println(\"---------... | Performs a standard bidiagonal decomposition just on the outer blocks of the provided matrix
@param blockLength
@param A
@param gammasU | [
"Performs",
"a",
"standard",
"bidiagonal",
"decomposition",
"just",
"on",
"the",
"outer",
"blocks",
"of",
"the",
"provided",
"matrix"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/block/decomposition/bidiagonal/BidiagonalHelper_DDRB.java#L39-L88 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/block/linsol/chol/CholeskyOuterSolver_DDRB.java | CholeskyOuterSolver_DDRB.setA | @Override
public boolean setA(DMatrixRBlock A) {
// Extract a lower triangular solution
if( !decomposer.decompose(A) )
return false;
blockLength = A.blockLength;
return true;
} | java | @Override
public boolean setA(DMatrixRBlock A) {
// Extract a lower triangular solution
if( !decomposer.decompose(A) )
return false;
blockLength = A.blockLength;
return true;
} | [
"@",
"Override",
"public",
"boolean",
"setA",
"(",
"DMatrixRBlock",
"A",
")",
"{",
"// Extract a lower triangular solution",
"if",
"(",
"!",
"decomposer",
".",
"decompose",
"(",
"A",
")",
")",
"return",
"false",
";",
"blockLength",
"=",
"A",
".",
"blockLength"... | Decomposes and overwrites the input matrix.
@param A Semi-Positive Definite (SPD) system matrix. Modified. Reference saved.
@return If the matrix can be decomposed. Will always return false of not SPD. | [
"Decomposes",
"and",
"overwrites",
"the",
"input",
"matrix",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/block/linsol/chol/CholeskyOuterSolver_DDRB.java#L67-L76 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/block/linsol/chol/CholeskyOuterSolver_DDRB.java | CholeskyOuterSolver_DDRB.solve | @Override
public void solve(DMatrixRBlock B, DMatrixRBlock X) {
if( B.blockLength != blockLength )
throw new IllegalArgumentException("Unexpected blocklength in B.");
DSubmatrixD1 L = new DSubmatrixD1(decomposer.getT(null));
if( X != null ) {
if( X.blockLength != bl... | java | @Override
public void solve(DMatrixRBlock B, DMatrixRBlock X) {
if( B.blockLength != blockLength )
throw new IllegalArgumentException("Unexpected blocklength in B.");
DSubmatrixD1 L = new DSubmatrixD1(decomposer.getT(null));
if( X != null ) {
if( X.blockLength != bl... | [
"@",
"Override",
"public",
"void",
"solve",
"(",
"DMatrixRBlock",
"B",
",",
"DMatrixRBlock",
"X",
")",
"{",
"if",
"(",
"B",
".",
"blockLength",
"!=",
"blockLength",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Unexpected blocklength in B.\"",
")",
";... | If X == null then the solution is written into B. Otherwise the solution is copied
from B into X. | [
"If",
"X",
"==",
"null",
"then",
"the",
"solution",
"is",
"written",
"into",
"B",
".",
"Otherwise",
"the",
"solution",
"is",
"copied",
"from",
"B",
"into",
"X",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/block/linsol/chol/CholeskyOuterSolver_DDRB.java#L87-L115 | train |
lessthanoptimal/ejml | main/ejml-core/src/org/ejml/data/IGrowArray.java | IGrowArray.growInternal | public void growInternal(int amount ) {
int tmp[] = new int[ data.length + amount ];
System.arraycopy(data,0,tmp,0,data.length);
this.data = tmp;
} | java | public void growInternal(int amount ) {
int tmp[] = new int[ data.length + amount ];
System.arraycopy(data,0,tmp,0,data.length);
this.data = tmp;
} | [
"public",
"void",
"growInternal",
"(",
"int",
"amount",
")",
"{",
"int",
"tmp",
"[",
"]",
"=",
"new",
"int",
"[",
"data",
".",
"length",
"+",
"amount",
"]",
";",
"System",
".",
"arraycopy",
"(",
"data",
",",
"0",
",",
"tmp",
",",
"0",
",",
"data"... | Increases the internal array's length by the specified amount. Previous values are preserved.
The length value is not modified since this does not change the 'meaning' of the array, just
increases the amount of data which can be stored in it.
this.data = new data_type[ data.length + amount ]
@param amount Number of ... | [
"Increases",
"the",
"internal",
"array",
"s",
"length",
"by",
"the",
"specified",
"amount",
".",
"Previous",
"values",
"are",
"preserved",
".",
"The",
"length",
"value",
"is",
"not",
"modified",
"since",
"this",
"does",
"not",
"change",
"the",
"meaning",
"of... | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/data/IGrowArray.java#L60-L65 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/block/decomposition/chol/InnerCholesky_DDRB.java | InnerCholesky_DDRB.lower | public static boolean lower( double[]T , int indexT , int n ) {
double el_ii;
double div_el_ii=0;
for( int i = 0; i < n; i++ ) {
for( int j = i; j < n; j++ ) {
double sum = T[ indexT + j*n+i];
// todo optimize
for( int k = 0; k < i; k... | java | public static boolean lower( double[]T , int indexT , int n ) {
double el_ii;
double div_el_ii=0;
for( int i = 0; i < n; i++ ) {
for( int j = i; j < n; j++ ) {
double sum = T[ indexT + j*n+i];
// todo optimize
for( int k = 0; k < i; k... | [
"public",
"static",
"boolean",
"lower",
"(",
"double",
"[",
"]",
"T",
",",
"int",
"indexT",
",",
"int",
"n",
")",
"{",
"double",
"el_ii",
";",
"double",
"div_el_ii",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"i",... | Performs an inline lower Cholesky decomposition on an inner row-major matrix. Only
the lower triangular portion of the matrix is read or written to.
@param T Array containing an inner row-major matrix. Modified.
@param indexT First index of the inner row-major matrix.
@param n Number of rows and columns of the matr... | [
"Performs",
"an",
"inline",
"lower",
"Cholesky",
"decomposition",
"on",
"an",
"inner",
"row",
"-",
"major",
"matrix",
".",
"Only",
"the",
"lower",
"triangular",
"portion",
"of",
"the",
"matrix",
"is",
"read",
"or",
"written",
"to",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/block/decomposition/chol/InnerCholesky_DDRB.java#L97-L125 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/factory/LinearSolverFactory_DDRM.java | LinearSolverFactory_DDRM.general | public static LinearSolverDense<DMatrixRMaj> general(int numRows , int numCols ) {
if( numRows == numCols )
return linear(numRows);
else
return leastSquares(numRows,numCols);
} | java | public static LinearSolverDense<DMatrixRMaj> general(int numRows , int numCols ) {
if( numRows == numCols )
return linear(numRows);
else
return leastSquares(numRows,numCols);
} | [
"public",
"static",
"LinearSolverDense",
"<",
"DMatrixRMaj",
">",
"general",
"(",
"int",
"numRows",
",",
"int",
"numCols",
")",
"{",
"if",
"(",
"numRows",
"==",
"numCols",
")",
"return",
"linear",
"(",
"numRows",
")",
";",
"else",
"return",
"leastSquares",
... | Creates a general purpose solver. Use this if you are not sure what you need.
@param numRows The number of rows that the decomposition is optimized for.
@param numCols The number of columns that the decomposition is optimized for. | [
"Creates",
"a",
"general",
"purpose",
"solver",
".",
"Use",
"this",
"if",
"you",
"are",
"not",
"sure",
"what",
"you",
"need",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/factory/LinearSolverFactory_DDRM.java#L77-L82 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/factory/LinearSolverFactory_DDRM.java | LinearSolverFactory_DDRM.symmPosDef | public static LinearSolverDense<DMatrixRMaj> symmPosDef(int matrixWidth ) {
if(matrixWidth < EjmlParameters.SWITCH_BLOCK64_CHOLESKY ) {
CholeskyDecompositionCommon_DDRM decomp = new CholeskyDecompositionInner_DDRM(true);
return new LinearSolverChol_DDRM(decomp);
} else {
... | java | public static LinearSolverDense<DMatrixRMaj> symmPosDef(int matrixWidth ) {
if(matrixWidth < EjmlParameters.SWITCH_BLOCK64_CHOLESKY ) {
CholeskyDecompositionCommon_DDRM decomp = new CholeskyDecompositionInner_DDRM(true);
return new LinearSolverChol_DDRM(decomp);
} else {
... | [
"public",
"static",
"LinearSolverDense",
"<",
"DMatrixRMaj",
">",
"symmPosDef",
"(",
"int",
"matrixWidth",
")",
"{",
"if",
"(",
"matrixWidth",
"<",
"EjmlParameters",
".",
"SWITCH_BLOCK64_CHOLESKY",
")",
"{",
"CholeskyDecompositionCommon_DDRM",
"decomp",
"=",
"new",
... | Creates a solver for symmetric positive definite matrices.
@return A new solver for symmetric positive definite matrices. | [
"Creates",
"a",
"solver",
"for",
"symmetric",
"positive",
"definite",
"matrices",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/factory/LinearSolverFactory_DDRM.java#L117-L129 | train |
lessthanoptimal/ejml | examples/src/org/ejml/example/LevenbergMarquardt.java | LevenbergMarquardt.setConvergence | public void setConvergence( int maxIterations , double ftol , double gtol ) {
this.maxIterations = maxIterations;
this.ftol = ftol;
this.gtol = gtol;
} | java | public void setConvergence( int maxIterations , double ftol , double gtol ) {
this.maxIterations = maxIterations;
this.ftol = ftol;
this.gtol = gtol;
} | [
"public",
"void",
"setConvergence",
"(",
"int",
"maxIterations",
",",
"double",
"ftol",
",",
"double",
"gtol",
")",
"{",
"this",
".",
"maxIterations",
"=",
"maxIterations",
";",
"this",
".",
"ftol",
"=",
"ftol",
";",
"this",
".",
"gtol",
"=",
"gtol",
";"... | Specifies convergence criteria
@param maxIterations Maximum number of iterations
@param ftol convergence based on change in function value. try 1e-12
@param gtol convergence based on residual magnitude. Try 1e-12 | [
"Specifies",
"convergence",
"criteria"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/examples/src/org/ejml/example/LevenbergMarquardt.java#L107-L111 | train |
lessthanoptimal/ejml | examples/src/org/ejml/example/LevenbergMarquardt.java | LevenbergMarquardt.computeGradientAndHessian | private void computeGradientAndHessian(DMatrixRMaj param )
{
// residuals = f(x) - y
function.compute(param, residuals);
computeNumericalJacobian(param,jacobian);
CommonOps_DDRM.multTransA(jacobian, residuals, g);
CommonOps_DDRM.multTransA(jacobian, jacobian, H);
... | java | private void computeGradientAndHessian(DMatrixRMaj param )
{
// residuals = f(x) - y
function.compute(param, residuals);
computeNumericalJacobian(param,jacobian);
CommonOps_DDRM.multTransA(jacobian, residuals, g);
CommonOps_DDRM.multTransA(jacobian, jacobian, H);
... | [
"private",
"void",
"computeGradientAndHessian",
"(",
"DMatrixRMaj",
"param",
")",
"{",
"// residuals = f(x) - y",
"function",
".",
"compute",
"(",
"param",
",",
"residuals",
")",
";",
"computeNumericalJacobian",
"(",
"param",
",",
"jacobian",
")",
";",
"CommonOps_DD... | Computes the d and H parameters.
d = J'*(f(x)-y) <--- that's also the gradient
H = J'*J | [
"Computes",
"the",
"d",
"and",
"H",
"parameters",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/examples/src/org/ejml/example/LevenbergMarquardt.java#L217-L228 | train |
lessthanoptimal/ejml | main/ejml-core/src/org/ejml/data/DMatrixRMaj.java | DMatrixRMaj.wrap | public static DMatrixRMaj wrap(int numRows , int numCols , double []data ) {
DMatrixRMaj s = new DMatrixRMaj();
s.data = data;
s.numRows = numRows;
s.numCols = numCols;
return s;
} | java | public static DMatrixRMaj wrap(int numRows , int numCols , double []data ) {
DMatrixRMaj s = new DMatrixRMaj();
s.data = data;
s.numRows = numRows;
s.numCols = numCols;
return s;
} | [
"public",
"static",
"DMatrixRMaj",
"wrap",
"(",
"int",
"numRows",
",",
"int",
"numCols",
",",
"double",
"[",
"]",
"data",
")",
"{",
"DMatrixRMaj",
"s",
"=",
"new",
"DMatrixRMaj",
"(",
")",
";",
"s",
".",
"data",
"=",
"data",
";",
"s",
".",
"numRows",... | Creates a new DMatrixRMaj around the provided data. The data must encode
a row-major matrix. Any modification to the returned matrix will modify the
provided data.
@param numRows Number of rows in the matrix.
@param numCols Number of columns in the matrix.
@param data Data that is being wrapped. Referenced Saved.
@r... | [
"Creates",
"a",
"new",
"DMatrixRMaj",
"around",
"the",
"provided",
"data",
".",
"The",
"data",
"must",
"encode",
"a",
"row",
"-",
"major",
"matrix",
".",
"Any",
"modification",
"to",
"the",
"returned",
"matrix",
"will",
"modify",
"the",
"provided",
"data",
... | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/data/DMatrixRMaj.java#L175-L182 | train |
lessthanoptimal/ejml | main/ejml-core/src/org/ejml/data/DMatrixRMaj.java | DMatrixRMaj.add | public void add( int row , int col , double value ) {
if( col < 0 || col >= numCols || row < 0 || row >= numRows ) {
throw new IllegalArgumentException("Specified element is out of bounds");
}
data[ row * numCols + col ] += value;
} | java | public void add( int row , int col , double value ) {
if( col < 0 || col >= numCols || row < 0 || row >= numRows ) {
throw new IllegalArgumentException("Specified element is out of bounds");
}
data[ row * numCols + col ] += value;
} | [
"public",
"void",
"add",
"(",
"int",
"row",
",",
"int",
"col",
",",
"double",
"value",
")",
"{",
"if",
"(",
"col",
"<",
"0",
"||",
"col",
">=",
"numCols",
"||",
"row",
"<",
"0",
"||",
"row",
">=",
"numRows",
")",
"{",
"throw",
"new",
"IllegalArgu... | todo move to commonops | [
"todo",
"move",
"to",
"commonops"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/data/DMatrixRMaj.java#L238-L244 | train |
lessthanoptimal/ejml | main/ejml-core/src/org/ejml/data/DMatrixRMaj.java | DMatrixRMaj.get | @Override
public double get( int row , int col ) {
if( col < 0 || col >= numCols || row < 0 || row >= numRows ) {
throw new IllegalArgumentException("Specified element is out of bounds: "+row+" "+col);
}
return data[ row * numCols + col ];
} | java | @Override
public double get( int row , int col ) {
if( col < 0 || col >= numCols || row < 0 || row >= numRows ) {
throw new IllegalArgumentException("Specified element is out of bounds: "+row+" "+col);
}
return data[ row * numCols + col ];
} | [
"@",
"Override",
"public",
"double",
"get",
"(",
"int",
"row",
",",
"int",
"col",
")",
"{",
"if",
"(",
"col",
"<",
"0",
"||",
"col",
">=",
"numCols",
"||",
"row",
"<",
"0",
"||",
"row",
">=",
"numRows",
")",
"{",
"throw",
"new",
"IllegalArgumentExc... | Returns the value of the specified matrix element. Performs a bounds check to make sure
the requested element is part of the matrix.
@param row The row of the element.
@param col The column of the element.
@return The value of the element. | [
"Returns",
"the",
"value",
"of",
"the",
"specified",
"matrix",
"element",
".",
"Performs",
"a",
"bounds",
"check",
"to",
"make",
"sure",
"the",
"requested",
"element",
"is",
"part",
"of",
"the",
"matrix",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/data/DMatrixRMaj.java#L254-L261 | train |
lessthanoptimal/ejml | main/ejml-core/src/org/ejml/data/DMatrixRMaj.java | DMatrixRMaj.set | public void set(int numRows, int numCols, boolean rowMajor, double ...data)
{
reshape(numRows,numCols);
int length = numRows*numCols;
if( length > this.data.length )
throw new IllegalArgumentException("The length of this matrix's data array is too small.");
if( rowMajor... | java | public void set(int numRows, int numCols, boolean rowMajor, double ...data)
{
reshape(numRows,numCols);
int length = numRows*numCols;
if( length > this.data.length )
throw new IllegalArgumentException("The length of this matrix's data array is too small.");
if( rowMajor... | [
"public",
"void",
"set",
"(",
"int",
"numRows",
",",
"int",
"numCols",
",",
"boolean",
"rowMajor",
",",
"double",
"...",
"data",
")",
"{",
"reshape",
"(",
"numRows",
",",
"numCols",
")",
";",
"int",
"length",
"=",
"numRows",
"*",
"numCols",
";",
"if",
... | Sets this matrix equal to the matrix encoded in the array.
@param numRows The number of rows.
@param numCols The number of columns.
@param rowMajor If the array is encoded in a row-major or a column-major format.
@param data The formatted 1D array. Not modified. | [
"Sets",
"this",
"matrix",
"equal",
"to",
"the",
"matrix",
"encoded",
"in",
"the",
"array",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/data/DMatrixRMaj.java#L303-L321 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/linsol/chol/LinearSolverChol_DDRB.java | LinearSolverChol_DDRB.solve | @Override
public void solve(DMatrixRMaj B, DMatrixRMaj X) {
blockB.reshape(B.numRows,B.numCols,false);
MatrixOps_DDRB.convert(B,blockB);
// since overwrite B is true X does not need to be passed in
alg.solve(blockB,null);
MatrixOps_DDRB.convert(blockB,X);
} | java | @Override
public void solve(DMatrixRMaj B, DMatrixRMaj X) {
blockB.reshape(B.numRows,B.numCols,false);
MatrixOps_DDRB.convert(B,blockB);
// since overwrite B is true X does not need to be passed in
alg.solve(blockB,null);
MatrixOps_DDRB.convert(blockB,X);
} | [
"@",
"Override",
"public",
"void",
"solve",
"(",
"DMatrixRMaj",
"B",
",",
"DMatrixRMaj",
"X",
")",
"{",
"blockB",
".",
"reshape",
"(",
"B",
".",
"numRows",
",",
"B",
".",
"numCols",
",",
"false",
")",
";",
"MatrixOps_DDRB",
".",
"convert",
"(",
"B",
... | Only converts the B matrix and passes that onto solve. Te result is then copied into
the input 'X' matrix.
@param B A matrix ℜ <sup>m × p</sup>. Not modified.
@param X A matrix ℜ <sup>n × p</sup>, where the solution is written to. Modified. | [
"Only",
"converts",
"the",
"B",
"matrix",
"and",
"passes",
"that",
"onto",
"solve",
".",
"Te",
"result",
"is",
"then",
"copied",
"into",
"the",
"input",
"X",
"matrix",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/linsol/chol/LinearSolverChol_DDRB.java#L47-L56 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/simple/SimpleEVD.java | SimpleEVD.getEigenvalues | public List<Complex_F64> getEigenvalues() {
List<Complex_F64> ret = new ArrayList<Complex_F64>();
if( is64 ) {
EigenDecomposition_F64 d = (EigenDecomposition_F64)eig;
for (int i = 0; i < eig.getNumberOfEigenvalues(); i++) {
ret.add(d.getEigenvalue(i));
... | java | public List<Complex_F64> getEigenvalues() {
List<Complex_F64> ret = new ArrayList<Complex_F64>();
if( is64 ) {
EigenDecomposition_F64 d = (EigenDecomposition_F64)eig;
for (int i = 0; i < eig.getNumberOfEigenvalues(); i++) {
ret.add(d.getEigenvalue(i));
... | [
"public",
"List",
"<",
"Complex_F64",
">",
"getEigenvalues",
"(",
")",
"{",
"List",
"<",
"Complex_F64",
">",
"ret",
"=",
"new",
"ArrayList",
"<",
"Complex_F64",
">",
"(",
")",
";",
"if",
"(",
"is64",
")",
"{",
"EigenDecomposition_F64",
"d",
"=",
"(",
"... | Returns a list of all the eigenvalues | [
"Returns",
"a",
"list",
"of",
"all",
"the",
"eigenvalues"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/simple/SimpleEVD.java#L63-L80 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/simple/SimpleEVD.java | SimpleEVD.getIndexMax | public int getIndexMax() {
int indexMax = 0;
double max = getEigenvalue(0).getMagnitude2();
final int N = getNumberOfEigenvalues();
for( int i = 1; i < N; i++ ) {
double m = getEigenvalue(i).getMagnitude2();
if( m > max ) {
max = m;
... | java | public int getIndexMax() {
int indexMax = 0;
double max = getEigenvalue(0).getMagnitude2();
final int N = getNumberOfEigenvalues();
for( int i = 1; i < N; i++ ) {
double m = getEigenvalue(i).getMagnitude2();
if( m > max ) {
max = m;
... | [
"public",
"int",
"getIndexMax",
"(",
")",
"{",
"int",
"indexMax",
"=",
"0",
";",
"double",
"max",
"=",
"getEigenvalue",
"(",
"0",
")",
".",
"getMagnitude2",
"(",
")",
";",
"final",
"int",
"N",
"=",
"getNumberOfEigenvalues",
"(",
")",
";",
"for",
"(",
... | Returns the index of the eigenvalue which has the largest magnitude.
@return index of the largest magnitude eigen value. | [
"Returns",
"the",
"index",
"of",
"the",
"eigenvalue",
"which",
"has",
"the",
"largest",
"magnitude",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/simple/SimpleEVD.java#L166-L180 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/simple/SimpleEVD.java | SimpleEVD.getIndexMin | public int getIndexMin() {
int indexMin = 0;
double min = getEigenvalue(0).getMagnitude2();
final int N = getNumberOfEigenvalues();
for( int i = 1; i < N; i++ ) {
double m = getEigenvalue(i).getMagnitude2();
if( m < min ) {
min = m;
... | java | public int getIndexMin() {
int indexMin = 0;
double min = getEigenvalue(0).getMagnitude2();
final int N = getNumberOfEigenvalues();
for( int i = 1; i < N; i++ ) {
double m = getEigenvalue(i).getMagnitude2();
if( m < min ) {
min = m;
... | [
"public",
"int",
"getIndexMin",
"(",
")",
"{",
"int",
"indexMin",
"=",
"0",
";",
"double",
"min",
"=",
"getEigenvalue",
"(",
"0",
")",
".",
"getMagnitude2",
"(",
")",
";",
"final",
"int",
"N",
"=",
"getNumberOfEigenvalues",
"(",
")",
";",
"for",
"(",
... | Returns the index of the eigenvalue which has the smallest magnitude.
@return index of the smallest magnitude eigen value. | [
"Returns",
"the",
"index",
"of",
"the",
"eigenvalue",
"which",
"has",
"the",
"smallest",
"magnitude",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/simple/SimpleEVD.java#L187-L201 | train |
lessthanoptimal/ejml | main/ejml-dsparse/src/org/ejml/sparse/csc/decomposition/qr/QrStructuralCounts_DSCC.java | QrStructuralCounts_DSCC.process | public boolean process( DMatrixSparseCSC A ) {
init(A);
TriangularSolver_DSCC.eliminationTree(A,true,parent,gwork);
countNonZeroInR(parent);
countNonZeroInV(parent);
// if more columns than rows it's possible that Q*R != A. That's because a householder
// would need to... | java | public boolean process( DMatrixSparseCSC A ) {
init(A);
TriangularSolver_DSCC.eliminationTree(A,true,parent,gwork);
countNonZeroInR(parent);
countNonZeroInV(parent);
// if more columns than rows it's possible that Q*R != A. That's because a householder
// would need to... | [
"public",
"boolean",
"process",
"(",
"DMatrixSparseCSC",
"A",
")",
"{",
"init",
"(",
"A",
")",
";",
"TriangularSolver_DSCC",
".",
"eliminationTree",
"(",
"A",
",",
"true",
",",
"parent",
",",
"gwork",
")",
";",
"countNonZeroInR",
"(",
"parent",
")",
";",
... | Examins the structure of A for QR decomposition
@param A matrix which is to be decomposed
@return true if the solution is valid or false if the decomposition can't be performed (i.e. requires column pivots) | [
"Examins",
"the",
"structure",
"of",
"A",
"for",
"QR",
"decomposition"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/decomposition/qr/QrStructuralCounts_DSCC.java#L65-L84 | train |
lessthanoptimal/ejml | main/ejml-dsparse/src/org/ejml/sparse/csc/decomposition/qr/QrStructuralCounts_DSCC.java | QrStructuralCounts_DSCC.init | void init( DMatrixSparseCSC A ) {
this.A = A;
this.m = A.numRows;
this.n = A.numCols;
this.next = 0;
this.head = m;
this.tail = m + n;
this.nque = m + 2*n;
if( parent.length < n || leftmost.length < m) {
parent = new int[n];
post ... | java | void init( DMatrixSparseCSC A ) {
this.A = A;
this.m = A.numRows;
this.n = A.numCols;
this.next = 0;
this.head = m;
this.tail = m + n;
this.nque = m + 2*n;
if( parent.length < n || leftmost.length < m) {
parent = new int[n];
post ... | [
"void",
"init",
"(",
"DMatrixSparseCSC",
"A",
")",
"{",
"this",
".",
"A",
"=",
"A",
";",
"this",
".",
"m",
"=",
"A",
".",
"numRows",
";",
"this",
".",
"n",
"=",
"A",
".",
"numCols",
";",
"this",
".",
"next",
"=",
"0",
";",
"this",
".",
"head"... | Initializes data structures | [
"Initializes",
"data",
"structures"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/decomposition/qr/QrStructuralCounts_DSCC.java#L89-L107 | train |
lessthanoptimal/ejml | main/ejml-dsparse/src/org/ejml/sparse/csc/decomposition/qr/QrStructuralCounts_DSCC.java | QrStructuralCounts_DSCC.countNonZeroInR | void countNonZeroInR( int[] parent ) {
TriangularSolver_DSCC.postorder(parent,n,post,gwork);
columnCounts.process(A,parent,post,countsR);
nz_in_R = 0;
for (int k = 0; k < n; k++) {
nz_in_R += countsR[k];
}
if( nz_in_R < 0)
throw new RuntimeExceptio... | java | void countNonZeroInR( int[] parent ) {
TriangularSolver_DSCC.postorder(parent,n,post,gwork);
columnCounts.process(A,parent,post,countsR);
nz_in_R = 0;
for (int k = 0; k < n; k++) {
nz_in_R += countsR[k];
}
if( nz_in_R < 0)
throw new RuntimeExceptio... | [
"void",
"countNonZeroInR",
"(",
"int",
"[",
"]",
"parent",
")",
"{",
"TriangularSolver_DSCC",
".",
"postorder",
"(",
"parent",
",",
"n",
",",
"post",
",",
"gwork",
")",
";",
"columnCounts",
".",
"process",
"(",
"A",
",",
"parent",
",",
"post",
",",
"co... | Count the number of non-zero elements in R | [
"Count",
"the",
"number",
"of",
"non",
"-",
"zero",
"elements",
"in",
"R"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/decomposition/qr/QrStructuralCounts_DSCC.java#L113-L122 | train |
lessthanoptimal/ejml | main/ejml-dsparse/src/org/ejml/sparse/csc/decomposition/qr/QrStructuralCounts_DSCC.java | QrStructuralCounts_DSCC.countNonZeroInV | void countNonZeroInV( int []parent ) {
int []w = gwork.data;
findMinElementIndexInRows(leftmost);
createRowElementLinkedLists(leftmost,w);
countNonZeroUsingLinkedList(parent,w);
} | java | void countNonZeroInV( int []parent ) {
int []w = gwork.data;
findMinElementIndexInRows(leftmost);
createRowElementLinkedLists(leftmost,w);
countNonZeroUsingLinkedList(parent,w);
} | [
"void",
"countNonZeroInV",
"(",
"int",
"[",
"]",
"parent",
")",
"{",
"int",
"[",
"]",
"w",
"=",
"gwork",
".",
"data",
";",
"findMinElementIndexInRows",
"(",
"leftmost",
")",
";",
"createRowElementLinkedLists",
"(",
"leftmost",
",",
"w",
")",
";",
"countNon... | Count the number of non-zero elements in V | [
"Count",
"the",
"number",
"of",
"non",
"-",
"zero",
"elements",
"in",
"V"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/decomposition/qr/QrStructuralCounts_DSCC.java#L127-L132 | train |
lessthanoptimal/ejml | main/ejml-dsparse/src/org/ejml/sparse/csc/decomposition/qr/QrStructuralCounts_DSCC.java | QrStructuralCounts_DSCC.countNonZeroUsingLinkedList | void countNonZeroUsingLinkedList( int parent[] , int ll[] ) {
Arrays.fill(pinv,0,m,-1);
nz_in_V = 0;
m2 = m;
for (int k = 0; k < n; k++) {
int i = ll[head+k]; // remove row i from queue k
nz_in_V++; // count V(k,k) as nonzero
... | java | void countNonZeroUsingLinkedList( int parent[] , int ll[] ) {
Arrays.fill(pinv,0,m,-1);
nz_in_V = 0;
m2 = m;
for (int k = 0; k < n; k++) {
int i = ll[head+k]; // remove row i from queue k
nz_in_V++; // count V(k,k) as nonzero
... | [
"void",
"countNonZeroUsingLinkedList",
"(",
"int",
"parent",
"[",
"]",
",",
"int",
"ll",
"[",
"]",
")",
"{",
"Arrays",
".",
"fill",
"(",
"pinv",
",",
"0",
",",
"m",
",",
"-",
"1",
")",
";",
"nz_in_V",
"=",
"0",
";",
"m2",
"=",
"m",
";",
"for",
... | Non-zero counts of Householder vectors and computes a permutation
matrix that ensures diagonal entires are all structurally nonzero.
@param parent elimination tree
@param ll linked list for each row that specifies elements that are not zero | [
"Non",
"-",
"zero",
"counts",
"of",
"Householder",
"vectors",
"and",
"computes",
"a",
"permutation",
"matrix",
"that",
"ensures",
"diagonal",
"entires",
"are",
"all",
"structurally",
"nonzero",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/decomposition/qr/QrStructuralCounts_DSCC.java#L141-L172 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/Equation.java | Equation.alias | public void alias(DMatrixRMaj variable , String name ) {
if( isReserved(name))
throw new RuntimeException("Reserved word or contains a reserved character");
VariableMatrix old = (VariableMatrix)variables.get(name);
if( old == null ) {
variables.put(name, new VariableMatri... | java | public void alias(DMatrixRMaj variable , String name ) {
if( isReserved(name))
throw new RuntimeException("Reserved word or contains a reserved character");
VariableMatrix old = (VariableMatrix)variables.get(name);
if( old == null ) {
variables.put(name, new VariableMatri... | [
"public",
"void",
"alias",
"(",
"DMatrixRMaj",
"variable",
",",
"String",
"name",
")",
"{",
"if",
"(",
"isReserved",
"(",
"name",
")",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"Reserved word or contains a reserved character\"",
")",
";",
"VariableMatrix",
"... | Adds a new Matrix variable. If one already has the same name it is written over.
While more verbose for multiple variables, this function doesn't require new memory be declared
each time it's called.
@param variable Matrix which is to be assigned to name
@param name The name of the variable | [
"Adds",
"a",
"new",
"Matrix",
"variable",
".",
"If",
"one",
"already",
"has",
"the",
"same",
"name",
"it",
"is",
"written",
"over",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L288-L297 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/Equation.java | Equation.alias | public void alias( double value , String name ) {
if( isReserved(name))
throw new RuntimeException("Reserved word or contains a reserved character. '"+name+"'");
VariableDouble old = (VariableDouble)variables.get(name);
if( old == null ) {
variables.put(name, new Variabl... | java | public void alias( double value , String name ) {
if( isReserved(name))
throw new RuntimeException("Reserved word or contains a reserved character. '"+name+"'");
VariableDouble old = (VariableDouble)variables.get(name);
if( old == null ) {
variables.put(name, new Variabl... | [
"public",
"void",
"alias",
"(",
"double",
"value",
",",
"String",
"name",
")",
"{",
"if",
"(",
"isReserved",
"(",
"name",
")",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"Reserved word or contains a reserved character. '\"",
"+",
"name",
"+",
"\"'\"",
")",
... | Adds a new floating point variable. If one already has the same name it is written over.
@param value Value of the number
@param name Name in code | [
"Adds",
"a",
"new",
"floating",
"point",
"variable",
".",
"If",
"one",
"already",
"has",
"the",
"same",
"name",
"it",
"is",
"written",
"over",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L320-L330 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/Equation.java | Equation.alias | public void alias( Object ...args ) {
if( args.length % 2 == 1 )
throw new RuntimeException("Even number of arguments expected");
for (int i = 0; i < args.length; i += 2) {
aliasGeneric( args[i], (String)args[i+1]);
}
} | java | public void alias( Object ...args ) {
if( args.length % 2 == 1 )
throw new RuntimeException("Even number of arguments expected");
for (int i = 0; i < args.length; i += 2) {
aliasGeneric( args[i], (String)args[i+1]);
}
} | [
"public",
"void",
"alias",
"(",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"args",
".",
"length",
"%",
"2",
"==",
"1",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"Even number of arguments expected\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
... | Creates multiple aliases at once. | [
"Creates",
"multiple",
"aliases",
"at",
"once",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L364-L371 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/Equation.java | Equation.aliasGeneric | protected void aliasGeneric( Object variable , String name ) {
if( variable.getClass() == Integer.class ) {
alias(((Integer)variable).intValue(),name);
} else if( variable.getClass() == Double.class ) {
alias(((Double)variable).doubleValue(),name);
} else if( variable.get... | java | protected void aliasGeneric( Object variable , String name ) {
if( variable.getClass() == Integer.class ) {
alias(((Integer)variable).intValue(),name);
} else if( variable.getClass() == Double.class ) {
alias(((Double)variable).doubleValue(),name);
} else if( variable.get... | [
"protected",
"void",
"aliasGeneric",
"(",
"Object",
"variable",
",",
"String",
"name",
")",
"{",
"if",
"(",
"variable",
".",
"getClass",
"(",
")",
"==",
"Integer",
".",
"class",
")",
"{",
"alias",
"(",
"(",
"(",
"Integer",
")",
"variable",
")",
".",
... | Aliases variables with an unknown type.
@param variable The variable being aliased
@param name Name of the variable | [
"Aliases",
"variables",
"with",
"an",
"unknown",
"type",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L378-L403 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/Equation.java | Equation.compile | public Sequence compile( String equation , boolean assignment, boolean debug ) {
functions.setManagerTemp(managerTemp);
Sequence sequence = new Sequence();
TokenList tokens = extractTokens(equation,managerTemp);
if( tokens.size() < 3 )
throw new RuntimeException("Too few t... | java | public Sequence compile( String equation , boolean assignment, boolean debug ) {
functions.setManagerTemp(managerTemp);
Sequence sequence = new Sequence();
TokenList tokens = extractTokens(equation,managerTemp);
if( tokens.size() < 3 )
throw new RuntimeException("Too few t... | [
"public",
"Sequence",
"compile",
"(",
"String",
"equation",
",",
"boolean",
"assignment",
",",
"boolean",
"debug",
")",
"{",
"functions",
".",
"setManagerTemp",
"(",
"managerTemp",
")",
";",
"Sequence",
"sequence",
"=",
"new",
"Sequence",
"(",
")",
";",
"Tok... | Parses the equation and compiles it into a sequence which can be executed later on
@param equation String in simple equation format.
@param assignment if true an assignment is expected and an exception if thrown if there is non
@param debug if true it will print out debugging information
@return Sequence of operations ... | [
"Parses",
"the",
"equation",
"and",
"compiles",
"it",
"into",
"a",
"sequence",
"which",
"can",
"be",
"executed",
"later",
"on"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L416-L466 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/Equation.java | Equation.parseMacro | private void parseMacro( TokenList tokens , Sequence sequence ) {
Macro macro = new Macro();
TokenList.Token t = tokens.getFirst().next;
if( t.word == null ) {
throw new ParseError("Expected the macro's name after "+tokens.getFirst().word);
}
List<TokenList.Token> v... | java | private void parseMacro( TokenList tokens , Sequence sequence ) {
Macro macro = new Macro();
TokenList.Token t = tokens.getFirst().next;
if( t.word == null ) {
throw new ParseError("Expected the macro's name after "+tokens.getFirst().word);
}
List<TokenList.Token> v... | [
"private",
"void",
"parseMacro",
"(",
"TokenList",
"tokens",
",",
"Sequence",
"sequence",
")",
"{",
"Macro",
"macro",
"=",
"new",
"Macro",
"(",
")",
";",
"TokenList",
".",
"Token",
"t",
"=",
"tokens",
".",
"getFirst",
"(",
")",
".",
"next",
";",
"if",
... | Parse a macro defintion.
"macro NAME( var0 , var1 ) = 5+var0+var1' | [
"Parse",
"a",
"macro",
"defintion",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L518-L542 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/Equation.java | Equation.checkForUnknownVariables | private void checkForUnknownVariables(TokenList tokens) {
TokenList.Token t = tokens.getFirst();
while( t != null ) {
if( t.getType() == Type.WORD )
throw new ParseError("Unknown variable on right side. "+t.getWord());
t = t.next;
}
} | java | private void checkForUnknownVariables(TokenList tokens) {
TokenList.Token t = tokens.getFirst();
while( t != null ) {
if( t.getType() == Type.WORD )
throw new ParseError("Unknown variable on right side. "+t.getWord());
t = t.next;
}
} | [
"private",
"void",
"checkForUnknownVariables",
"(",
"TokenList",
"tokens",
")",
"{",
"TokenList",
".",
"Token",
"t",
"=",
"tokens",
".",
"getFirst",
"(",
")",
";",
"while",
"(",
"t",
"!=",
"null",
")",
"{",
"if",
"(",
"t",
".",
"getType",
"(",
")",
"... | Examines the list of variables for any unknown variables and throws an exception if one is found | [
"Examines",
"the",
"list",
"of",
"variables",
"for",
"any",
"unknown",
"variables",
"and",
"throws",
"an",
"exception",
"if",
"one",
"is",
"found"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L571-L578 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/Equation.java | Equation.createVariableInferred | private Variable createVariableInferred(TokenList.Token t0, Variable variableRight) {
Variable result;
if( t0.getType() == Type.WORD ) {
switch( variableRight.getType()) {
case MATRIX:
alias(new DMatrixRMaj(1,1),t0.getWord());
break;
... | java | private Variable createVariableInferred(TokenList.Token t0, Variable variableRight) {
Variable result;
if( t0.getType() == Type.WORD ) {
switch( variableRight.getType()) {
case MATRIX:
alias(new DMatrixRMaj(1,1),t0.getWord());
break;
... | [
"private",
"Variable",
"createVariableInferred",
"(",
"TokenList",
".",
"Token",
"t0",
",",
"Variable",
"variableRight",
")",
"{",
"Variable",
"result",
";",
"if",
"(",
"t0",
".",
"getType",
"(",
")",
"==",
"Type",
".",
"WORD",
")",
"{",
"switch",
"(",
"... | Infer the type of and create a new output variable using the results from the right side of the equation.
If the type is already known just return that. | [
"Infer",
"the",
"type",
"of",
"and",
"create",
"a",
"new",
"output",
"variable",
"using",
"the",
"results",
"from",
"the",
"right",
"side",
"of",
"the",
"equation",
".",
"If",
"the",
"type",
"is",
"already",
"known",
"just",
"return",
"that",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L584-L614 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/Equation.java | Equation.parseAssignRange | private List<Variable> parseAssignRange(Sequence sequence, TokenList tokens, TokenList.Token t0) {
// find assignment symbol
TokenList.Token tokenAssign = t0.next;
while( tokenAssign != null && tokenAssign.symbol != Symbol.ASSIGN ) {
tokenAssign = tokenAssign.next;
}
... | java | private List<Variable> parseAssignRange(Sequence sequence, TokenList tokens, TokenList.Token t0) {
// find assignment symbol
TokenList.Token tokenAssign = t0.next;
while( tokenAssign != null && tokenAssign.symbol != Symbol.ASSIGN ) {
tokenAssign = tokenAssign.next;
}
... | [
"private",
"List",
"<",
"Variable",
">",
"parseAssignRange",
"(",
"Sequence",
"sequence",
",",
"TokenList",
"tokens",
",",
"TokenList",
".",
"Token",
"t0",
")",
"{",
"// find assignment symbol",
"TokenList",
".",
"Token",
"tokenAssign",
"=",
"t0",
".",
"next",
... | See if a range for assignment is specified. If so return the range, otherwise return null
Example of assign range:
a(0:3,4:5) = blah
a((0+2):3,4:5) = blah | [
"See",
"if",
"a",
"range",
"for",
"assignment",
"is",
"specified",
".",
"If",
"so",
"return",
"the",
"range",
"otherwise",
"return",
"null"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L623-L659 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/Equation.java | Equation.handleParentheses | protected void handleParentheses( TokenList tokens, Sequence sequence ) {
// have a list to handle embedded parentheses, e.g. (((((a)))))
List<TokenList.Token> left = new ArrayList<TokenList.Token>();
// find all of them
TokenList.Token t = tokens.first;
while( t != null ) {
... | java | protected void handleParentheses( TokenList tokens, Sequence sequence ) {
// have a list to handle embedded parentheses, e.g. (((((a)))))
List<TokenList.Token> left = new ArrayList<TokenList.Token>();
// find all of them
TokenList.Token t = tokens.first;
while( t != null ) {
... | [
"protected",
"void",
"handleParentheses",
"(",
"TokenList",
"tokens",
",",
"Sequence",
"sequence",
")",
"{",
"// have a list to handle embedded parentheses, e.g. (((((a)))))",
"List",
"<",
"TokenList",
".",
"Token",
">",
"left",
"=",
"new",
"ArrayList",
"<",
"TokenList"... | Searches for pairs of parentheses and processes blocks inside of them. Embedded parentheses are handled
with no problem. On output only a single token should be in tokens.
@param tokens List of parsed tokens
@param sequence Sequence of operators | [
"Searches",
"for",
"pairs",
"of",
"parentheses",
"and",
"processes",
"blocks",
"inside",
"of",
"them",
".",
"Embedded",
"parentheses",
"are",
"handled",
"with",
"no",
"problem",
".",
"On",
"output",
"only",
"a",
"single",
"token",
"should",
"be",
"in",
"toke... | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L667-L720 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/Equation.java | Equation.parseParameterCommaBlock | protected List<TokenList.Token> parseParameterCommaBlock( TokenList tokens, Sequence sequence ) {
// find all the comma tokens
List<TokenList.Token> commas = new ArrayList<TokenList.Token>();
TokenList.Token token = tokens.first;
int numBracket = 0;
while( token != null ) {
... | java | protected List<TokenList.Token> parseParameterCommaBlock( TokenList tokens, Sequence sequence ) {
// find all the comma tokens
List<TokenList.Token> commas = new ArrayList<TokenList.Token>();
TokenList.Token token = tokens.first;
int numBracket = 0;
while( token != null ) {
... | [
"protected",
"List",
"<",
"TokenList",
".",
"Token",
">",
"parseParameterCommaBlock",
"(",
"TokenList",
"tokens",
",",
"Sequence",
"sequence",
")",
"{",
"// find all the comma tokens",
"List",
"<",
"TokenList",
".",
"Token",
">",
"commas",
"=",
"new",
"ArrayList",... | Searches for commas in the set of tokens. Used for inputs to functions.
Ignore comma's which are inside a [ ] block
@return List of output tokens between the commas | [
"Searches",
"for",
"commas",
"in",
"the",
"set",
"of",
"tokens",
".",
"Used",
"for",
"inputs",
"to",
"functions",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L729-L776 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/Equation.java | Equation.parseSubmatrixToExtract | protected TokenList.Token parseSubmatrixToExtract(TokenList.Token variableTarget,
TokenList tokens, Sequence sequence) {
List<TokenList.Token> inputs = parseParameterCommaBlock(tokens, sequence);
List<Variable> variables = new ArrayList<Variable>(... | java | protected TokenList.Token parseSubmatrixToExtract(TokenList.Token variableTarget,
TokenList tokens, Sequence sequence) {
List<TokenList.Token> inputs = parseParameterCommaBlock(tokens, sequence);
List<Variable> variables = new ArrayList<Variable>(... | [
"protected",
"TokenList",
".",
"Token",
"parseSubmatrixToExtract",
"(",
"TokenList",
".",
"Token",
"variableTarget",
",",
"TokenList",
"tokens",
",",
"Sequence",
"sequence",
")",
"{",
"List",
"<",
"TokenList",
".",
"Token",
">",
"inputs",
"=",
"parseParameterComma... | Converts a submatrix into an extract matrix operation.
@param variableTarget The variable in which the submatrix is extracted from | [
"Converts",
"a",
"submatrix",
"into",
"an",
"extract",
"matrix",
"operation",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L782-L826 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/Equation.java | Equation.addSubMatrixVariables | private void addSubMatrixVariables(List<TokenList.Token> inputs, List<Variable> variables) {
for (int i = 0; i < inputs.size(); i++) {
TokenList.Token t = inputs.get(i);
if( t.getType() != Type.VARIABLE )
throw new ParseError("Expected variables only in sub-matrix input, ... | java | private void addSubMatrixVariables(List<TokenList.Token> inputs, List<Variable> variables) {
for (int i = 0; i < inputs.size(); i++) {
TokenList.Token t = inputs.get(i);
if( t.getType() != Type.VARIABLE )
throw new ParseError("Expected variables only in sub-matrix input, ... | [
"private",
"void",
"addSubMatrixVariables",
"(",
"List",
"<",
"TokenList",
".",
"Token",
">",
"inputs",
",",
"List",
"<",
"Variable",
">",
"variables",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"inputs",
".",
"size",
"(",
")",
";",
... | Goes through the token lists and adds all the variables which can be used to define a sub-matrix. If anything
else is found an excpetion is thrown | [
"Goes",
"through",
"the",
"token",
"lists",
"and",
"adds",
"all",
"the",
"variables",
"which",
"can",
"be",
"used",
"to",
"define",
"a",
"sub",
"-",
"matrix",
".",
"If",
"anything",
"else",
"is",
"found",
"an",
"excpetion",
"is",
"thrown"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L832-L844 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/Equation.java | Equation.parseBlockNoParentheses | protected TokenList.Token parseBlockNoParentheses(TokenList tokens, Sequence sequence, boolean insideMatrixConstructor) {
// search for matrix bracket operations
if( !insideMatrixConstructor ) {
parseBracketCreateMatrix(tokens, sequence);
}
// First create sequences from an... | java | protected TokenList.Token parseBlockNoParentheses(TokenList tokens, Sequence sequence, boolean insideMatrixConstructor) {
// search for matrix bracket operations
if( !insideMatrixConstructor ) {
parseBracketCreateMatrix(tokens, sequence);
}
// First create sequences from an... | [
"protected",
"TokenList",
".",
"Token",
"parseBlockNoParentheses",
"(",
"TokenList",
"tokens",
",",
"Sequence",
"sequence",
",",
"boolean",
"insideMatrixConstructor",
")",
"{",
"// search for matrix bracket operations",
"if",
"(",
"!",
"insideMatrixConstructor",
")",
"{",... | Parses a code block with no parentheses and no commas. After it is done there should be a single token left,
which is returned. | [
"Parses",
"a",
"code",
"block",
"with",
"no",
"parentheses",
"and",
"no",
"commas",
".",
"After",
"it",
"is",
"done",
"there",
"should",
"be",
"a",
"single",
"token",
"left",
"which",
"is",
"returned",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L850-L889 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/Equation.java | Equation.stripCommas | private void stripCommas(TokenList tokens) {
TokenList.Token t = tokens.getFirst();
while( t != null ) {
TokenList.Token next = t.next;
if( t.getSymbol() == Symbol.COMMA ) {
tokens.remove(t);
}
t = next;
}
} | java | private void stripCommas(TokenList tokens) {
TokenList.Token t = tokens.getFirst();
while( t != null ) {
TokenList.Token next = t.next;
if( t.getSymbol() == Symbol.COMMA ) {
tokens.remove(t);
}
t = next;
}
} | [
"private",
"void",
"stripCommas",
"(",
"TokenList",
"tokens",
")",
"{",
"TokenList",
".",
"Token",
"t",
"=",
"tokens",
".",
"getFirst",
"(",
")",
";",
"while",
"(",
"t",
"!=",
"null",
")",
"{",
"TokenList",
".",
"Token",
"next",
"=",
"t",
".",
"next"... | Removes all commas from the token list | [
"Removes",
"all",
"commas",
"from",
"the",
"token",
"list"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L894-L904 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/Equation.java | Equation.parseSequencesWithColons | protected void parseSequencesWithColons(TokenList tokens , Sequence sequence ) {
TokenList.Token t = tokens.getFirst();
if( t == null )
return;
int state = 0;
TokenList.Token start = null;
TokenList.Token middle = null;
TokenList.Token prev = t;
bo... | java | protected void parseSequencesWithColons(TokenList tokens , Sequence sequence ) {
TokenList.Token t = tokens.getFirst();
if( t == null )
return;
int state = 0;
TokenList.Token start = null;
TokenList.Token middle = null;
TokenList.Token prev = t;
bo... | [
"protected",
"void",
"parseSequencesWithColons",
"(",
"TokenList",
"tokens",
",",
"Sequence",
"sequence",
")",
"{",
"TokenList",
".",
"Token",
"t",
"=",
"tokens",
".",
"getFirst",
"(",
")",
";",
"if",
"(",
"t",
"==",
"null",
")",
"return",
";",
"int",
"s... | Searches for descriptions of integer sequences and array ranges that have a colon character in them
Examples of integer sequences:
1:6
2:4:20
:
Examples of array range
2:
2:4: | [
"Searches",
"for",
"descriptions",
"of",
"integer",
"sequences",
"and",
"array",
"ranges",
"that",
"have",
"a",
"colon",
"character",
"in",
"them"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L918-L996 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/Equation.java | Equation.parseIntegerLists | protected void parseIntegerLists(TokenList tokens) {
TokenList.Token t = tokens.getFirst();
if( t == null || t.next == null )
return;
int state = 0;
TokenList.Token start = null;
TokenList.Token prev = t;
boolean last = false;
while( true ) {
... | java | protected void parseIntegerLists(TokenList tokens) {
TokenList.Token t = tokens.getFirst();
if( t == null || t.next == null )
return;
int state = 0;
TokenList.Token start = null;
TokenList.Token prev = t;
boolean last = false;
while( true ) {
... | [
"protected",
"void",
"parseIntegerLists",
"(",
"TokenList",
"tokens",
")",
"{",
"TokenList",
".",
"Token",
"t",
"=",
"tokens",
".",
"getFirst",
"(",
")",
";",
"if",
"(",
"t",
"==",
"null",
"||",
"t",
".",
"next",
"==",
"null",
")",
"return",
";",
"in... | Searches for a sequence of integers
example:
1 2 3 4 6 7 -3 | [
"Searches",
"for",
"a",
"sequence",
"of",
"integers"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L1005-L1049 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/Equation.java | Equation.parseCombineIntegerLists | protected void parseCombineIntegerLists(TokenList tokens) {
TokenList.Token t = tokens.getFirst();
if( t == null || t.next == null )
return;
int numFound = 0;
TokenList.Token start = null;
TokenList.Token end = null;
while( t != null ) {
if( t.g... | java | protected void parseCombineIntegerLists(TokenList tokens) {
TokenList.Token t = tokens.getFirst();
if( t == null || t.next == null )
return;
int numFound = 0;
TokenList.Token start = null;
TokenList.Token end = null;
while( t != null ) {
if( t.g... | [
"protected",
"void",
"parseCombineIntegerLists",
"(",
"TokenList",
"tokens",
")",
"{",
"TokenList",
".",
"Token",
"t",
"=",
"tokens",
".",
"getFirst",
"(",
")",
";",
"if",
"(",
"t",
"==",
"null",
"||",
"t",
".",
"next",
"==",
"null",
")",
"return",
";"... | Looks for sequences of integer lists and combine them into one big sequence | [
"Looks",
"for",
"sequences",
"of",
"integer",
"lists",
"and",
"combine",
"them",
"into",
"one",
"big",
"sequence"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L1054-L1090 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/Equation.java | Equation.isVariableInteger | private static boolean isVariableInteger(TokenList.Token t) {
if( t == null )
return false;
return t.getScalarType() == VariableScalar.Type.INTEGER;
} | java | private static boolean isVariableInteger(TokenList.Token t) {
if( t == null )
return false;
return t.getScalarType() == VariableScalar.Type.INTEGER;
} | [
"private",
"static",
"boolean",
"isVariableInteger",
"(",
"TokenList",
".",
"Token",
"t",
")",
"{",
"if",
"(",
"t",
"==",
"null",
")",
"return",
"false",
";",
"return",
"t",
".",
"getScalarType",
"(",
")",
"==",
"VariableScalar",
".",
"Type",
".",
"INTEG... | Checks to see if the token is an integer scalar
@return true if integer or false if not | [
"Checks",
"to",
"see",
"if",
"the",
"token",
"is",
"an",
"integer",
"scalar"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L1104-L1109 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/Equation.java | Equation.parseBracketCreateMatrix | protected void parseBracketCreateMatrix(TokenList tokens, Sequence sequence) {
List<TokenList.Token> left = new ArrayList<TokenList.Token>();
TokenList.Token t = tokens.getFirst();
while( t != null ) {
TokenList.Token next = t.next;
if( t.getSymbol() == Symbol.BRACKET_L... | java | protected void parseBracketCreateMatrix(TokenList tokens, Sequence sequence) {
List<TokenList.Token> left = new ArrayList<TokenList.Token>();
TokenList.Token t = tokens.getFirst();
while( t != null ) {
TokenList.Token next = t.next;
if( t.getSymbol() == Symbol.BRACKET_L... | [
"protected",
"void",
"parseBracketCreateMatrix",
"(",
"TokenList",
"tokens",
",",
"Sequence",
"sequence",
")",
"{",
"List",
"<",
"TokenList",
".",
"Token",
">",
"left",
"=",
"new",
"ArrayList",
"<",
"TokenList",
".",
"Token",
">",
"(",
")",
";",
"TokenList",... | Searches for brackets which are only used to construct new matrices by concatenating
1 or more matrices together | [
"Searches",
"for",
"brackets",
"which",
"are",
"only",
"used",
"to",
"construct",
"new",
"matrices",
"by",
"concatenating",
"1",
"or",
"more",
"matrices",
"together"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L1115-L1152 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/Equation.java | Equation.parseNegOp | protected void parseNegOp(TokenList tokens, Sequence sequence) {
if( tokens.size == 0 )
return;
TokenList.Token token = tokens.first;
while( token != null ) {
TokenList.Token next = token.next;
escape:
if( token.getSymbol() == Symbol.MINUS ) {
... | java | protected void parseNegOp(TokenList tokens, Sequence sequence) {
if( tokens.size == 0 )
return;
TokenList.Token token = tokens.first;
while( token != null ) {
TokenList.Token next = token.next;
escape:
if( token.getSymbol() == Symbol.MINUS ) {
... | [
"protected",
"void",
"parseNegOp",
"(",
"TokenList",
"tokens",
",",
"Sequence",
"sequence",
")",
"{",
"if",
"(",
"tokens",
".",
"size",
"==",
"0",
")",
"return",
";",
"TokenList",
".",
"Token",
"token",
"=",
"tokens",
".",
"first",
";",
"while",
"(",
"... | Searches for cases where a minus sign means negative operator. That happens when there is a minus
sign with a variable to its right and no variable to its left
Example:
a = - b * c | [
"Searches",
"for",
"cases",
"where",
"a",
"minus",
"sign",
"means",
"negative",
"operator",
".",
"That",
"happens",
"when",
"there",
"is",
"a",
"minus",
"sign",
"with",
"a",
"variable",
"to",
"its",
"right",
"and",
"no",
"variable",
"to",
"its",
"left"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L1183-L1217 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/Equation.java | Equation.parseOperationsL | protected void parseOperationsL(TokenList tokens, Sequence sequence) {
if( tokens.size == 0 )
return;
TokenList.Token token = tokens.first;
if( token.getType() != Type.VARIABLE )
throw new ParseError("The first token in an equation needs to be a variable and not "+toke... | java | protected void parseOperationsL(TokenList tokens, Sequence sequence) {
if( tokens.size == 0 )
return;
TokenList.Token token = tokens.first;
if( token.getType() != Type.VARIABLE )
throw new ParseError("The first token in an equation needs to be a variable and not "+toke... | [
"protected",
"void",
"parseOperationsL",
"(",
"TokenList",
"tokens",
",",
"Sequence",
"sequence",
")",
"{",
"if",
"(",
"tokens",
".",
"size",
"==",
"0",
")",
"return",
";",
"TokenList",
".",
"Token",
"token",
"=",
"tokens",
".",
"first",
";",
"if",
"(",
... | Parses operations where the input comes from variables to its left only. Hard coded to only look
for transpose for now
@param tokens List of all the tokens
@param sequence List of operation sequence | [
"Parses",
"operations",
"where",
"the",
"input",
"comes",
"from",
"variables",
"to",
"its",
"left",
"only",
".",
"Hard",
"coded",
"to",
"only",
"look",
"for",
"transpose",
"for",
"now"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L1227-L1248 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/Equation.java | Equation.parseOperationsLR | protected void parseOperationsLR(Symbol ops[], TokenList tokens, Sequence sequence) {
if( tokens.size == 0 )
return;
TokenList.Token token = tokens.first;
if( token.getType() != Type.VARIABLE )
throw new ParseError("The first token in an equation needs to be a variable... | java | protected void parseOperationsLR(Symbol ops[], TokenList tokens, Sequence sequence) {
if( tokens.size == 0 )
return;
TokenList.Token token = tokens.first;
if( token.getType() != Type.VARIABLE )
throw new ParseError("The first token in an equation needs to be a variable... | [
"protected",
"void",
"parseOperationsLR",
"(",
"Symbol",
"ops",
"[",
"]",
",",
"TokenList",
"tokens",
",",
"Sequence",
"sequence",
")",
"{",
"if",
"(",
"tokens",
".",
"size",
"==",
"0",
")",
"return",
";",
"TokenList",
".",
"Token",
"token",
"=",
"tokens... | Parses operations where the input comes from variables to its left and right
@param ops List of operations which should be parsed
@param tokens List of all the tokens
@param sequence List of operation sequence | [
"Parses",
"operations",
"where",
"the",
"input",
"comes",
"from",
"variables",
"to",
"its",
"left",
"and",
"right"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L1257-L1286 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/Equation.java | Equation.lookupVariable | public <T extends Variable> T lookupVariable(String token) {
Variable result = variables.get(token);
return (T)result;
} | java | public <T extends Variable> T lookupVariable(String token) {
Variable result = variables.get(token);
return (T)result;
} | [
"public",
"<",
"T",
"extends",
"Variable",
">",
"T",
"lookupVariable",
"(",
"String",
"token",
")",
"{",
"Variable",
"result",
"=",
"variables",
".",
"get",
"(",
"token",
")",
";",
"return",
"(",
"T",
")",
"result",
";",
"}"
] | Looks up a variable given its name. If none is found then return null. | [
"Looks",
"up",
"a",
"variable",
"given",
"its",
"name",
".",
"If",
"none",
"is",
"found",
"then",
"return",
"null",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L1358-L1361 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/Equation.java | Equation.insertMacros | void insertMacros(TokenList tokens ) {
TokenList.Token t = tokens.getFirst();
while( t != null ) {
if( t.getType() == Type.WORD ) {
Macro v = lookupMacro(t.word);
if (v != null) {
TokenList.Token before = t.previous;
Lis... | java | void insertMacros(TokenList tokens ) {
TokenList.Token t = tokens.getFirst();
while( t != null ) {
if( t.getType() == Type.WORD ) {
Macro v = lookupMacro(t.word);
if (v != null) {
TokenList.Token before = t.previous;
Lis... | [
"void",
"insertMacros",
"(",
"TokenList",
"tokens",
")",
"{",
"TokenList",
".",
"Token",
"t",
"=",
"tokens",
".",
"getFirst",
"(",
")",
";",
"while",
"(",
"t",
"!=",
"null",
")",
"{",
"if",
"(",
"t",
".",
"getType",
"(",
")",
"==",
"Type",
".",
"... | Checks to see if a WORD matches the name of a macro. if it does it applies the macro at that location | [
"Checks",
"to",
"see",
"if",
"a",
"WORD",
"matches",
"the",
"name",
"of",
"a",
"macro",
".",
"if",
"it",
"does",
"it",
"applies",
"the",
"macro",
"at",
"that",
"location"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L1557-L1575 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/Equation.java | Equation.isTargetOp | protected static boolean isTargetOp( TokenList.Token token , Symbol[] ops ) {
Symbol c = token.symbol;
for (int i = 0; i < ops.length; i++) {
if( c == ops[i])
return true;
}
return false;
} | java | protected static boolean isTargetOp( TokenList.Token token , Symbol[] ops ) {
Symbol c = token.symbol;
for (int i = 0; i < ops.length; i++) {
if( c == ops[i])
return true;
}
return false;
} | [
"protected",
"static",
"boolean",
"isTargetOp",
"(",
"TokenList",
".",
"Token",
"token",
",",
"Symbol",
"[",
"]",
"ops",
")",
"{",
"Symbol",
"c",
"=",
"token",
".",
"symbol",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ops",
".",
"length... | Checks to see if the token is in the list of allowed character operations. Used to apply order of operations
@param token Token being checked
@param ops List of allowed character operations
@return true for it being in the list and false for it not being in the list | [
"Checks",
"to",
"see",
"if",
"the",
"token",
"is",
"in",
"the",
"list",
"of",
"allowed",
"character",
"operations",
".",
"Used",
"to",
"apply",
"order",
"of",
"operations"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L1596-L1603 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/Equation.java | Equation.isOperatorLR | protected static boolean isOperatorLR( Symbol s ) {
if( s == null )
return false;
switch( s ) {
case ELEMENT_DIVIDE:
case ELEMENT_TIMES:
case ELEMENT_POWER:
case RDIVIDE:
case LDIVIDE:
case TIMES:
case POWER... | java | protected static boolean isOperatorLR( Symbol s ) {
if( s == null )
return false;
switch( s ) {
case ELEMENT_DIVIDE:
case ELEMENT_TIMES:
case ELEMENT_POWER:
case RDIVIDE:
case LDIVIDE:
case TIMES:
case POWER... | [
"protected",
"static",
"boolean",
"isOperatorLR",
"(",
"Symbol",
"s",
")",
"{",
"if",
"(",
"s",
"==",
"null",
")",
"return",
"false",
";",
"switch",
"(",
"s",
")",
"{",
"case",
"ELEMENT_DIVIDE",
":",
"case",
"ELEMENT_TIMES",
":",
"case",
"ELEMENT_POWER",
... | Operators which affect the variables to its left and right | [
"Operators",
"which",
"affect",
"the",
"variables",
"to",
"its",
"left",
"and",
"right"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L1613-L1631 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/Equation.java | Equation.isReserved | protected boolean isReserved( String name ) {
if( functions.isFunctionName(name))
return true;
for (int i = 0; i < name.length(); i++) {
if( !isLetter(name.charAt(i)) )
return true;
}
return false;
} | java | protected boolean isReserved( String name ) {
if( functions.isFunctionName(name))
return true;
for (int i = 0; i < name.length(); i++) {
if( !isLetter(name.charAt(i)) )
return true;
}
return false;
} | [
"protected",
"boolean",
"isReserved",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"functions",
".",
"isFunctionName",
"(",
"name",
")",
")",
"return",
"true",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"name",
".",
"length",
"(",
")",
";... | Returns true if the specified name is NOT allowed. It isn't allowed if it matches a built in operator
or if it contains a restricted character. | [
"Returns",
"true",
"if",
"the",
"specified",
"name",
"is",
"NOT",
"allowed",
".",
"It",
"isn",
"t",
"allowed",
"if",
"it",
"matches",
"a",
"built",
"in",
"operator",
"or",
"if",
"it",
"contains",
"a",
"restricted",
"character",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L1644-L1653 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/Equation.java | Equation.process | public Equation process( String equation , boolean debug ) {
compile(equation,true,debug).perform();
return this;
} | java | public Equation process( String equation , boolean debug ) {
compile(equation,true,debug).perform();
return this;
} | [
"public",
"Equation",
"process",
"(",
"String",
"equation",
",",
"boolean",
"debug",
")",
"{",
"compile",
"(",
"equation",
",",
"true",
",",
"debug",
")",
".",
"perform",
"(",
")",
";",
"return",
"this",
";",
"}"
] | Compiles and performs the provided equation.
@param equation String in simple equation format | [
"Compiles",
"and",
"performs",
"the",
"provided",
"equation",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L1670-L1673 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/Equation.java | Equation.print | public void print( String equation ) {
// first assume it's just a variable
Variable v = lookupVariable(equation);
if( v == null ) {
Sequence sequence = compile(equation,false,false);
sequence.perform();
v = sequence.output;
}
if( v instanceof... | java | public void print( String equation ) {
// first assume it's just a variable
Variable v = lookupVariable(equation);
if( v == null ) {
Sequence sequence = compile(equation,false,false);
sequence.perform();
v = sequence.output;
}
if( v instanceof... | [
"public",
"void",
"print",
"(",
"String",
"equation",
")",
"{",
"// first assume it's just a variable",
"Variable",
"v",
"=",
"lookupVariable",
"(",
"equation",
")",
";",
"if",
"(",
"v",
"==",
"null",
")",
"{",
"Sequence",
"sequence",
"=",
"compile",
"(",
"e... | Prints the results of the equation to standard out. Useful for debugging | [
"Prints",
"the",
"results",
"of",
"the",
"equation",
"to",
"standard",
"out",
".",
"Useful",
"for",
"debugging"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L1678-L1694 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/decomposition/qr/QrHelperFunctions_DDRM.java | QrHelperFunctions_DDRM.computeTauAndDivide | public static double computeTauAndDivide(final int j, final int numRows ,
final double[] u , final double max) {
double tau = 0;
// double div_max = 1.0/max;
// if( Double.isInfinite(div_max)) {
for( int i = j; i < numRows; i++ ) {
... | java | public static double computeTauAndDivide(final int j, final int numRows ,
final double[] u , final double max) {
double tau = 0;
// double div_max = 1.0/max;
// if( Double.isInfinite(div_max)) {
for( int i = j; i < numRows; i++ ) {
... | [
"public",
"static",
"double",
"computeTauAndDivide",
"(",
"final",
"int",
"j",
",",
"final",
"int",
"numRows",
",",
"final",
"double",
"[",
"]",
"u",
",",
"final",
"double",
"max",
")",
"{",
"double",
"tau",
"=",
"0",
";",
"// double div_max = 1.0/max... | Normalizes elements in 'u' by dividing by max and computes the norm2 of the normalized
array u. Adjust the sign of the returned value depending on the size of the first
element in 'u'. Normalization is done to avoid overflow.
<pre>
for i=j:numRows
u[i] = u[i] / max
tau = tau + u[i]*u[i]
end
tau = sqrt(tau)
if( u[j] &... | [
"Normalizes",
"elements",
"in",
"u",
"by",
"dividing",
"by",
"max",
"and",
"computes",
"the",
"norm2",
"of",
"the",
"normalized",
"array",
"u",
".",
"Adjust",
"the",
"sign",
"of",
"the",
"returned",
"value",
"depending",
"on",
"the",
"size",
"of",
"the",
... | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/decomposition/qr/QrHelperFunctions_DDRM.java#L173-L194 | train |
lessthanoptimal/ejml | main/ejml-dsparse/src/org/ejml/sparse/csc/MatrixFeatures_DSCC.java | MatrixFeatures_DSCC.isSameStructure | public static boolean isSameStructure(DMatrixSparseCSC a , DMatrixSparseCSC b) {
if( a.numRows == b.numRows && a.numCols == b.numCols && a.nz_length == b.nz_length) {
for (int i = 0; i <= a.numCols; i++) {
if( a.col_idx[i] != b.col_idx[i] )
return false;
... | java | public static boolean isSameStructure(DMatrixSparseCSC a , DMatrixSparseCSC b) {
if( a.numRows == b.numRows && a.numCols == b.numCols && a.nz_length == b.nz_length) {
for (int i = 0; i <= a.numCols; i++) {
if( a.col_idx[i] != b.col_idx[i] )
return false;
... | [
"public",
"static",
"boolean",
"isSameStructure",
"(",
"DMatrixSparseCSC",
"a",
",",
"DMatrixSparseCSC",
"b",
")",
"{",
"if",
"(",
"a",
".",
"numRows",
"==",
"b",
".",
"numRows",
"&&",
"a",
".",
"numCols",
"==",
"b",
".",
"numCols",
"&&",
"a",
".",
"nz... | Checks to see if the two matrices have the same shape and same pattern of non-zero elements
@param a Matrix
@param b Matrix
@return true if the structure is the same | [
"Checks",
"to",
"see",
"if",
"the",
"two",
"matrices",
"have",
"the",
"same",
"shape",
"and",
"same",
"pattern",
"of",
"non",
"-",
"zero",
"elements"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/MatrixFeatures_DSCC.java#L97-L110 | train |
lessthanoptimal/ejml | main/ejml-dsparse/src/org/ejml/sparse/csc/MatrixFeatures_DSCC.java | MatrixFeatures_DSCC.isVector | public static boolean isVector(DMatrixSparseCSC a) {
return (a.numCols == 1 && a.numRows > 1) || (a.numRows == 1 && a.numCols>1);
} | java | public static boolean isVector(DMatrixSparseCSC a) {
return (a.numCols == 1 && a.numRows > 1) || (a.numRows == 1 && a.numCols>1);
} | [
"public",
"static",
"boolean",
"isVector",
"(",
"DMatrixSparseCSC",
"a",
")",
"{",
"return",
"(",
"a",
".",
"numCols",
"==",
"1",
"&&",
"a",
".",
"numRows",
">",
"1",
")",
"||",
"(",
"a",
".",
"numRows",
"==",
"1",
"&&",
"a",
".",
"numCols",
">",
... | Returns true if the input is a vector
@param a A matrix or vector
@return true if it's a vector. Column or row. | [
"Returns",
"true",
"if",
"the",
"input",
"is",
"a",
"vector"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/MatrixFeatures_DSCC.java#L219-L221 | train |
lessthanoptimal/ejml | main/ejml-dsparse/src/org/ejml/sparse/csc/MatrixFeatures_DSCC.java | MatrixFeatures_DSCC.isSymmetric | public static boolean isSymmetric( DMatrixSparseCSC A , double tol ) {
if( A.numRows != A.numCols )
return false;
int N = A.numCols;
for (int i = 0; i < N; i++) {
int idx0 = A.col_idx[i];
int idx1 = A.col_idx[i+1];
for (int index = idx0; index <... | java | public static boolean isSymmetric( DMatrixSparseCSC A , double tol ) {
if( A.numRows != A.numCols )
return false;
int N = A.numCols;
for (int i = 0; i < N; i++) {
int idx0 = A.col_idx[i];
int idx1 = A.col_idx[i+1];
for (int index = idx0; index <... | [
"public",
"static",
"boolean",
"isSymmetric",
"(",
"DMatrixSparseCSC",
"A",
",",
"double",
"tol",
")",
"{",
"if",
"(",
"A",
".",
"numRows",
"!=",
"A",
".",
"numCols",
")",
"return",
"false",
";",
"int",
"N",
"=",
"A",
".",
"numCols",
";",
"for",
"(",... | Checks to see if the matrix is symmetric to within tolerance.
@param A Matrix being tested. Not modified.
@param tol Tolerance that defines how similar two values must be to be considered identical
@return true if symmetric or false if not | [
"Checks",
"to",
"see",
"if",
"the",
"matrix",
"is",
"symmetric",
"to",
"within",
"tolerance",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/MatrixFeatures_DSCC.java#L230-L251 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/decomposition/eig/watched/WatchedDoubleStepQREigen_DDRM.java | WatchedDoubleStepQREigen_DDRM.implicitDoubleStep | public void implicitDoubleStep( int x1 , int x2 ) {
if( printHumps )
System.out.println("Performing implicit double step");
// compute the wilkinson shift
double z11 = A.get(x2 - 1, x2 - 1);
double z12 = A.get(x2 - 1, x2);
double z21 = A.get(x2, x2 - 1);
dou... | java | public void implicitDoubleStep( int x1 , int x2 ) {
if( printHumps )
System.out.println("Performing implicit double step");
// compute the wilkinson shift
double z11 = A.get(x2 - 1, x2 - 1);
double z12 = A.get(x2 - 1, x2);
double z21 = A.get(x2, x2 - 1);
dou... | [
"public",
"void",
"implicitDoubleStep",
"(",
"int",
"x1",
",",
"int",
"x2",
")",
"{",
"if",
"(",
"printHumps",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"Performing implicit double step\"",
")",
";",
"// compute the wilkinson shift",
"double",
"z11",
"="... | Performs an implicit double step using the values contained in the lower right hand side
of the submatrix for the estimated eigenvector values.
@param x1
@param x2 | [
"Performs",
"an",
"implicit",
"double",
"step",
"using",
"the",
"values",
"contained",
"in",
"the",
"lower",
"right",
"hand",
"side",
"of",
"the",
"submatrix",
"for",
"the",
"estimated",
"eigenvector",
"values",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/decomposition/eig/watched/WatchedDoubleStepQREigen_DDRM.java#L195-L240 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/decomposition/eig/watched/WatchedDoubleStepQREigen_DDRM.java | WatchedDoubleStepQREigen_DDRM.performImplicitDoubleStep | public void performImplicitDoubleStep(int x1, int x2 , double real , double img ) {
double a11 = A.get(x1,x1);
double a21 = A.get(x1+1,x1);
double a12 = A.get(x1,x1+1);
double a22 = A.get(x1+1,x1+1);
double a32 = A.get(x1+2,x1+1);
double p_plus_t = 2.0*real;
dou... | java | public void performImplicitDoubleStep(int x1, int x2 , double real , double img ) {
double a11 = A.get(x1,x1);
double a21 = A.get(x1+1,x1);
double a12 = A.get(x1,x1+1);
double a22 = A.get(x1+1,x1+1);
double a32 = A.get(x1+2,x1+1);
double p_plus_t = 2.0*real;
dou... | [
"public",
"void",
"performImplicitDoubleStep",
"(",
"int",
"x1",
",",
"int",
"x2",
",",
"double",
"real",
",",
"double",
"img",
")",
"{",
"double",
"a11",
"=",
"A",
".",
"get",
"(",
"x1",
",",
"x1",
")",
";",
"double",
"a21",
"=",
"A",
".",
"get",
... | Performs an implicit double step given the set of two imaginary eigenvalues provided.
Since one eigenvalue is the complex conjugate of the other only one set of real and imaginary
numbers is needed.
@param x1 upper index of submatrix.
@param x2 lower index of submatrix.
@param real Real component of each of the eigenv... | [
"Performs",
"an",
"implicit",
"double",
"step",
"given",
"the",
"set",
"of",
"two",
"imaginary",
"eigenvalues",
"provided",
".",
"Since",
"one",
"eigenvalue",
"is",
"the",
"complex",
"conjugate",
"of",
"the",
"other",
"only",
"one",
"set",
"of",
"real",
"and... | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/decomposition/eig/watched/WatchedDoubleStepQREigen_DDRM.java#L252-L276 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/linsol/qr/SolveNullSpaceQRP_DDRM.java | SolveNullSpaceQRP_DDRM.process | public boolean process(DMatrixRMaj A , int numSingularValues, DMatrixRMaj nullspace ) {
decomposition.decompose(A);
if( A.numRows > A.numCols ) {
Q.reshape(A.numCols,Math.min(A.numRows,A.numCols));
decomposition.getQ(Q, true);
} else {
Q.reshape(A.numCols, A.... | java | public boolean process(DMatrixRMaj A , int numSingularValues, DMatrixRMaj nullspace ) {
decomposition.decompose(A);
if( A.numRows > A.numCols ) {
Q.reshape(A.numCols,Math.min(A.numRows,A.numCols));
decomposition.getQ(Q, true);
} else {
Q.reshape(A.numCols, A.... | [
"public",
"boolean",
"process",
"(",
"DMatrixRMaj",
"A",
",",
"int",
"numSingularValues",
",",
"DMatrixRMaj",
"nullspace",
")",
"{",
"decomposition",
".",
"decompose",
"(",
"A",
")",
";",
"if",
"(",
"A",
".",
"numRows",
">",
"A",
".",
"numCols",
")",
"{"... | Finds the null space of A
@param A (Input) Matrix. Modified
@param numSingularValues Number of singular values
@param nullspace Storage for null-space
@return true if successful or false if it failed | [
"Finds",
"the",
"null",
"space",
"of",
"A"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/linsol/qr/SolveNullSpaceQRP_DDRM.java#L48-L63 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/MatrixFeatures_DDRM.java | MatrixFeatures_DDRM.isInverse | public static boolean isInverse(DMatrixRMaj a , DMatrixRMaj b , double tol ) {
if( a.numRows != b.numRows || a.numCols != b.numCols ) {
return false;
}
int numRows = a.numRows;
int numCols = a.numCols;
for( int i = 0; i < numRows; i++ ) {
for( int j = 0;... | java | public static boolean isInverse(DMatrixRMaj a , DMatrixRMaj b , double tol ) {
if( a.numRows != b.numRows || a.numCols != b.numCols ) {
return false;
}
int numRows = a.numRows;
int numCols = a.numCols;
for( int i = 0; i < numRows; i++ ) {
for( int j = 0;... | [
"public",
"static",
"boolean",
"isInverse",
"(",
"DMatrixRMaj",
"a",
",",
"DMatrixRMaj",
"b",
",",
"double",
"tol",
")",
"{",
"if",
"(",
"a",
".",
"numRows",
"!=",
"b",
".",
"numRows",
"||",
"a",
".",
"numCols",
"!=",
"b",
".",
"numCols",
")",
"{",
... | Checks to see if the two matrices are inverses of each other.
@param a A matrix. Not modified.
@param b A matrix. Not modified. | [
"Checks",
"to",
"see",
"if",
"the",
"two",
"matrices",
"are",
"inverses",
"of",
"each",
"other",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/MatrixFeatures_DDRM.java#L265-L289 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/MatrixFeatures_DDRM.java | MatrixFeatures_DDRM.isRowsLinearIndependent | public static boolean isRowsLinearIndependent( DMatrixRMaj A )
{
// LU decomposition
LUDecomposition<DMatrixRMaj> lu = DecompositionFactory_DDRM.lu(A.numRows,A.numCols);
if( lu.inputModified() )
A = A.copy();
if( !lu.decompose(A))
throw new RuntimeException("... | java | public static boolean isRowsLinearIndependent( DMatrixRMaj A )
{
// LU decomposition
LUDecomposition<DMatrixRMaj> lu = DecompositionFactory_DDRM.lu(A.numRows,A.numCols);
if( lu.inputModified() )
A = A.copy();
if( !lu.decompose(A))
throw new RuntimeException("... | [
"public",
"static",
"boolean",
"isRowsLinearIndependent",
"(",
"DMatrixRMaj",
"A",
")",
"{",
"// LU decomposition",
"LUDecomposition",
"<",
"DMatrixRMaj",
">",
"lu",
"=",
"DecompositionFactory_DDRM",
".",
"lu",
"(",
"A",
".",
"numRows",
",",
"A",
".",
"numCols",
... | Checks to see if the rows of the provided matrix are linearly independent.
@param A Matrix whose rows are being tested for linear independence.
@return true if linearly independent and false otherwise. | [
"Checks",
"to",
"see",
"if",
"the",
"rows",
"of",
"the",
"provided",
"matrix",
"are",
"linearly",
"independent",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/MatrixFeatures_DDRM.java#L504-L516 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/MatrixFeatures_DDRM.java | MatrixFeatures_DDRM.isConstantVal | public static boolean isConstantVal(DMatrixRMaj mat , double val , double tol )
{
// see if the result is an identity matrix
int index = 0;
for( int i = 0; i < mat.numRows; i++ ) {
for( int j = 0; j < mat.numCols; j++ ) {
if( !(Math.abs(mat.get(index++)-val) <= to... | java | public static boolean isConstantVal(DMatrixRMaj mat , double val , double tol )
{
// see if the result is an identity matrix
int index = 0;
for( int i = 0; i < mat.numRows; i++ ) {
for( int j = 0; j < mat.numCols; j++ ) {
if( !(Math.abs(mat.get(index++)-val) <= to... | [
"public",
"static",
"boolean",
"isConstantVal",
"(",
"DMatrixRMaj",
"mat",
",",
"double",
"val",
",",
"double",
"tol",
")",
"{",
"// see if the result is an identity matrix",
"int",
"index",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"... | Checks to see if every value in the matrix is the specified value.
@param mat The matrix being tested. Not modified.
@param val Checks to see if every element in the matrix has this value.
@param tol True if all the elements are within this tolerance.
@return true if the test passes. | [
"Checks",
"to",
"see",
"if",
"every",
"value",
"in",
"the",
"matrix",
"is",
"the",
"specified",
"value",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/MatrixFeatures_DDRM.java#L552-L565 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/MatrixFeatures_DDRM.java | MatrixFeatures_DDRM.isDiagonalPositive | public static boolean isDiagonalPositive( DMatrixRMaj a ) {
for( int i = 0; i < a.numRows; i++ ) {
if( !(a.get(i,i) >= 0) )
return false;
}
return true;
} | java | public static boolean isDiagonalPositive( DMatrixRMaj a ) {
for( int i = 0; i < a.numRows; i++ ) {
if( !(a.get(i,i) >= 0) )
return false;
}
return true;
} | [
"public",
"static",
"boolean",
"isDiagonalPositive",
"(",
"DMatrixRMaj",
"a",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"a",
".",
"numRows",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"(",
"a",
".",
"get",
"(",
"i",
",",
"i",
... | Checks to see if all the diagonal elements in the matrix are positive.
@param a A matrix. Not modified.
@return true if all the diagonal elements are positive, false otherwise. | [
"Checks",
"to",
"see",
"if",
"all",
"the",
"diagonal",
"elements",
"in",
"the",
"matrix",
"are",
"positive",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/MatrixFeatures_DDRM.java#L573-L579 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/MatrixFeatures_DDRM.java | MatrixFeatures_DDRM.rank | public static int rank(DMatrixRMaj A , double threshold ) {
SingularValueDecomposition_F64<DMatrixRMaj> svd = DecompositionFactory_DDRM.svd(A.numRows,A.numCols,false,false,true);
if( svd.inputModified() )
A = A.copy();
if( !svd.decompose(A) )
throw new RuntimeException(... | java | public static int rank(DMatrixRMaj A , double threshold ) {
SingularValueDecomposition_F64<DMatrixRMaj> svd = DecompositionFactory_DDRM.svd(A.numRows,A.numCols,false,false,true);
if( svd.inputModified() )
A = A.copy();
if( !svd.decompose(A) )
throw new RuntimeException(... | [
"public",
"static",
"int",
"rank",
"(",
"DMatrixRMaj",
"A",
",",
"double",
"threshold",
")",
"{",
"SingularValueDecomposition_F64",
"<",
"DMatrixRMaj",
">",
"svd",
"=",
"DecompositionFactory_DDRM",
".",
"svd",
"(",
"A",
".",
"numRows",
",",
"A",
".",
"numCols"... | Computes the rank of a matrix using the specified tolerance.
@param A Matrix whose rank is to be calculated. Not modified.
@param threshold The numerical threshold used to determine a singular value.
@return The matrix's rank. | [
"Computes",
"the",
"rank",
"of",
"a",
"matrix",
"using",
"the",
"specified",
"tolerance",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/MatrixFeatures_DDRM.java#L680-L690 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/MatrixFeatures_DDRM.java | MatrixFeatures_DDRM.countNonZero | public static int countNonZero(DMatrixRMaj A){
int total = 0;
for (int row = 0, index=0; row < A.numRows; row++) {
for (int col = 0; col < A.numCols; col++,index++) {
if( A.data[index] != 0 ) {
total++;
}
}
}
ret... | java | public static int countNonZero(DMatrixRMaj A){
int total = 0;
for (int row = 0, index=0; row < A.numRows; row++) {
for (int col = 0; col < A.numCols; col++,index++) {
if( A.data[index] != 0 ) {
total++;
}
}
}
ret... | [
"public",
"static",
"int",
"countNonZero",
"(",
"DMatrixRMaj",
"A",
")",
"{",
"int",
"total",
"=",
"0",
";",
"for",
"(",
"int",
"row",
"=",
"0",
",",
"index",
"=",
"0",
";",
"row",
"<",
"A",
".",
"numRows",
";",
"row",
"++",
")",
"{",
"for",
"(... | Counts the number of elements in A which are not zero.
@param A A matrix
@return number of non-zero elements | [
"Counts",
"the",
"number",
"of",
"elements",
"in",
"A",
"which",
"are",
"not",
"zero",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/MatrixFeatures_DDRM.java#L726-L736 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java | CommonOps_DDRM.invertSPD | public static boolean invertSPD(DMatrixRMaj mat, DMatrixRMaj result ) {
if( mat.numRows != mat.numCols )
throw new IllegalArgumentException("Must be a square matrix");
result.reshape(mat.numRows,mat.numRows);
if( mat.numRows <= UnrolledCholesky_DDRM.MAX ) {
// L*L' = A
... | java | public static boolean invertSPD(DMatrixRMaj mat, DMatrixRMaj result ) {
if( mat.numRows != mat.numCols )
throw new IllegalArgumentException("Must be a square matrix");
result.reshape(mat.numRows,mat.numRows);
if( mat.numRows <= UnrolledCholesky_DDRM.MAX ) {
// L*L' = A
... | [
"public",
"static",
"boolean",
"invertSPD",
"(",
"DMatrixRMaj",
"mat",
",",
"DMatrixRMaj",
"result",
")",
"{",
"if",
"(",
"mat",
".",
"numRows",
"!=",
"mat",
".",
"numCols",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Must be a square matrix\"",
")"... | Matrix inverse for symmetric positive definite matrices. For small matrices an unrolled
cholesky is used. Otherwise a standard decomposition.
@see UnrolledCholesky_DDRM
@see LinearSolverFactory_DDRM#chol(int)
@param mat (Input) SPD matrix
@param result (Output) Inverted matrix.
@return true if it could invert the mat... | [
"Matrix",
"inverse",
"for",
"symmetric",
"positive",
"definite",
"matrices",
".",
"For",
"small",
"matrices",
"an",
"unrolled",
"cholesky",
"is",
"used",
".",
"Otherwise",
"a",
"standard",
"decomposition",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L818-L842 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java | CommonOps_DDRM.identity | public static DMatrixRMaj identity(int numRows , int numCols )
{
DMatrixRMaj ret = new DMatrixRMaj(numRows,numCols);
int small = numRows < numCols ? numRows : numCols;
for( int i = 0; i < small; i++ ) {
ret.set(i,i,1.0);
}
return ret;
} | java | public static DMatrixRMaj identity(int numRows , int numCols )
{
DMatrixRMaj ret = new DMatrixRMaj(numRows,numCols);
int small = numRows < numCols ? numRows : numCols;
for( int i = 0; i < small; i++ ) {
ret.set(i,i,1.0);
}
return ret;
} | [
"public",
"static",
"DMatrixRMaj",
"identity",
"(",
"int",
"numRows",
",",
"int",
"numCols",
")",
"{",
"DMatrixRMaj",
"ret",
"=",
"new",
"DMatrixRMaj",
"(",
"numRows",
",",
"numCols",
")",
";",
"int",
"small",
"=",
"numRows",
"<",
"numCols",
"?",
"numRows"... | Creates a rectangular matrix which is zero except along the diagonals.
@param numRows Number of rows in the matrix.
@param numCols NUmber of columns in the matrix.
@return A matrix with diagonal elements equal to one. | [
"Creates",
"a",
"rectangular",
"matrix",
"which",
"is",
"zero",
"except",
"along",
"the",
"diagonals",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L987-L998 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java | CommonOps_DDRM.extract | public static void extract( DMatrix src,
int srcY0, int srcY1,
int srcX0, int srcX1,
DMatrix dst ) {
((ReshapeMatrix)dst).reshape(srcY1-srcY0,srcX1-srcX0);
extract(src,srcY0,srcY1,srcX0,srcX1,dst,0,0);
} | java | public static void extract( DMatrix src,
int srcY0, int srcY1,
int srcX0, int srcX1,
DMatrix dst ) {
((ReshapeMatrix)dst).reshape(srcY1-srcY0,srcX1-srcX0);
extract(src,srcY0,srcY1,srcX0,srcX1,dst,0,0);
} | [
"public",
"static",
"void",
"extract",
"(",
"DMatrix",
"src",
",",
"int",
"srcY0",
",",
"int",
"srcY1",
",",
"int",
"srcX0",
",",
"int",
"srcX1",
",",
"DMatrix",
"dst",
")",
"{",
"(",
"(",
"ReshapeMatrix",
")",
"dst",
")",
".",
"reshape",
"(",
"srcY1... | Extract where the destination is reshaped to match the extracted region
@param src The original matrix which is to be copied. Not modified.
@param srcX0 Start column.
@param srcX1 Stop column+1.
@param srcY0 Start row.
@param srcY1 Stop row+1.
@param dst Where the submatrix are stored. Modified. | [
"Extract",
"where",
"the",
"destination",
"is",
"reshaped",
"to",
"match",
"the",
"extracted",
"region"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L1163-L1169 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java | CommonOps_DDRM.extract | public static void extract( DMatrixRMaj src,
int rows[] , int rowsSize ,
int cols[] , int colsSize , DMatrixRMaj dst ) {
if( rowsSize != dst.numRows || colsSize != dst.numCols )
throw new MatrixDimensionException("Unexpected number of r... | java | public static void extract( DMatrixRMaj src,
int rows[] , int rowsSize ,
int cols[] , int colsSize , DMatrixRMaj dst ) {
if( rowsSize != dst.numRows || colsSize != dst.numCols )
throw new MatrixDimensionException("Unexpected number of r... | [
"public",
"static",
"void",
"extract",
"(",
"DMatrixRMaj",
"src",
",",
"int",
"rows",
"[",
"]",
",",
"int",
"rowsSize",
",",
"int",
"cols",
"[",
"]",
",",
"int",
"colsSize",
",",
"DMatrixRMaj",
"dst",
")",
"{",
"if",
"(",
"rowsSize",
"!=",
"dst",
"."... | Extracts out a matrix from source given a sub matrix with arbitrary rows and columns specified in
two array lists
@param src Source matrix. Not modified.
@param rows array of row indexes
@param rowsSize maximum element in row array
@param cols array of column indexes
@param colsSize maximum element in column array
@pa... | [
"Extracts",
"out",
"a",
"matrix",
"from",
"source",
"given",
"a",
"sub",
"matrix",
"with",
"arbitrary",
"rows",
"and",
"columns",
"specified",
"in",
"two",
"array",
"lists"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L1236-L1249 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java | CommonOps_DDRM.extract | public static void extract(DMatrixRMaj src, int indexes[] , int length , DMatrixRMaj dst ) {
if( !MatrixFeatures_DDRM.isVector(dst))
throw new MatrixDimensionException("Dst must be a vector");
if( length != dst.getNumElements())
throw new MatrixDimensionException("Unexpected numb... | java | public static void extract(DMatrixRMaj src, int indexes[] , int length , DMatrixRMaj dst ) {
if( !MatrixFeatures_DDRM.isVector(dst))
throw new MatrixDimensionException("Dst must be a vector");
if( length != dst.getNumElements())
throw new MatrixDimensionException("Unexpected numb... | [
"public",
"static",
"void",
"extract",
"(",
"DMatrixRMaj",
"src",
",",
"int",
"indexes",
"[",
"]",
",",
"int",
"length",
",",
"DMatrixRMaj",
"dst",
")",
"{",
"if",
"(",
"!",
"MatrixFeatures_DDRM",
".",
"isVector",
"(",
"dst",
")",
")",
"throw",
"new",
... | Extracts the elements from the source matrix by their 1D index.
@param src Source matrix. Not modified.
@param indexes array of row indexes
@param length maximum element in row array
@param dst output matrix. Must be a vector of the correct length. | [
"Extracts",
"the",
"elements",
"from",
"the",
"source",
"matrix",
"by",
"their",
"1D",
"index",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L1259-L1268 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java | CommonOps_DDRM.extractRow | public static DMatrixRMaj extractRow(DMatrixRMaj a , int row , DMatrixRMaj out ) {
if( out == null)
out = new DMatrixRMaj(1,a.numCols);
else if( !MatrixFeatures_DDRM.isVector(out) || out.getNumElements() != a.numCols )
throw new MatrixDimensionException("Output must be a vector o... | java | public static DMatrixRMaj extractRow(DMatrixRMaj a , int row , DMatrixRMaj out ) {
if( out == null)
out = new DMatrixRMaj(1,a.numCols);
else if( !MatrixFeatures_DDRM.isVector(out) || out.getNumElements() != a.numCols )
throw new MatrixDimensionException("Output must be a vector o... | [
"public",
"static",
"DMatrixRMaj",
"extractRow",
"(",
"DMatrixRMaj",
"a",
",",
"int",
"row",
",",
"DMatrixRMaj",
"out",
")",
"{",
"if",
"(",
"out",
"==",
"null",
")",
"out",
"=",
"new",
"DMatrixRMaj",
"(",
"1",
",",
"a",
".",
"numCols",
")",
";",
"el... | Extracts the row from a matrix.
@param a Input matrix
@param row Which row is to be extracted
@param out output. Storage for the extracted row. If null then a new vector will be returned.
@return The extracted row. | [
"Extracts",
"the",
"row",
"from",
"a",
"matrix",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L1330-L1339 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java | CommonOps_DDRM.extractColumn | public static DMatrixRMaj extractColumn(DMatrixRMaj a , int column , DMatrixRMaj out ) {
if( out == null)
out = new DMatrixRMaj(a.numRows,1);
else if( !MatrixFeatures_DDRM.isVector(out) || out.getNumElements() != a.numRows )
throw new MatrixDimensionException("Output must be a ve... | java | public static DMatrixRMaj extractColumn(DMatrixRMaj a , int column , DMatrixRMaj out ) {
if( out == null)
out = new DMatrixRMaj(a.numRows,1);
else if( !MatrixFeatures_DDRM.isVector(out) || out.getNumElements() != a.numRows )
throw new MatrixDimensionException("Output must be a ve... | [
"public",
"static",
"DMatrixRMaj",
"extractColumn",
"(",
"DMatrixRMaj",
"a",
",",
"int",
"column",
",",
"DMatrixRMaj",
"out",
")",
"{",
"if",
"(",
"out",
"==",
"null",
")",
"out",
"=",
"new",
"DMatrixRMaj",
"(",
"a",
".",
"numRows",
",",
"1",
")",
";",... | Extracts the column from a matrix.
@param a Input matrix
@param column Which column is to be extracted
@param out output. Storage for the extracted column. If null then a new vector will be returned.
@return The extracted column. | [
"Extracts",
"the",
"column",
"from",
"a",
"matrix",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L1348-L1359 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java | CommonOps_DDRM.removeColumns | public static void removeColumns( DMatrixRMaj A , int col0 , int col1 )
{
if( col1 < col0 ) {
throw new IllegalArgumentException("col1 must be >= col0");
} else if( col0 >= A.numCols || col1 >= A.numCols ) {
throw new IllegalArgumentException("Columns which are to be removed ... | java | public static void removeColumns( DMatrixRMaj A , int col0 , int col1 )
{
if( col1 < col0 ) {
throw new IllegalArgumentException("col1 must be >= col0");
} else if( col0 >= A.numCols || col1 >= A.numCols ) {
throw new IllegalArgumentException("Columns which are to be removed ... | [
"public",
"static",
"void",
"removeColumns",
"(",
"DMatrixRMaj",
"A",
",",
"int",
"col0",
",",
"int",
"col1",
")",
"{",
"if",
"(",
"col1",
"<",
"col0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"col1 must be >= col0\"",
")",
";",
"}",
"e... | Removes columns from the matrix.
@param A Matrix. Modified
@param col0 First column
@param col1 Last column, inclusive. | [
"Removes",
"columns",
"from",
"the",
"matrix",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L1368-L1388 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java | CommonOps_DDRM.scaleRow | public static void scaleRow( double alpha , DMatrixRMaj A , int row ) {
int idx = row*A.numCols;
for (int col = 0; col < A.numCols; col++) {
A.data[idx++] *= alpha;
}
} | java | public static void scaleRow( double alpha , DMatrixRMaj A , int row ) {
int idx = row*A.numCols;
for (int col = 0; col < A.numCols; col++) {
A.data[idx++] *= alpha;
}
} | [
"public",
"static",
"void",
"scaleRow",
"(",
"double",
"alpha",
",",
"DMatrixRMaj",
"A",
",",
"int",
"row",
")",
"{",
"int",
"idx",
"=",
"row",
"*",
"A",
".",
"numCols",
";",
"for",
"(",
"int",
"col",
"=",
"0",
";",
"col",
"<",
"A",
".",
"numCols... | In-place scaling of a row in A
@param alpha scale factor
@param A matrix
@param row which row in A | [
"In",
"-",
"place",
"scaling",
"of",
"a",
"row",
"in",
"A"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L2398-L2403 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java | CommonOps_DDRM.scaleCol | public static void scaleCol( double alpha , DMatrixRMaj A , int col ) {
int idx = col;
for (int row = 0; row < A.numRows; row++, idx += A.numCols) {
A.data[idx] *= alpha;
}
} | java | public static void scaleCol( double alpha , DMatrixRMaj A , int col ) {
int idx = col;
for (int row = 0; row < A.numRows; row++, idx += A.numCols) {
A.data[idx] *= alpha;
}
} | [
"public",
"static",
"void",
"scaleCol",
"(",
"double",
"alpha",
",",
"DMatrixRMaj",
"A",
",",
"int",
"col",
")",
"{",
"int",
"idx",
"=",
"col",
";",
"for",
"(",
"int",
"row",
"=",
"0",
";",
"row",
"<",
"A",
".",
"numRows",
";",
"row",
"++",
",",
... | In-place scaling of a column in A
@param alpha scale factor
@param A matrix
@param col which row in A | [
"In",
"-",
"place",
"scaling",
"of",
"a",
"column",
"in",
"A"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L2412-L2417 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java | CommonOps_DDRM.elementLessThan | public static BMatrixRMaj elementLessThan(DMatrixRMaj A , double value , BMatrixRMaj output )
{
if( output == null ) {
output = new BMatrixRMaj(A.numRows,A.numCols);
}
output.reshape(A.numRows, A.numCols);
int N = A.getNumElements();
for (int i = 0; i < N; i++)... | java | public static BMatrixRMaj elementLessThan(DMatrixRMaj A , double value , BMatrixRMaj output )
{
if( output == null ) {
output = new BMatrixRMaj(A.numRows,A.numCols);
}
output.reshape(A.numRows, A.numCols);
int N = A.getNumElements();
for (int i = 0; i < N; i++)... | [
"public",
"static",
"BMatrixRMaj",
"elementLessThan",
"(",
"DMatrixRMaj",
"A",
",",
"double",
"value",
",",
"BMatrixRMaj",
"output",
")",
"{",
"if",
"(",
"output",
"==",
"null",
")",
"{",
"output",
"=",
"new",
"BMatrixRMaj",
"(",
"A",
".",
"numRows",
",",
... | Applies the > operator to each element in A. Results are stored in a boolean matrix.
@param A Input matrx
@param value value each element is compared against
@param output (Optional) Storage for results. Can be null. Is reshaped.
@return Boolean matrix with results | [
"Applies",
"the",
">",
";",
"operator",
"to",
"each",
"element",
"in",
"A",
".",
"Results",
"are",
"stored",
"in",
"a",
"boolean",
"matrix",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L2604-L2619 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java | CommonOps_DDRM.elements | public static DMatrixRMaj elements(DMatrixRMaj A , BMatrixRMaj marked , DMatrixRMaj output ) {
if( A.numRows != marked.numRows || A.numCols != marked.numCols )
throw new MatrixDimensionException("Input matrices must have the same shape");
if( output == null )
output = new DMatrix... | java | public static DMatrixRMaj elements(DMatrixRMaj A , BMatrixRMaj marked , DMatrixRMaj output ) {
if( A.numRows != marked.numRows || A.numCols != marked.numCols )
throw new MatrixDimensionException("Input matrices must have the same shape");
if( output == null )
output = new DMatrix... | [
"public",
"static",
"DMatrixRMaj",
"elements",
"(",
"DMatrixRMaj",
"A",
",",
"BMatrixRMaj",
"marked",
",",
"DMatrixRMaj",
"output",
")",
"{",
"if",
"(",
"A",
".",
"numRows",
"!=",
"marked",
".",
"numRows",
"||",
"A",
".",
"numCols",
"!=",
"marked",
".",
... | Returns a row matrix which contains all the elements in A which are flagged as true in 'marked'
@param A Input matrix
@param marked Input matrix marking elements in A
@param output Storage for output row vector. Can be null. Will be reshaped.
@return Row vector with marked elements | [
"Returns",
"a",
"row",
"matrix",
"which",
"contains",
"all",
"the",
"elements",
"in",
"A",
"which",
"are",
"flagged",
"as",
"true",
"in",
"marked"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L2754-L2772 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java | CommonOps_DDRM.countTrue | public static int countTrue(BMatrixRMaj A) {
int total = 0;
int N = A.getNumElements();
for (int i = 0; i < N; i++) {
if( A.data[i] )
total++;
}
return total;
} | java | public static int countTrue(BMatrixRMaj A) {
int total = 0;
int N = A.getNumElements();
for (int i = 0; i < N; i++) {
if( A.data[i] )
total++;
}
return total;
} | [
"public",
"static",
"int",
"countTrue",
"(",
"BMatrixRMaj",
"A",
")",
"{",
"int",
"total",
"=",
"0",
";",
"int",
"N",
"=",
"A",
".",
"getNumElements",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"N",
";",
"i",
"++",
")",
"... | Counts the number of elements in A which are true
@param A input matrix
@return number of true elements | [
"Counts",
"the",
"number",
"of",
"elements",
"in",
"A",
"which",
"are",
"true"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L2779-L2790 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java | CommonOps_DDRM.symmLowerToFull | public static void symmLowerToFull( DMatrixRMaj A )
{
if( A.numRows != A.numCols )
throw new MatrixDimensionException("Must be a square matrix");
final int cols = A.numCols;
for (int row = 0; row < A.numRows; row++) {
for (int col = row+1; col < cols; col++) {
... | java | public static void symmLowerToFull( DMatrixRMaj A )
{
if( A.numRows != A.numCols )
throw new MatrixDimensionException("Must be a square matrix");
final int cols = A.numCols;
for (int row = 0; row < A.numRows; row++) {
for (int col = row+1; col < cols; col++) {
... | [
"public",
"static",
"void",
"symmLowerToFull",
"(",
"DMatrixRMaj",
"A",
")",
"{",
"if",
"(",
"A",
".",
"numRows",
"!=",
"A",
".",
"numCols",
")",
"throw",
"new",
"MatrixDimensionException",
"(",
"\"Must be a square matrix\"",
")",
";",
"final",
"int",
"cols",
... | Given a symmetric matrix which is represented by a lower triangular matrix convert it back into
a full symmetric matrix.
@param A (Input) Lower triangular matrix (Output) symmetric matrix | [
"Given",
"a",
"symmetric",
"matrix",
"which",
"is",
"represented",
"by",
"a",
"lower",
"triangular",
"matrix",
"convert",
"it",
"back",
"into",
"a",
"full",
"symmetric",
"matrix",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L2942-L2954 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/decomposition/hessenberg/TridiagonalDecompositionHouseholderOrig_DDRM.java | TridiagonalDecompositionHouseholderOrig_DDRM.init | public void init( DMatrixRMaj A ) {
if( A.numRows != A.numCols)
throw new IllegalArgumentException("Must be square");
if( A.numCols != N ) {
N = A.numCols;
QT.reshape(N,N, false);
if( w.length < N ) {
w = new double[ N ];
... | java | public void init( DMatrixRMaj A ) {
if( A.numRows != A.numCols)
throw new IllegalArgumentException("Must be square");
if( A.numCols != N ) {
N = A.numCols;
QT.reshape(N,N, false);
if( w.length < N ) {
w = new double[ N ];
... | [
"public",
"void",
"init",
"(",
"DMatrixRMaj",
"A",
")",
"{",
"if",
"(",
"A",
".",
"numRows",
"!=",
"A",
".",
"numCols",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Must be square\"",
")",
";",
"if",
"(",
"A",
".",
"numCols",
"!=",
"N",
")"... | If needed declares and sets up internal data structures.
@param A Matrix being decomposed. | [
"If",
"needed",
"declares",
"and",
"sets",
"up",
"internal",
"data",
"structures",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/decomposition/hessenberg/TridiagonalDecompositionHouseholderOrig_DDRM.java#L240-L257 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/mult/MatrixMultProduct_DDRM.java | MatrixMultProduct_DDRM.inner_reorder_lower | public static void inner_reorder_lower(DMatrix1Row A , DMatrix1Row B )
{
final int cols = A.numCols;
B.reshape(cols,cols);
Arrays.fill(B.data,0);
for (int i = 0; i <cols; i++) {
for (int j = 0; j <=i; j++) {
B.data[i*cols+j] += A.data[i]*A.data[j];
... | java | public static void inner_reorder_lower(DMatrix1Row A , DMatrix1Row B )
{
final int cols = A.numCols;
B.reshape(cols,cols);
Arrays.fill(B.data,0);
for (int i = 0; i <cols; i++) {
for (int j = 0; j <=i; j++) {
B.data[i*cols+j] += A.data[i]*A.data[j];
... | [
"public",
"static",
"void",
"inner_reorder_lower",
"(",
"DMatrix1Row",
"A",
",",
"DMatrix1Row",
"B",
")",
"{",
"final",
"int",
"cols",
"=",
"A",
".",
"numCols",
";",
"B",
".",
"reshape",
"(",
"cols",
",",
"cols",
")",
";",
"Arrays",
".",
"fill",
"(",
... | Computes the inner product of A times A and stores the results in B. The inner product is symmetric and this
function will only store the lower triangle. The value of the upper triangular matrix is undefined.
<p>B = A<sup>T</sup>*A</sup>
@param A (Input) Matrix
@param B (Output) Storage for output. | [
"Computes",
"the",
"inner",
"product",
"of",
"A",
"times",
"A",
"and",
"stores",
"the",
"results",
"in",
"B",
".",
"The",
"inner",
"product",
"is",
"symmetric",
"and",
"this",
"function",
"will",
"only",
"store",
"the",
"lower",
"triangle",
".",
"The",
"... | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/mult/MatrixMultProduct_DDRM.java#L162-L182 | train |
lessthanoptimal/ejml | main/ejml-core/src/org/ejml/ops/ComplexMath_F64.java | ComplexMath_F64.pow | public static void pow(ComplexPolar_F64 a , int N , ComplexPolar_F64 result )
{
result.r = Math.pow(a.r,N);
result.theta = N*a.theta;
} | java | public static void pow(ComplexPolar_F64 a , int N , ComplexPolar_F64 result )
{
result.r = Math.pow(a.r,N);
result.theta = N*a.theta;
} | [
"public",
"static",
"void",
"pow",
"(",
"ComplexPolar_F64",
"a",
",",
"int",
"N",
",",
"ComplexPolar_F64",
"result",
")",
"{",
"result",
".",
"r",
"=",
"Math",
".",
"pow",
"(",
"a",
".",
"r",
",",
"N",
")",
";",
"result",
".",
"theta",
"=",
"N",
... | Computes the power of a complex number in polar notation
@param a Complex number
@param N Power it is to be multiplied by
@param result Result | [
"Computes",
"the",
"power",
"of",
"a",
"complex",
"number",
"in",
"polar",
"notation"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/ops/ComplexMath_F64.java#L159-L163 | train |
lessthanoptimal/ejml | main/ejml-core/src/org/ejml/ops/ComplexMath_F64.java | ComplexMath_F64.sqrt | public static void sqrt(Complex_F64 input, Complex_F64 root)
{
double r = input.getMagnitude();
double a = input.real;
root.real = Math.sqrt((r+a)/2.0);
root.imaginary = Math.sqrt((r-a)/2.0);
if( input.imaginary < 0 )
root.imaginary = -root.imaginary;
} | java | public static void sqrt(Complex_F64 input, Complex_F64 root)
{
double r = input.getMagnitude();
double a = input.real;
root.real = Math.sqrt((r+a)/2.0);
root.imaginary = Math.sqrt((r-a)/2.0);
if( input.imaginary < 0 )
root.imaginary = -root.imaginary;
} | [
"public",
"static",
"void",
"sqrt",
"(",
"Complex_F64",
"input",
",",
"Complex_F64",
"root",
")",
"{",
"double",
"r",
"=",
"input",
".",
"getMagnitude",
"(",
")",
";",
"double",
"a",
"=",
"input",
".",
"real",
";",
"root",
".",
"real",
"=",
"Math",
"... | Computes the square root of the complex number.
@param input Input complex number.
@param root Output. The square root of the input | [
"Computes",
"the",
"square",
"root",
"of",
"the",
"complex",
"number",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/ops/ComplexMath_F64.java#L207-L216 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/decomposition/eig/EigenPowerMethod_DDRM.java | EigenPowerMethod_DDRM.computeDirect | public boolean computeDirect( DMatrixRMaj A ) {
initPower(A);
boolean converged = false;
for( int i = 0; i < maxIterations && !converged; i++ ) {
// q0.print();
CommonOps_DDRM.mult(A,q0,q1);
double s = NormOps_DDRM.normPInf(q1);
Comm... | java | public boolean computeDirect( DMatrixRMaj A ) {
initPower(A);
boolean converged = false;
for( int i = 0; i < maxIterations && !converged; i++ ) {
// q0.print();
CommonOps_DDRM.mult(A,q0,q1);
double s = NormOps_DDRM.normPInf(q1);
Comm... | [
"public",
"boolean",
"computeDirect",
"(",
"DMatrixRMaj",
"A",
")",
"{",
"initPower",
"(",
"A",
")",
";",
"boolean",
"converged",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"maxIterations",
"&&",
"!",
"converged",
";",
"i",
"... | This method computes the eigen vector with the largest eigen value by using the
direct power method. This technique is the easiest to implement, but the slowest to converge.
Works only if all the eigenvalues are real.
@param A The matrix. Not modified.
@return If it converged or not. | [
"This",
"method",
"computes",
"the",
"eigen",
"vector",
"with",
"the",
"largest",
"eigen",
"value",
"by",
"using",
"the",
"direct",
"power",
"method",
".",
"This",
"technique",
"is",
"the",
"easiest",
"to",
"implement",
"but",
"the",
"slowest",
"to",
"conver... | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/decomposition/eig/EigenPowerMethod_DDRM.java#L107-L124 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/decomposition/eig/EigenPowerMethod_DDRM.java | EigenPowerMethod_DDRM.checkConverged | private boolean checkConverged(DMatrixRMaj A) {
double worst = 0;
double worst2 = 0;
for( int j = 0; j < A.numRows; j++ ) {
double val = Math.abs(q2.data[j] - q0.data[j]);
if( val > worst ) worst = val;
val = Math.abs(q2.data[j] + q0.data[j]);
if( ... | java | private boolean checkConverged(DMatrixRMaj A) {
double worst = 0;
double worst2 = 0;
for( int j = 0; j < A.numRows; j++ ) {
double val = Math.abs(q2.data[j] - q0.data[j]);
if( val > worst ) worst = val;
val = Math.abs(q2.data[j] + q0.data[j]);
if( ... | [
"private",
"boolean",
"checkConverged",
"(",
"DMatrixRMaj",
"A",
")",
"{",
"double",
"worst",
"=",
"0",
";",
"double",
"worst2",
"=",
"0",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"A",
".",
"numRows",
";",
"j",
"++",
")",
"{",
"doubl... | Test for convergence by seeing if the element with the largest change
is smaller than the tolerance. In some test cases it alternated between
the + and - values of the eigen vector. When this happens it seems to have "converged"
to a non-dominant eigen vector. At least in the case I looked at. I haven't devoted
a... | [
"Test",
"for",
"convergence",
"by",
"seeing",
"if",
"the",
"element",
"with",
"the",
"largest",
"change",
"is",
"smaller",
"than",
"the",
"tolerance",
".",
"In",
"some",
"test",
"cases",
"it",
"alternated",
"between",
"the",
"+",
"and",
"-",
"values",
"of"... | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/decomposition/eig/EigenPowerMethod_DDRM.java#L147-L168 | train |
lessthanoptimal/ejml | examples/src/org/ejml/example/PrincipalComponentAnalysis.java | PrincipalComponentAnalysis.setup | public void setup( int numSamples , int sampleSize ) {
mean = new double[ sampleSize ];
A.reshape(numSamples,sampleSize,false);
sampleIndex = 0;
numComponents = -1;
} | java | public void setup( int numSamples , int sampleSize ) {
mean = new double[ sampleSize ];
A.reshape(numSamples,sampleSize,false);
sampleIndex = 0;
numComponents = -1;
} | [
"public",
"void",
"setup",
"(",
"int",
"numSamples",
",",
"int",
"sampleSize",
")",
"{",
"mean",
"=",
"new",
"double",
"[",
"sampleSize",
"]",
";",
"A",
".",
"reshape",
"(",
"numSamples",
",",
"sampleSize",
",",
"false",
")",
";",
"sampleIndex",
"=",
"... | Must be called before any other functions. Declares and sets up internal data structures.
@param numSamples Number of samples that will be processed.
@param sampleSize Number of elements in each sample. | [
"Must",
"be",
"called",
"before",
"any",
"other",
"functions",
".",
"Declares",
"and",
"sets",
"up",
"internal",
"data",
"structures",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/examples/src/org/ejml/example/PrincipalComponentAnalysis.java#L80-L85 | train |
lessthanoptimal/ejml | examples/src/org/ejml/example/PrincipalComponentAnalysis.java | PrincipalComponentAnalysis.getBasisVector | public double[] getBasisVector( int which ) {
if( which < 0 || which >= numComponents )
throw new IllegalArgumentException("Invalid component");
DMatrixRMaj v = new DMatrixRMaj(1,A.numCols);
CommonOps_DDRM.extract(V_t,which,which+1,0,A.numCols,v,0,0);
return v.data;
} | java | public double[] getBasisVector( int which ) {
if( which < 0 || which >= numComponents )
throw new IllegalArgumentException("Invalid component");
DMatrixRMaj v = new DMatrixRMaj(1,A.numCols);
CommonOps_DDRM.extract(V_t,which,which+1,0,A.numCols,v,0,0);
return v.data;
} | [
"public",
"double",
"[",
"]",
"getBasisVector",
"(",
"int",
"which",
")",
"{",
"if",
"(",
"which",
"<",
"0",
"||",
"which",
">=",
"numComponents",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid component\"",
")",
";",
"DMatrixRMaj",
"v",
"=... | Returns a vector from the PCA's basis.
@param which Which component's vector is to be returned.
@return Vector from the PCA basis. | [
"Returns",
"a",
"vector",
"from",
"the",
"PCA",
"s",
"basis",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/examples/src/org/ejml/example/PrincipalComponentAnalysis.java#L160-L168 | train |
lessthanoptimal/ejml | examples/src/org/ejml/example/PrincipalComponentAnalysis.java | PrincipalComponentAnalysis.sampleToEigenSpace | public double[] sampleToEigenSpace( double[] sampleData ) {
if( sampleData.length != A.getNumCols() )
throw new IllegalArgumentException("Unexpected sample length");
DMatrixRMaj mean = DMatrixRMaj.wrap(A.getNumCols(),1,this.mean);
DMatrixRMaj s = new DMatrixRMaj(A.getNumCols(),1,tru... | java | public double[] sampleToEigenSpace( double[] sampleData ) {
if( sampleData.length != A.getNumCols() )
throw new IllegalArgumentException("Unexpected sample length");
DMatrixRMaj mean = DMatrixRMaj.wrap(A.getNumCols(),1,this.mean);
DMatrixRMaj s = new DMatrixRMaj(A.getNumCols(),1,tru... | [
"public",
"double",
"[",
"]",
"sampleToEigenSpace",
"(",
"double",
"[",
"]",
"sampleData",
")",
"{",
"if",
"(",
"sampleData",
".",
"length",
"!=",
"A",
".",
"getNumCols",
"(",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Unexpected sample leng... | Converts a vector from sample space into eigen space.
@param sampleData Sample space data.
@return Eigen space projection. | [
"Converts",
"a",
"vector",
"from",
"sample",
"space",
"into",
"eigen",
"space",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/examples/src/org/ejml/example/PrincipalComponentAnalysis.java#L176-L189 | train |
lessthanoptimal/ejml | examples/src/org/ejml/example/PrincipalComponentAnalysis.java | PrincipalComponentAnalysis.eigenToSampleSpace | public double[] eigenToSampleSpace( double[] eigenData ) {
if( eigenData.length != numComponents )
throw new IllegalArgumentException("Unexpected sample length");
DMatrixRMaj s = new DMatrixRMaj(A.getNumCols(),1);
DMatrixRMaj r = DMatrixRMaj.wrap(numComponents,1,eigenData);
... | java | public double[] eigenToSampleSpace( double[] eigenData ) {
if( eigenData.length != numComponents )
throw new IllegalArgumentException("Unexpected sample length");
DMatrixRMaj s = new DMatrixRMaj(A.getNumCols(),1);
DMatrixRMaj r = DMatrixRMaj.wrap(numComponents,1,eigenData);
... | [
"public",
"double",
"[",
"]",
"eigenToSampleSpace",
"(",
"double",
"[",
"]",
"eigenData",
")",
"{",
"if",
"(",
"eigenData",
".",
"length",
"!=",
"numComponents",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Unexpected sample length\"",
")",
";",
"DMa... | Converts a vector from eigen space into sample space.
@param eigenData Eigen space data.
@return Sample space projection. | [
"Converts",
"a",
"vector",
"from",
"eigen",
"space",
"into",
"sample",
"space",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/examples/src/org/ejml/example/PrincipalComponentAnalysis.java#L197-L210 | train |
lessthanoptimal/ejml | examples/src/org/ejml/example/PrincipalComponentAnalysis.java | PrincipalComponentAnalysis.response | public double response( double[] sample ) {
if( sample.length != A.numCols )
throw new IllegalArgumentException("Expected input vector to be in sample space");
DMatrixRMaj dots = new DMatrixRMaj(numComponents,1);
DMatrixRMaj s = DMatrixRMaj.wrap(A.numCols,1,sample);
CommonO... | java | public double response( double[] sample ) {
if( sample.length != A.numCols )
throw new IllegalArgumentException("Expected input vector to be in sample space");
DMatrixRMaj dots = new DMatrixRMaj(numComponents,1);
DMatrixRMaj s = DMatrixRMaj.wrap(A.numCols,1,sample);
CommonO... | [
"public",
"double",
"response",
"(",
"double",
"[",
"]",
"sample",
")",
"{",
"if",
"(",
"sample",
".",
"length",
"!=",
"A",
".",
"numCols",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Expected input vector to be in sample space\"",
")",
";",
"DMatri... | Computes the dot product of each basis vector against the sample. Can be used as a measure
for membership in the training sample set. High values correspond to a better fit.
@param sample Sample of original data.
@return Higher value indicates it is more likely to be a member of input dataset. | [
"Computes",
"the",
"dot",
"product",
"of",
"each",
"basis",
"vector",
"against",
"the",
"sample",
".",
"Can",
"be",
"used",
"as",
"a",
"measure",
"for",
"membership",
"in",
"the",
"training",
"sample",
"set",
".",
"High",
"values",
"correspond",
"to",
"a",... | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/examples/src/org/ejml/example/PrincipalComponentAnalysis.java#L247-L257 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/factory/DecompositionFactory_DDRM.java | DecompositionFactory_DDRM.decomposeSafe | public static <T extends DMatrix> boolean decomposeSafe(DecompositionInterface<T> decomp, T M ) {
if( decomp.inputModified() ) {
return decomp.decompose(M.<T>copy());
} else {
return decomp.decompose(M);
}
} | java | public static <T extends DMatrix> boolean decomposeSafe(DecompositionInterface<T> decomp, T M ) {
if( decomp.inputModified() ) {
return decomp.decompose(M.<T>copy());
} else {
return decomp.decompose(M);
}
} | [
"public",
"static",
"<",
"T",
"extends",
"DMatrix",
">",
"boolean",
"decomposeSafe",
"(",
"DecompositionInterface",
"<",
"T",
">",
"decomp",
",",
"T",
"M",
")",
"{",
"if",
"(",
"decomp",
".",
"inputModified",
"(",
")",
")",
"{",
"return",
"decomp",
".",
... | A simple convinience function that decomposes the matrix but automatically checks the input ti make
sure is not being modified.
@param decomp Decomposition which is being wrapped
@param M THe matrix being decomposed.
@param <T> Matrix type.
@return If the decomposition was successful or not. | [
"A",
"simple",
"convinience",
"function",
"that",
"decomposes",
"the",
"matrix",
"but",
"automatically",
"checks",
"the",
"input",
"ti",
"make",
"sure",
"is",
"not",
"being",
"modified",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/factory/DecompositionFactory_DDRM.java#L331-L337 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF2.java | CommonOps_DDF2.extractColumn | public static DMatrix2 extractColumn( DMatrix2x2 a , int column , DMatrix2 out ) {
if( out == null) out = new DMatrix2();
switch( column ) {
case 0:
out.a1 = a.a11;
out.a2 = a.a21;
break;
case 1:
out.a1 = a.a12;
... | java | public static DMatrix2 extractColumn( DMatrix2x2 a , int column , DMatrix2 out ) {
if( out == null) out = new DMatrix2();
switch( column ) {
case 0:
out.a1 = a.a11;
out.a2 = a.a21;
break;
case 1:
out.a1 = a.a12;
... | [
"public",
"static",
"DMatrix2",
"extractColumn",
"(",
"DMatrix2x2",
"a",
",",
"int",
"column",
",",
"DMatrix2",
"out",
")",
"{",
"if",
"(",
"out",
"==",
"null",
")",
"out",
"=",
"new",
"DMatrix2",
"(",
")",
";",
"switch",
"(",
"column",
")",
"{",
"ca... | Extracts the column from the matrix a.
@param a Input matrix
@param column Which column is to be extracted
@param out output. Storage for the extracted column. If null then a new vector will be returned.
@return The extracted column. | [
"Extracts",
"the",
"column",
"from",
"the",
"matrix",
"a",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF2.java#L1181-L1196 | train |
lessthanoptimal/ejml | main/ejml-zdense/src/org/ejml/dense/row/factory/DecompositionFactory_ZDRM.java | DecompositionFactory_ZDRM.decomposeSafe | public static boolean decomposeSafe(DecompositionInterface<ZMatrixRMaj> decomposition, ZMatrixRMaj a) {
if( decomposition.inputModified() ) {
a = a.copy();
}
return decomposition.decompose(a);
} | java | public static boolean decomposeSafe(DecompositionInterface<ZMatrixRMaj> decomposition, ZMatrixRMaj a) {
if( decomposition.inputModified() ) {
a = a.copy();
}
return decomposition.decompose(a);
} | [
"public",
"static",
"boolean",
"decomposeSafe",
"(",
"DecompositionInterface",
"<",
"ZMatrixRMaj",
">",
"decomposition",
",",
"ZMatrixRMaj",
"a",
")",
"{",
"if",
"(",
"decomposition",
".",
"inputModified",
"(",
")",
")",
"{",
"a",
"=",
"a",
".",
"copy",
"(",... | Decomposes the input matrix 'a' and makes sure it isn't modified. | [
"Decomposes",
"the",
"input",
"matrix",
"a",
"and",
"makes",
"sure",
"it",
"isn",
"t",
"modified",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/factory/DecompositionFactory_ZDRM.java#L83-L89 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/block/TriangularSolver_DDRB.java | TriangularSolver_DDRB.invert | public static void invert( final int blockLength ,
final boolean upper ,
final DSubmatrixD1 T ,
final DSubmatrixD1 T_inv ,
final double temp[] )
{
if( upper )
throw new Ill... | java | public static void invert( final int blockLength ,
final boolean upper ,
final DSubmatrixD1 T ,
final DSubmatrixD1 T_inv ,
final double temp[] )
{
if( upper )
throw new Ill... | [
"public",
"static",
"void",
"invert",
"(",
"final",
"int",
"blockLength",
",",
"final",
"boolean",
"upper",
",",
"final",
"DSubmatrixD1",
"T",
",",
"final",
"DSubmatrixD1",
"T_inv",
",",
"final",
"double",
"temp",
"[",
"]",
")",
"{",
"if",
"(",
"upper",
... | Inverts an upper or lower triangular block submatrix.
@param blockLength
@param upper Is it upper or lower triangular.
@param T Triangular matrix that is to be inverted. Must be block aligned. Not Modified.
@param T_inv Where the inverse is stored. This can be the same as T. Modified.
@param temp Work space variab... | [
"Inverts",
"an",
"upper",
"or",
"lower",
"triangular",
"block",
"submatrix",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/block/TriangularSolver_DDRB.java#L51-L101 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/RandomMatrices_DDRM.java | RandomMatrices_DDRM.span | public static DMatrixRMaj[] span(int dimen, int numVectors , Random rand ) {
if( dimen < numVectors )
throw new IllegalArgumentException("The number of vectors must be less than or equal to the dimension");
DMatrixRMaj u[] = new DMatrixRMaj[numVectors];
u[0] = RandomMatrices_DDRM.r... | java | public static DMatrixRMaj[] span(int dimen, int numVectors , Random rand ) {
if( dimen < numVectors )
throw new IllegalArgumentException("The number of vectors must be less than or equal to the dimension");
DMatrixRMaj u[] = new DMatrixRMaj[numVectors];
u[0] = RandomMatrices_DDRM.r... | [
"public",
"static",
"DMatrixRMaj",
"[",
"]",
"span",
"(",
"int",
"dimen",
",",
"int",
"numVectors",
",",
"Random",
"rand",
")",
"{",
"if",
"(",
"dimen",
"<",
"numVectors",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The number of vectors must be les... | is there a faster algorithm out there? This one is a bit sluggish | [
"is",
"there",
"a",
"faster",
"algorithm",
"out",
"there?",
"This",
"one",
"is",
"a",
"bit",
"sluggish"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/RandomMatrices_DDRM.java#L58-L101 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.