Home > manopt > tools > multisqnorm.m

# multisqnorm

## PURPOSE

Returns the squared Frobenius norms of the slices of a 3D matrix.

## SYNOPSIS

function sqnorm = multisqnorm(A)

## DESCRIPTION

``` Returns the squared Frobenius norms of the slices of a 3D matrix.

function sqnorm = multisqnorm(A)

Given a 3-dimensional matrix A of size n-by-m-by-N, returns a column
vector of length N such that sqnorm(i) = norm(A(:, :, i), 'fro')^2.

## CROSS-REFERENCE INFORMATION

This function calls:
This function is called by:
• essential_svd Sample solution of an optimization problem on the essential manifold.

## SOURCE CODE

```0001 function sqnorm = multisqnorm(A)
0002 % Returns the squared Frobenius norms of the slices of a 3D matrix.
0003 %
0004 % function sqnorm = multisqnorm(A)
0005 %
0006 % Given a 3-dimensional matrix A of size n-by-m-by-N, returns a column
0007 % vector of length N such that sqnorm(i) = norm(A(:, :, i), 'fro')^2.
0008 %
0010
0011 % This file is part of Manopt: www.manopt.org.
0012 % Original author: Nicolas Boumal, June 17, 2015.
0013 % Contributors:
0014 % Change log:
0015
0016
0017     assert(ndims(A) <= 3, ...
0018            ['multisqnorm is only well defined for matrix arrays of 3 ' ...
0019             'or less dimensions.']);
0020     [n, m, N] = size(A);
0021
0022     % This is equivalent to squeeze(sum(norms(A, 2, 1).^2)), but faster.
0023     sqnorm = sum(reshape(A, n*m, N).^2, 1)';
0024
0025 end```

Generated on Fri 08-Sep-2017 12:43:19 by m2html © 2005