冗長な列と行を保存している可能性があります。特異値の対角線を切り捨てた後 (もちろん、1D 配列として保存しています)、行列の列と行をそれぞれ macth に切り捨てる必要がありU
ますV^t
。それ以外の場合は、再構築中に 0 に乗算される一連の値を格納していますM = U * S * Vt
。
たとえば、Java 用のApache Commonsライブラリを使用します (私は MatLab にあまり詳しくないため、申し訳ありません)。
// compute your SVD from some input matrix
final SingularValueDecomposition svd = new SingularValueDecomposition(matrix);
// only store necessary matrix portions in memory required to compute compressed matrix
final RealMatrix u = svd.getU().getSubMatrix(0, svd.getU().getRowDimension()-1, 0, (svd.getU().getColumnDimension()-1)-compression);
// grab singular values
final RealMatrix s = svd.getS().getSubMatrix(0, (size-compression)-1, 0, (size-compression)-1);
// grab V transpose
final RealMatrix vt = svd.getVT().getSubMatrix(0, (svd.getVT().getRowDimension()-1)-compression, 0, svd.getVT().getColumnDimension()-1);
// compute compressed matrix
return new Array2DRowRealMatrix(u)
.multiply(new Array2DRowRealMatrix(s))
.multiply(new Array2DRowRealMatrix(vt));