v_qrdotmult

PURPOSE ^

V_QRDOTMULT multiplies together two real quaternions arrays q=[q1,q2]

SYNOPSIS ^

function q=v_qrdotmult(q1,q2)

DESCRIPTION ^

V_QRDOTMULT multiplies together two real quaternions arrays q=[q1,q2]

 Inputs:  q1(4n,...)
          q2(4n,...)   Two real quaternion arrays of equal size

 Outputs: q(4n,...)    The Hadamard product (i.e. .*) of the input arrays

      Copyright (C) Mike Brookes 2000-2012
      Version: $Id: v_qrdotmult.m 10865 2018-09-21 17:22:45Z dmb $

   VOICEBOX is a MATLAB toolbox for speech processing.
   Home page: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You can obtain a copy of the GNU General Public License from
   http://www.gnu.org/copyleft/gpl.html or by writing to
   Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function q=v_qrdotmult(q1,q2)
0002 %V_QRDOTMULT multiplies together two real quaternions arrays q=[q1,q2]
0003 %
0004 % Inputs:  q1(4n,...)
0005 %          q2(4n,...)   Two real quaternion arrays of equal size
0006 %
0007 % Outputs: q(4n,...)    The Hadamard product (i.e. .*) of the input arrays
0008 %
0009 %      Copyright (C) Mike Brookes 2000-2012
0010 %      Version: $Id: v_qrdotmult.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 persistent a b c
0031 if isempty(a)
0032     a=[1 2 3 4 2 1 4 3 3 4 1 2 4 3 2 1];
0033     b=[1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4];
0034     c=[2 3 4 7 12 14];
0035 end
0036 s=size(q1);
0037 qa=reshape(q1,4,[]);
0038 qb=reshape(q2,4,[]);
0039 q=qa(a,:).*qb(b,:);
0040 q(c,:)=-q(c,:);
0041 q=reshape(sum(reshape(q,4,[]),1),s);

Generated by m2html © 2003