Home > manopt > tools > multiscale.m

multiscale

PURPOSE ^

Multiplies the 2D slices in a 3D matrix by individual scalars.

SYNOPSIS ^

function A = multiscale(scale, A)

DESCRIPTION ^

 Multiplies the 2D slices in a 3D matrix by individual scalars.

 function A = multiscale(scale, A)

 Given a vector scale of length N and a 3-dimensional matrix A of size
 n-by-m-by-N, returns a matrix A of same size such that
 A(:, :, k) := scale(k) * A(:, :, k);

 See also: multiprod multitransp multitrace

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function A = multiscale(scale, A)
0002 % Multiplies the 2D slices in a 3D matrix by individual scalars.
0003 %
0004 % function A = multiscale(scale, A)
0005 %
0006 % Given a vector scale of length N and a 3-dimensional matrix A of size
0007 % n-by-m-by-N, returns a matrix A of same size such that
0008 % A(:, :, k) := scale(k) * A(:, :, k);
0009 %
0010 % See also: multiprod multitransp multitrace
0011 
0012 % This file is part of Manopt: www.manopt.org.
0013 % Original author: Nicolas Boumal, Dec. 30, 2012.
0014 % Contributors:
0015 % Change log:
0016 
0017 
0018     assert(ndims(A) <= 3, ...
0019            ['multiscale is only well defined for matrix arrays of 3 ' ...
0020             'or less dimensions.']);
0021     [n, m, N] = size(A);
0022     assert(numel(scale) == N, ...
0023            ['scale must be a vector whose length equals the third ' ...
0024             'dimension of A, that is, the number of 2D matrix slices ' ...
0025             'in the 3D matrix A.']);
0026 
0027     scale = scale(:);
0028     A = reshape(bsxfun(@times, reshape(A, n*m, N), scale'), n, m, N);
0029 
0030 end

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