svdvals(A)

svdvals(A)

Returns the singular values of A.

Examples

julia> A = [1 2; 3 4];
julia> B = [5 6; 7 8];
julia> svdvals(A, B)
2-element Array{Float64,1}:
  11.80197131111892
   0.21165790451378655

This example calculates the singular values from the generalized singular value decomposition of matrices A and B using the svdvals function. The resulting array contains the singular values in descending order.

julia> C = [1 0 0; 0 2 0; 0 0 3];
julia> D = [4 5 6; 7 8 9; 10 11 12];
julia> svdvals(C, D)
3-element Array{Float64,1}:
 14.741966590340863
  1.2295385530746735
  0.0

In this example, the matrices C and D are used for the generalized singular value decomposition, and the resulting array contains the singular values.

Common mistake example:

julia> X = [1 2; 3 4; 5 6];
julia> Y = [7 8; 9 10];
julia> svdvals(X, Y)
ERROR: DimensionMismatch("A has dimensions (3,2) but B has dimensions (2,2)")

Here, the matrices X and Y have incompatible dimensions for the generalized singular value decomposition. Make sure that the input matrices have compatible dimensions to avoid such errors when using svdvals(A, B).

See Also

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: