Main Content

normest

2-norm estimate

Description

n = normest(S) 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 = normest(S,tol) estimates the 2-norm using the relative error tolerance tol instead of the default tolerance 1.0e-6.

example

[n,count] = 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 = sparse(1:5,1:5,1:5)
S = 5x5 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.

n = normest(S)
n = 
5.0000

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.

tic
norm(S)
ans = 
500.4856
toc
Elapsed time is 0.188578 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.

tic
normest(S,1.0e-4)
ans = 
500.4856
toc
Elapsed time is 0.015455 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.

[n,count] = normest(S)
n = 
6.0000
count = 
4

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 of tol determines when the norm estimate is considered acceptable: the iteration is performed until two successive estimates agree to within the specified tol.

Data Types: single | double

Output Arguments

collapse all

Matrix norm, returned as a scalar. normest returns NaN 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

Version History

Introduced before R2006a

See Also

| | | |