normest - 2-norm estimate - MATLAB (original) (raw)

Syntax

Description

[n](#mw%5F5e85a2fc-64eb-44cb-ad60-82d5270fce2f) = normest([S](#mw%5F4a45003d-0dbf-4e22-8f54-2846477fc138)) returns an estimate of the 2-norm of the matrix S.

This function is intended primarily for sparse matrices, although it works correctly for large, full matrices as well.

example

[n](#mw%5F5e85a2fc-64eb-44cb-ad60-82d5270fce2f) = normest([S](#mw%5F4a45003d-0dbf-4e22-8f54-2846477fc138),[tol](#mw%5F5403f9c3-1fee-46cb-8f93-6f67e3de0bbe)) estimates the 2-norm using the relative error tolerance tol instead of the default tolerance 1.0e-6.

example

[[n](#mw%5F5e85a2fc-64eb-44cb-ad60-82d5270fce2f),[count](#mw%5F927bb5d4-0285-4aef-bdcf-4b046ccf2536)] = normest(___) returns an estimate of the 2-norm and also gives the number of power iterations used in the computation. Use this syntax with any of the input arguments in previous syntaxes.

example

Examples

collapse all

Create a 5-by-5 sparse diagonal matrix.

S = 5×5 sparse double matrix (5 nonzeros) (1,1) 1 (2,2) 2 (3,3) 3 (4,4) 4 (5,5) 5

Estimate the 2-norm of the matrix S.

Create a 1000-by-1000 matrix of uniformly distributed random numbers.

rng default S = rand(1000);

Evaluate the 2-norm of the matrix S by using norm. Measure the elapsed time with a pair of tic and toc calls.

Elapsed time is 0.230346 seconds.

To speed up the 2-norm evaluation, estimate the 2-norm of S by using normest with a specified tolerance of 1.0e-4.

Elapsed time is 0.026118 seconds.

Create a 7-by-7 matrix.

S = gallery('clement',7,7)

S = 7×7

     0    2.4495         0         0         0         0         0
2.4495         0    3.1623         0         0         0         0
     0    3.1623         0    3.4641         0         0         0
     0         0    3.4641         0    3.4641         0         0
     0         0         0    3.4641         0    3.1623         0
     0         0         0         0    3.1623         0    2.4495
     0         0         0         0         0    2.4495         0

Estimate the 2-norm of the matrix and return the number of power iterations used in the computation.

Input Arguments

collapse all

Input matrix, specified as a sparse or full matrix.

Data Types: single | double
Complex Number Support: Yes

Relative error tolerance, specified as a nonnegative real number. The value oftol determines when the norm estimate is considered acceptable: the iteration is performed until two successive estimates agree to within the specifiedtol.

Data Types: single | double

Output Arguments

collapse all

Matrix norm, returned as a scalar. normest returnsNaN if the input contains NaN values.

Number of power iterations used in estimating the 2-norm, returned as a nonnegative integer.

Algorithms

The power iteration involves repeated multiplication by the matrix S and its transpose, S'. The iteration is performed until two successive norm estimates agree to within the specified relative error tolerance.

Extended Capabilities

expand all

Usage notes and limitations:

The normest function fully supports GPU arrays. To run the function on a GPU, specify the input data as a gpuArray (Parallel Computing Toolbox). For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).

Version History

Introduced before R2006a