g02ae computes the factor loading matrix associated with the nearest correlation matrix with -factor structure, in the Frobenius norm, to a given square, input matrix.
Syntax
C# |
---|
public static void g02ae( double[,] g, int n, int k, double errtol, int maxit, double[,] x, out int iter, out int feval, out double nrmpgd, out int ifail ) |
Visual Basic |
---|
Public Shared Sub g02ae ( _ g As Double(,), _ n As Integer, _ k As Integer, _ errtol As Double, _ maxit As Integer, _ x As Double(,), _ <OutAttribute> ByRef iter As Integer, _ <OutAttribute> ByRef feval As Integer, _ <OutAttribute> ByRef nrmpgd As Double, _ <OutAttribute> ByRef ifail As Integer _ ) |
Visual C++ |
---|
public: static void g02ae( array<double,2>^ g, int n, int k, double errtol, int maxit, array<double,2>^ x, [OutAttribute] int% iter, [OutAttribute] int% feval, [OutAttribute] double% nrmpgd, [OutAttribute] int% ifail ) |
F# |
---|
static member g02ae : g : float[,] * n : int * k : int * errtol : float * maxit : int * x : float[,] * iter : int byref * feval : int byref * nrmpgd : float byref * ifail : int byref -> unit |
Parameters
- g
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, n]Note: dim1 must satisfy the constraint:On entry: , the initial matrix.On exit: a symmetric matrix with the diagonal elements set to unity.
- n
- Type: System..::..Int32On entry: , the order of the matrix .Constraint: .
- k
- Type: System..::..Int32On entry: , the number of factors and columns of .Constraint: .
- errtol
- Type: System..::..DoubleOn entry: the termination tolerance for the projected gradient norm. See references for further details. If then is used. This is often a suitable default value.
- maxit
- Type: System..::..Int32On entry: specifies the maximum number of iterations in the spectral projected gradient method.If , is used.
- x
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, k]Note: dim1 must satisfy the constraint:On exit: contains the matrix .
- iter
- Type: System..::..Int32%On exit: the number of steps taken in the spectral projected gradient method.
- feval
- Type: System..::..Int32%On exit: the number of evaluations of .
- nrmpgd
- Type: System..::..Double%On exit: the norm of the projected gradient at the final iteration.
- ifail
- Type: System..::..Int32%On exit: unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).
Description
A correlation matrix with -factor structure may be characterised as a real square matrix that is symmetric, has a unit diagonal, is positive semidefinite and can be written as , where is the identity matrix and has rows and columns. is often referred to as the factor loading matrix.
g02ae applies a spectral projected gradient method to the modified problem such that , for , where is the th row of the factor loading matrix, , which gives us the solution.
References
Birgin E G, Martínez J M and Raydan M (2001) Algorithm 813: SPG–software for convex-constrained optimization ACM Trans. Math. Software 27 340–349
Borsdorf R, Higham N J and Raydan M (2010) Computing a nearest correlation matrix with factor structure. SIAM J. Matrix Anal. Appl. 31(5) 2603–2622
Error Indicators and Warnings
Errors or warnings detected by the method:
Some error messages may refer to parameters that are dropped from this interface
(LDG, LDX) In these
cases, an error in another parameter has usually caused an incorrect value to be inferred.
-
On entry, and .
Constraint: .On entry, and .
Constraint: .On entry, and .
Constraint: .On entry, .
Constraint: .
-
Spectral gradient method fails to converge in iterations.
-
Dynamic memory allocation failed.
Accuracy
The returned accuracy is controlled by errtol and limited by machine precision.
Parallelism and Performance
None.
Further Comments
Arrays are internally allocated by g02ae. The total size of these arrays is real elements and integer elements.
Here is the block size required for optimal performance by (F08FEF not in this release) (F08FGF not in this release) which are called internally. All allocated memory is freed before return of g02ae.
See (G03CAF not in this release) for constructing the factor loading matrix from a known correlation matrix.
Example
This example finds the nearest correlation matrix with factor structure to:
Example program (C#): g02aee.cs