pagenorm

Norm of each page of a 3-D array.

Category: Mathematics > Linear Algebra

Syntax

n = pagenorm(A)

Returns the 2-norm of every page A(:,:,k).

n = pagenorm(A, p)

Uses the norm type p: 1, 2, Inf or 'fro'.

Description

pagenorm applies norm to each 2-D page without a loop, returning the results along the third dimension. Use squeeze to turn them into a vector.

Input arguments

A
Array whose pages are matrices.
p
Norm type, default 2.

Output arguments

n
Array of size 1-by-1-by-p, one norm per page.

Example

Norms of two row-vector pages

A = cat(3, [3 4], [6 8]);
n = pagenorm(A);
squeeze(n)'
size(n)
Output
ans = 1×2

     5    10
ans = 1×3

     1     1     2

See also

norm pageeig pageinv squeeze vecnorm