V_QRPERMUTE transpose or permute a quaternion array y=[x,p] Inputs: x(4m,...) Real quaternions array p new order of dimensions [default [2 1 ...] Outputs: y(4n,...) output real quaternion array
0001 function y=v_qrpermute(x,p) 0002 %V_QRPERMUTE transpose or permute a quaternion array y=[x,p] 0003 % 0004 % Inputs: x(4m,...) Real quaternions array 0005 % p new order of dimensions [default [2 1 ...] 0006 % 0007 % Outputs: y(4n,...) output real quaternion array 0008 0009 % Copyright (C) Mike Brookes 2012 0010 % Version: $Id: v_qrpermute.m 10865 2018-09-21 17:22:45Z dmb $ 0011 % 0012 % VOICEBOX is a MATLAB toolbox for speech processing. 0013 % Home page: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html 0014 % 0015 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0016 % This program is free software; you can redistribute it and/or modify 0017 % it under the terms of the GNU General Public License as published by 0018 % the Free Software Foundation; either version 2 of the License, or 0019 % (at your option) any later version. 0020 % 0021 % This program is distributed in the hope that it will be useful, 0022 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0023 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0024 % GNU General Public License for more details. 0025 % 0026 % You can obtain a copy of the GNU General Public License from 0027 % http://www.gnu.org/copyleft/gpl.html or by writing to 0028 % Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA. 0029 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0030 s=size(x); 0031 if nargin<2 0032 p=[2 1 3:length(s)]; 0033 end 0034 s(1)=s(1)/4; 0035 t=s(p); 0036 t(1)=4*t(1); 0037 y=reshape(permute(reshape(x,[4 s]),[1 p+1]),t);