V_QRMULT multiplies together two real quaternions matrices q=[q1,q2] Inputs: q1(4m,n) Two real quaternions arrays. Either array can q2(4n,r) also be a scalar quaternion. Outputs: q(4m,r) Matrix product of q1 and q2
0001 function q=v_qrmult(q1,q2) 0002 %V_QRMULT multiplies together two real quaternions matrices q=[q1,q2] 0003 % 0004 % Inputs: q1(4m,n) Two real quaternions arrays. Either array can 0005 % q2(4n,r) also be a scalar quaternion. 0006 % 0007 % Outputs: q(4m,r) Matrix product of q1 and q2 0008 0009 % Copyright (C) Mike Brookes 2000-2012 0010 % Version: $Id: v_qrmult.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 s1=size(q1); 0031 s2=size(q2); 0032 if isequal(s1,[4 1]) 0033 q=v_qrdotmult(repmat(q1,s2(1)/4,s2(2)),q2); 0034 elseif isequal(s2,[4 1]) 0035 q=v_qrdotmult(q1,repmat(q2,s1(1)/4,s1(2))); 0036 else 0037 q=v_rotqr2mr(q1)*q2; 0038 end