Decomposition object saveobj method not supported?

Illustration
Shumao Zhang - 2021-12-07T11:39:30+00:00
Question: Decomposition object saveobj method not supported?

Hi there, I need to perform a lot of computation. I am using some sort of 3D histogram, which is filled with logs about entitites for each cell. Each cell is associated with some particular matrix, which plays the role of RHS of system of linear equations. In order to speed up my computations, solving systems with variable LHS but for specific cell with constant RHS (mentioned earlier), I want to use decomposition object, which is preferable way of handling such issue. The problem is, that creating the grid can be computationally exhaustive and because of that I create it once, save to the mat file and load. This approach is much faster. But if part of the grid is cell array with decomposition object, I receive this warning   Warning: Saving a decomposition is not supported. > In decomposition/saveobj (line 667). Minimal not working example could be decomp = decomposition([1 2; 3 5], 'lu'); save('decomp.mat', 'decomp', '-v7.3'); I use Matlab R2018a. Thank you for advice.

Expert Answer

Profile picture of Kshitij Singh Kshitij Singh answered . 2025-11-20

This is a limitation on the decomposition object: It cannot be saved into .mat file. The background for this is that some types of decompositions are stored in an internal format defined by a library we use: We can't practically save these to a file, and if we tried, there would likely be problems when loading such a mat-file on a different computer.
 
As a workaround, you could instead store the factors of an LU decomposition of each matrix, and then use this matrix to solve the linear system. Unfortunately, this is less elegant than using the decomposition object.


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!