Home > manopt > tools > multitrace.m

multitrace

PURPOSE ^

Computes the traces of the 2D slices in a 3D matrix.

SYNOPSIS ^

function tr = multitrace(A)

DESCRIPTION ^

 Computes the traces of the 2D slices in a 3D matrix.
 
 function tr = multitrace(A)

 For a 3-dimensional matrix A of size n-by-n-by-N, returns a column vector
 tr of length N such that tr(k) = trace(A(:, :, k));

 See also: multiprod multitransp multiscale

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function tr = multitrace(A)
0002 % Computes the traces of the 2D slices in a 3D matrix.
0003 %
0004 % function tr = multitrace(A)
0005 %
0006 % For a 3-dimensional matrix A of size n-by-n-by-N, returns a column vector
0007 % tr of length N such that tr(k) = trace(A(:, :, k));
0008 %
0009 % See also: multiprod multitransp multiscale
0010 
0011 % This file is part of Manopt: www.manopt.org.
0012 % Original author: Nicolas Boumal, Dec. 30, 2012.
0013 % Contributors:
0014 % Change log:
0015 
0016     
0017     assert(ndims(A) <= 3, ...
0018            ['multitrace is only well defined for matrix arrays of 3 ' ...
0019             'or less dimensions.']);
0020 
0021     tr = diagsum(A, 1, 2);
0022 
0023 end

Generated on Sat 12-Nov-2016 14:11:22 by m2html © 2005