XLPack 7.0
XLPack Numerical Library (Excel VBA) Reference Manual
Loading...
Searching...
No Matches

◆ Dlansy()

Function Dlansy ( Norm As  String,
Byval Uplo As  String,
N As  Long,
A() As  Double,
Optional Info As  Long 
)

One norm, Frobenius norm, infinity norm, or largest absolute value of any element of a real symmetric matrix

Purpose
This routine returns the value of the one norm, the Frobenius norm, the infinity norm, or the largest absolute value of any element of a real symmetric matrix A.
Returns
Double
max(abs(Aij)) when Norm = "M",
norm1(A) when Norm = "1" or "O",
normI(A) when Norm = "I", or
normF(A) when Norm = "F" or "E"

where norm1 denotes the one norm of a matrix (maximum column sum), normI denotes the infinity norm of a matrix (maximum row sum) and normF denotes the Frobenius norm of a matrix (square root of sum of squares). Note that max(abs(Aij)) is not a consistent matrix norm.
Parameters
[in]NormSpecifies the value to be returned by Dlansy as described above. Note that normI(A) = norm1(A) since A is symmetric.
[in]UploSpecifies whether the upper or lower triangular part of the symmetric matrix A is to be referenced.
= "U": Only the upper triangular part is to be referenced.
= "L": Only the lower triangular part is to be referenced.
[in]NOrder of the matrix A. (N >= 0) (If N = 0, returns 0)
[in]A()Array A(LA1 - 1, LA2 - 1) (LA1 >= N, LA2 >= N)
N x N symmetric matrix A. Only the upper or lower triangular part is to be referenced in accordance with Uplo.
[out]Info(Optional)
= 0: Successful exit.
= -1: The argument Norm had an illegal value. (Norm <> "M", "1", "O", "I", "F" nor "E")
= -2: The argument Uplo had an illegal value. (Uplo <> "U" nor "L")
= -3: The argument N had an illegal value. (N < 0)
= -4: The argument A() is invalid.
Reference
LAPACK
Example Program
Compute the norm of the symmetric matrix A, where
( 2.2 -0.11 -0.32 )
A = ( -0.11 2.93 0.81 )
( -0.32 0.81 2.37 )
Sub Ex_Dlansy()
Const N As Long = 3
Dim A(N - 1, N - 1) As Double
Dim ANormM As Double, ANorm1 As Double, ANormI As Double, ANormF As Double
A(0, 0) = 2.2: A(0, 1) = -0.11: A(0, 2) = -0.32
A(1, 1) = 2.93: A(1, 2) = 0.81
A(2, 2) = 2.37
ANormM = Dlansy("M", "U", N, A())
ANorm1 = Dlansy("1", "U", N, A())
ANormI = Dlansy("I", "U", N, A())
ANormF = Dlansy("F", "U", N, A())
Debug.Print "max(abs(Aij)), norm1(A), normI(A), normF(A) ="
Debug.Print ANormM, ANorm1, ANormI, ANormF
End Sub
Function Dlansy(Norm As String, Byval Uplo As String, N As Long, A() As Double, Optional Info As Long) As Double
One norm, Frobenius norm, infinity norm, or largest absolute value of any element of a real symmetric...
Example Results
max(abs(Aij)), norm1(A), normI(A), normF(A) =
2.93 3.85 3.85 4.53684912687209