"Error during serialization" with API for Java and large matrix
5 次查看(过去 30 天)
显示 更早的评论
Hi,
I'm using the MATLAB API for Java to factor large matrices. Within my Java code I start the MatlabEngine:
MatlabEngine eng = MatlabEngine.startMatlab();
Then I call the svd function and pass it a large 2D array of double values as input:
// 'a' is a large double[][]
Object[] results = eng.feval(3, "svd", a);
double[][] S = (double[][])results[1];
double[][] V = (double[][])results[2];
This works very nicely for sizes of the array 'a' up to around 23000x23000. However for larger matrices, the Matlab call throws an exception:
com.mathworks.engine.MatlabExecutionException: svd
at com.mathworks.engine.FutureResult.get(FutureResult.java:64)
at com.mathworks.engine.MatlabEngine.feval(MatlabEngine.java:464)
at sandbox.TestSvdEvd.main(TestSvdEvd.java:184)
Caused by: com.mathworks.mvm.exec.MvmException: Error during serialization
... 3 more
com.mathworks.mvm.exec.MvmException: Error during serialization
Matlab has no problem processing the same matrix in a standalone Matlab process. So I seem to be hitting some memory limit with the MATLAB API for Java, however there's plenty of RAM available to the JVM.
So I guess my question(s) is: am I doing something wrong with the Java API? Is there some way I can increase the memory available to the Matlab engine to avoid this exception?
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Call MATLAB from Java 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!