Archive for the ‘FAQ’ Category.
October 9, 2008, 2:32 pm
UJMP supports many Matlab functions, but not all.
But you can execute Matlab from within UJMP when you use Linux:
Matlab.getInstance().setMatrix("matrixInMatlab", ujmpMatrix);
Matlab.getInstance().execute("result = matlabFunction(matrixInMatlab)");
Matrix m = Matlab.getInstance().getMatrix("result");
Unfortunately, this is not working in Windows.
You might have to tell UJMP through a parameter, where the program is installed:
-DMatlab="/opt/matlab/matlab"
October 9, 2008, 2:27 pm
Resizing depends on the matrix implementation. A dense matrix is fixed in size, as the data is stored in a double[][] array.
However, some matrix implementations allow resizing. For example, you can create a sparse matrix with MatrixFactory.sparse(0, 0) and then change the size dynamically with matrix.setSize(5, 5). Note that sparse matrices are much slower than dense matrices.
It might be better to append one matrix to another for resizing:
Matrix matrix = Matrix.zeros(5, 5);
Matrix newRow = Matrix.zeros(1, 5);
Matrix biggerMatrix = matrix.appendVertically(newRow);
or
Matrix biggerMatrix = MatrixFactory.vertCat(matrix, newRow);
October 9, 2008, 2:26 pm
It is possible to create a zero size matrix:
Matrix m = MatrixFactory.zeros(0, 0);
October 9, 2008, 11:42 am
This happens when you sort a StringMatrix with numbers in it. Use convert(ValueType.DOUBLE) to transform the matrix into a DoubleMatrix before sorting.
October 9, 2008, 11:42 am
No, unfortunately not. UJMP is designed for Java 6 and uses generics and other features introduced in Java 5.0. Without modifications, it will not run with lower versions.