f08kjc computes the one-sided Jacobi singular value decomposition (SVD) of a real matrix , , with fast scaled rotations and de Rijk’s pivoting, optionally computing the left and/or right singular vectors. For , the functions f08kbcorf08kdc may be used.
The function may be called by the names: f08kjc, nag_lapackeig_dgesvj or nag_dgesvj.
3Description
The SVD is written as
where is an diagonal matrix, is an orthonormal matrix, and is an orthogonal matrix. The diagonal elements of are the singular values of in descending order of magnitude. The columns of and are the left and the right singular vectors of .
4References
Anderson E, Bai Z, Bischof C, Blackford S, Demmel J, Dongarra J J, Du Croz J J, Greenbaum A, Hammarling S, McKenney A and Sorensen D (1999) LAPACK Users' Guide (3rd Edition) SIAM, Philadelphia https://www.netlib.org/lapack/lug
Drmač Z and Veselić K (2008a) New fast and accurate Jacobi SVD Algorithm I SIAM J. Matrix Anal. Appl.29 4
Drmač Z and Veselić K (2008b) New fast and accurate Jacobi SVD Algorithm II SIAM J. Matrix Anal. Appl.29 4
Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore
5Arguments
1: – Nag_OrderTypeInput
On entry: the order argument specifies the two-dimensional storage scheme being used, i.e., row-major ordering or column-major ordering. C language defined storage is specified by . See Section 3.1.3 in the Introduction to the NAG Library CL Interface for a more detailed explanation of the use of this argument.
Constraint:
or .
2: – Nag_MatrixTypeInput
On entry: specifies the structure of matrix .
The input matrix is lower triangular.
The input matrix is upper triangular.
The input matrix is a general matrix, .
Constraint:
, or .
3: – Nag_LeftVecsTypeInput
On entry: specifies whether to compute the left singular vectors and if so whether you want to control their numerical orthogonality threshold.
The left singular vectors corresponding to the nonzero singular values are computed and returned in the leading columns of a. See more details in the description of a. The numerical orthogonality threshold is set to approximately , where is the machine precision and .
Analogous to , except that you can control the level of numerical orthogonality of the computed left singular vectors. The orthogonality threshold is set to . The option can be used if is a satisfactory orthogonality of the computed left singular vectors, so could save a few sweeps of Jacobi rotations. See the descriptions of a and ctol.
The matrix is not computed. However, see the description of a.
Constraint:
, or .
4: – Nag_RightVecsTypeInput
On entry: specifies whether and how to compute the right singular vectors.
The matrix is computed and returned in the array v.
The Jacobi rotations are applied to the leading part of the array v. In other words, the right singular vector matrix is not computed explicitly, instead it is applied to an matrix initially stored in the first mv rows of v.
The matrix is not computed and the array v is not referenced.
Constraint:
, or .
5: – IntegerInput
On entry: , the number of rows of the matrix .
Constraint:
.
6: – IntegerInput
On entry: , the number of columns of the matrix .
Constraint:
.
7: – doubleInput/Output
Note: the dimension, dim, of the array a
must be at least
when
;
when
.
The th element of the matrix is stored in
when ;
when .
On entry: the matrix .
On exit: the matrix containing the left singular vectors of .
If or
if
orthonormal columns of are returned in the leading columns of the array a. Here is the number of computed singular values of that are above the safe range parameter, as returned by X02AMC. The singular vectors corresponding to underflowed or zero singular values are not computed. The value of is returned by rounding to the nearest whole number. Also see the descriptions of sva and work. The computed columns of are mutually numerically orthogonal up to approximately ; or (), where is the machine precision, see the description of jobu.
if
f08kjc did not converge in iterations (sweeps). In this case, the computed columns of may not be orthogonal up to . The output (stored in a), (given by the computed singular values in sva) and is still a decomposition of the input matrix in the sense that the residual is small, where is the value returned in .
If
if
Note that the left singular vectors are ‘for free’ in the one-sided Jacobi SVD algorithm. However, if only the singular values are needed, the level of numerical orthogonality of is not an issue and iterations are stopped when the columns of the iterated matrix are numerically orthogonal up to approximately . Thus, on exit, a contains the columns of scaled with the corresponding singular values.
if
f08kjc did not converge in iterations (sweeps).
8: – IntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array a.
Constraints:
if ,
;
if , .
9: – doubleOutput
On exit: the, possibly scaled, singular values of .
If
The singular values of are
, for , where is the scale factor stored in . Normally , however, if some of the singular values of might underflow or overflow, then and the scale factor needs to be applied to obtain the singular values.
If
f08kjc did not converge in iterations and may not be accurate.
10: – IntegerInput
On entry: if , the product of Jacobi rotations is applied to the first rows of v.
On entry: the stride separating row or column elements (depending on the value of order) in the array v.
Constraints:
if ,
if , ;
if , ;
otherwise ;
if ,
if ,
;
if ,
;
otherwise .
13: – doubleInput
On entry: if , , the threshold for convergence. The process stops if all columns of are mutually orthogonal up to . It is required that , i.e., it is not possible to force the function to obtain orthogonality below . greater than is meaningless, where is the machine precision.
Constraint:
if , .
14: – doubleOutput
On exit: contains information about the completed job.
the scaling factor, , such that
, for are the computed singular values of . (See description of sva.)
gives the number of the computed nonzero singular values.
gives the number of the computed singular values that are larger than the underflow threshold.
gives the number of iterations (sweeps of Jacobi rotations) needed for numerical convergence.
in the last iteration (sweep). This is useful information in cases when f08kjc did not converge, as it can be used to estimate whether the output is still useful and for subsequent analysis.
The largest absolute value over all sines of the Jacobi rotation angles in the last sweep. It can be useful for subsequent analysis.
15: – NagError *Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).
6Error Indicators and Warnings
NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
NE_BAD_PARAM
On entry, argument had an illegal value.
NE_CONVERGENCE
f08kjc did not converge in the allowed number of iterations (), but its output might still be useful.
NE_ENUM_INT_2
On entry, , and .
Constraint: if ,
; if ,
; otherwise .
NE_ENUM_INT_3
On entry, , , and .
Constraint: if , ;
if , ;
otherwise .
NE_ENUM_REAL_1
On entry, and .
Constraint: if , .
NE_INT
On entry, .
Constraint: .
On entry, .
Constraint: .
On entry, . Constraint: .
On entry, . Constraint: .
NE_INT_2
On entry, and .
Constraint: .
On entry, and .
Constraint: .
On entry, and .
Constraint: .
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
7Accuracy
The computed SVD is nearly the exact SVD for a nearby matrix , where
and is the machine precision. In addition, the computed singular vectors are nearly orthogonal to working precision. See Section 4.9 of Anderson et al. (1999) for further details.
See Section 6 of Drmač and Veselić (2008a) for a detailed discussion of the accuracy of the computed SVD.
8Parallelism and Performance
Background information to multithreading can be found in the Multithreading documentation.
f08kjc makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.
9Further Comments
This SVD algorithm is numerically superior to the bidiagonalization based algorithm implemented by f08kbc and the divide and conquer algorithm implemented by f08kdc algorithms and is considerably faster than previous implementations of the (equally accurate) Jacobi SVD method. Moreover, this algorithm can compute the SVD faster than f08kbc and not much slower than f08kdc. See Section 3.3 of Drmač and Veselić (2008b) for the details.