Transposing arrays of matrices. B = MULTITRANSP(A) is equivalent to B = MULTITRANSP(A, DIM), where DIM = 1. B = MULTITRANSP(A, DIM) is equivalent to B = PERMUTE(A, [1:DIM-1, DIM+1, DIM, DIM+2:NDIMS(A)]), where A is an array containing N P-by-Q matrices along its dimensions DIM and DIM+1, and B is an array containing the Q-by-P transpose (.') of those N matrices along the same dimensions. N = NUMEL(A) / (P*Q), i.e. N is equal to the number of elements in A divided by the number of elements in each matrix. MULTITRANSP, PERMUTE and IPERMUTE are a generalization of TRANSPOSE (.') for N-D arrays. Example: A 5-by-9-by-3-by-2 array may be considered to be a block array containing ten 9-by-3 matrices along dimensions 2 and 3. In this case, its size is so indicated: 5-by-(9-by-3)-by-2 or 5x(9x3)x2. If A is ................ a 5x(9x3)x2 array of 9x3 matrices, C = MULTITRANSP(A, 2) is a 5x(3x9)x2 array of 3x9 matrices. See also PERMUTE, IPERMUTE, MULTIPROD, MULTITRACE, MULTISCALE.

- generalized_procrustes Rotationally align clouds of points (generalized Procrustes problem)
- robust_pca Computes a robust version of PCA (principal component analysis) on data.
- essential_costE2cost Cost evaluation at X given function handle in the Essential matrix E.
- essential_egradE2egrad Converts the gradient in essential matrix E to the gradient in X.
- essential_ehessE2ehess Converts the Hessian in essential matrix E to the Hessian in X.
- essentialfactory Manifold structure to optimize over the space of essential matrices.
- skewsymmetricfactory Returns a manifold struct to optimize over k skew-symmetric matrices of size n
- symmetricfactory Returns a manifold struct to optimize over k symmetric matrices of size n
- grassmannfactory Returns a manifold struct to optimize over the space of vector subspaces.
- randskew Generates random skew symmetric matrices with normal entries.
- rotationsfactory Returns a manifold structure to optimize over rotation matrices.
- stiefelfactory Returns a manifold structure to optimize over orthonormal matrices.
- stiefelstackedfactory Stiefel(k, d)^m, represented as matrices of size m*d-by-k.
- multihconj MULTIHCONJ Hermitian conjugating arrays of matrices.
- multiskew Returns the skew-symmetric parts of the matrices in the 3D matrix X.
- multisym Returns the symmetric parts of the matrices in the 3D matrix X

0001 function b = multitransp(a, dim) 0002 % Transposing arrays of matrices. 0003 % 0004 % B = MULTITRANSP(A) is equivalent to B = MULTITRANSP(A, DIM), where 0005 % DIM = 1. 0006 % 0007 % B = MULTITRANSP(A, DIM) is equivalent to 0008 % B = PERMUTE(A, [1:DIM-1, DIM+1, DIM, DIM+2:NDIMS(A)]), where A is an 0009 % array containing N P-by-Q matrices along its dimensions DIM and DIM+1, 0010 % and B is an array containing the Q-by-P transpose (.') of those N 0011 % matrices along the same dimensions. N = NUMEL(A) / (P*Q), i.e. N is 0012 % equal to the number of elements in A divided by the number of elements 0013 % in each matrix. 0014 % 0015 % MULTITRANSP, PERMUTE and IPERMUTE are a generalization of TRANSPOSE 0016 % (.') for N-D arrays. 0017 % 0018 % Example: 0019 % A 5-by-9-by-3-by-2 array may be considered to be a block array 0020 % containing ten 9-by-3 matrices along dimensions 2 and 3. In this 0021 % case, its size is so indicated: 5-by-(9-by-3)-by-2 or 5x(9x3)x2. 0022 % If A is ................ a 5x(9x3)x2 array of 9x3 matrices, 0023 % C = MULTITRANSP(A, 2) is a 5x(3x9)x2 array of 3x9 matrices. 0024 % 0025 % See also PERMUTE, IPERMUTE, MULTIPROD, MULTITRACE, MULTISCALE. 0026 0027 % $ Version: 1.0 $ 0028 % CODE by: Paolo de Leva (IUSM, Rome, IT) 2005 Sep 9 0029 % COMMENTS by: Code author 2006 Nov 21 0030 % OUTPUT tested by: Code author 2005 Sep 13 0031 % ------------------------------------------------------------------------- 0032 0033 % Setting DIM if not supplied. 0034 if nargin == 1, dim = 1; end 0035 0036 % Transposing 0037 order = [1:dim-1, dim+1, dim, dim+2:ndims(a)]; 0038 b = permute(a, order); 0039 0040 end

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