CNLMath : Utilities : matrix_norm_band
matrix_norm_band
Computes various norms of a matrix stored in band storage mode.
Synopsis
#include <imsl.h>
float imsl_f_matrix_norm_band (int n, float a[], int nlc, int nuc, ..., 0)
The type double function is imsl_d_matrix_norm_band.
Required Arguments
int n (Input)
The order of matrix A.
float a[] (Input)
Matrix for which the norm will be computed.
int nlc (Input)
Number of lower codiagonals of A.
int nuc (Input)
Number of upper codiagonals of A.
Return Value
The requested norm of the input matrix, by default, the Frobenius norm. If the norm cannot be comĀ­puted, NaN is returned.
Synopsis with Optional Arguments
#include <imsl.h>
float imsl_f_matrix_norm_band (int n, float a[], int nlc, int nuc,
IMSL_ONE_NORM,
IMSL_INF_NORM,
IMSL_SYMMETRIC,
0)
Optional Arguments
IMSL_ONE_NORM,
Compute the 1-norm of matrix A,
IMSL_INF_NORM,
Compute the infinity norm of matrix A,
IMSL_SYMMETRIC,
Matrix A is stored in band symmetric storage mode.
Description
By default, imsl_f_matrix_norm_band computes the Frobenius norm
If the option IMSL_ONE_NORM is selected, the 1-norm
is returned. If the option IMSL_INF_NORM is selected, the infinity norm
is returned.
Examples
Example 1
Compute the Frobenius norm, infinity norm, and one norm of matrix A. Matrix A is stored in band storage mode.
 
#include <imsl.h>
 
int main()
{
float a[] = {0.0, 2.0, 3.0, -1.0,
1.0, 1.0, 1.0, 1.0,
0.0, 3.0, 4.0, 0.0};
int nlc = 1, nuc = 1;
int n = 4;
float frobenius_norm, inf_norm, one_norm;
 
frobenius_norm = imsl_f_matrix_norm_band(n, a, nlc, nuc, 0);
 
inf_norm = imsl_f_matrix_norm_band(n, a, nlc, nuc,
IMSL_INF_NORM, 0);
 
one_norm = imsl_f_matrix_norm_band(n, a, nlc, nuc,
IMSL_ONE_NORM, 0);
 
printf("Frobenius norm = %f\n", frobenius_norm);
printf("Infinity norm = %f\n", inf_norm);
printf("One norm = %f\n", one_norm);
}
Output
 
Frobenius norm = 6.557438
Infinity norm = 5.000000
One norm = 8.000000
Example 2
Compute the Frobenius norm, infinity norm, and one norm of matrix A. Matrix A is stored in symmetric band storage mode.
 
#include <imsl.h>
 
int main()
{
float a[] = {0.0, 0.0, 7.0, 3.0, 1.0, 4.0,
0.0, 5.0, 1.0, 2.0, 1.0, 2.0,
1.0, 2.0, 4.0, 6.0, 3.0, 1.0};
int nlc = 2, nuc = 2;
int n = 6;
float frobenius_norm, inf_norm, one_norm;
 
frobenius_norm = imsl_f_matrix_norm_band(n, a, nlc, nuc,
IMSL_SYMMETRIC, 0);
 
inf_norm = imsl_f_matrix_norm_band(n, a, nlc, nuc,
IMSL_INF_NORM,
IMSL_SYMMETRIC, 0);
 
one_norm = imsl_f_matrix_norm_band(n, a, nlc, nuc,
IMSL_ONE_NORM,
IMSL_SYMMETRIC, 0);
 
printf("Frobenius norm = %f\n", frobenius_norm);
printf("Infinity norm = %f\n", inf_norm);
printf("One norm = %f\n", one_norm);
}
Output
 
Frobenius norm = 16.941074
Infinity norm = 16.000000
One norm = 16.000000