Note about SVD Calculations

The \( U \), \( S \), and \( V \) matrices returned from the svd() function cannot be multiplied directly.

As you can see from the code, the \( S \) vector must be converted into a diagonal matrix. This may cause a problem as the size of the matrices do not fit the rules of matrix multiplication, where the number of columns in a matrix must match the number of rows in the subsequent matrix.

If you wish to include the zero singular values, you will need to resize the matrices and set up a diagonal matrix as done in the above example