hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_sparse_direct_real_gen_norm (f11ml)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

nag_sparse_direct_real_gen_norm (f11ml) computes the 1-norm, the -norm or the maximum absolute value of the elements of a real, square, sparse matrix which is held in compressed column (Harwell–Boeing) format.

Syntax

[anorm, ifail] = f11ml(norm_p, n, icolzp, irowix, a)
[anorm, ifail] = nag_sparse_direct_real_gen_norm(norm_p, n, icolzp, irowix, a)

Description

nag_sparse_direct_real_gen_norm (f11ml) computes various quantities relating to norms of a real, sparse n by n matrix A presented in compressed column (Harwell–Boeing) format.

References

None.

Parameters

Compulsory Input Parameters

1:     norm_p – string (length ≥ 1)
Specifies the value to be returned in anorm.
norm_p='1' or 'O'
The 1-norm A1 of the matrix is computed, that is max1jni=1nAij.
norm_p='I'
The -norm A of the matrix is computed, that is max1in j=1n Aij.
norm_p='M'
The value max1i,jnAij  (not a norm).
Constraint: norm_p='1', 'O', 'I' or 'M'.
2:     n int64int32nag_int scalar
n, the order of the matrix A.
Constraint: n0.
3:     icolzp: int64int32nag_int array
The dimension of the array icolzp must be at least n+1
icolzpi contains the index in A of the start of a new column. See Compressed column storage (CCS) format in the F11 Chapter Introduction.
4:     irowix: int64int32nag_int array
The dimension of the array irowix must be at least icolzpn+1-1, the number of nonzeros of the sparse matrix A
The row index array of sparse matrix A.
5:     a: – double array
The dimension of the array a must be at least icolzpn+1-1, the number of nonzeros of the sparse matrix A
The array of nonzero values in the sparse matrix A.

Optional Input Parameters

None.

Output Parameters

1:     anorm – double scalar
The computed quantity relating the matrix.
2:     ifail int64int32nag_int scalar
ifail=0 unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

Errors or warnings detected by the function:
   ifail=1
Constraint: n0.
On entry, norm_p=_.
Constraint: norm_p='1', 'O', 'I' or 'M'.
   ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
   ifail=-399
Your licence key may have expired or may not have been installed correctly.
   ifail=-999
Dynamic memory allocation failed.

Accuracy

Not applicable.

Further Comments

None.

Example

This example computes norms and maximum absolute value of the matrix A, where
A= 2.00 1.00 0 0 0 0 0 1.00 -1.00 0 4.00 0 1.00 0 1.00 0 0 0 1.00 2.00 0 -2.00 0 0 3.00 .  
function f11ml_example


fprintf('f11ml example results\n\n');

% Norms of sparse A
n      = int64(5);
icolzp = [int64(1); 3; 5;  7; 9; 12];
irowix = [int64(1); 3; 1;  5; 2;  3;  2; 4; 3; 4; 5];
a      = [        2;  4; 1; -2; 1;  1; -1; 1; 1; 2; 3];

% Calculate 1-norm
norm_p = '1';
[anorm, ifail] = f11ml( ...
                        norm_p, n, icolzp, irowix, a);
fprintf('One-norm      = %7.3f\n', anorm);

% Calculate Maximum
norm_p = 'M';
[anorm, ifail] = f11ml( ...
                        norm_p, n, icolzp, irowix, a);
fprintf('Max           = %7.3f\n', anorm);

% Calculate I-norm
norm_p = 'I';
[anorm, ifail] = f11ml( ...
                        norm_p, n, icolzp, irowix, a);
fprintf('Infinity-norm = %7.3f\n', anorm);


f11ml example results

One-norm      =   6.000
Max           =   4.000
Infinity-norm =   6.000

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015