GenericLinearAlgebra.jl

GenericLinearAlgebra.jl

Documentation for GenericLinearAlgebra.jl

LinearAlgebra.svd!Function.
svd!(A[, tol, full, debug])::SVD

A generic singular value decomposition (SVD). The implementation only uses Julia functions so the SVD can be computed for any element type provided that the necessary arithmetic operations are supported by the element type.

  • tol: The relative tolerance for determining convergence. The default value is eltype(T) where T is the element type of the input matrix bidiagonal (i.e. after converting the matrix to bidiagonal form).

  • full: Sepcifies if all the left and right singular vectors be returned or if only the vectors us to the number of rows and columns of the input matrix A should be returned (the default).

  • debug: A Boolean flag to activate debug information during the executions of the algorithm. The default is false.

Algorithm

...tomorrow

Example

source
svdvals!(A [, tol, debug])

Generic computation of singular values.

julia> using LinearAlgebra, GenericLinearAlgebra, Quaternions

julia> n = 20;

julia> H = [big(1)/(i + j - 1) for i in 1:n, j in 1:n]; # The Hilbert matrix

julia> Float64(svdvals(H)[end]/svdvals(Float64.(H))[end] - 1) # The relative error of the LAPACK based solution in 64 bit floating point.
-0.9999999999447275

julia> A = qr([Quaternion(randn(4)...) for i in 1:3, j in 1:3]).Q *
           Diagonal([3, 2, 1]) *
           qr([Quaternion(randn(4)...) for i in 1:3, j in 1:3]).Q'; # A quaternion matrix with the singular value 1, 2, and 3.

julia> svdvals(A) ≈ [3, 2, 1]
true
source