1## Copyright (C) 2010-2015 Lukas F. Reichlin 2## 3## This program is free software: you can redistribute it and/or modify 4## it under the terms of the GNU General Public License as published by 5## the Free Software Foundation, either version 3 of the License, or 6## (at your option) any later version. 7## 8## This program is distributed in the hope that it will be useful, 9## but WITHOUT ANY WARRANTY; without even the implied warranty of 10## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11## GNU General Public License for more details. 12## 13## You should have received a copy of the GNU General Public License 14## along with this program. If not, see <http://www.gnu.org/licenses/>. 15 16## -*- texinfo -*- 17## @deftypefn {Function File} {@var{q} =} reshape (@var{q}, @var{m}, @var{n}, @dots{}) 18## @deftypefnx {Function File} {@var{q} =} reshape (@var{q}, [@var{m} @var{n} @dots{}]) 19## @deftypefnx {Function File} {@var{q} =} reshape (@var{q}, @dots{}, [], @dots{}) 20## @deftypefnx {Function File} {@var{q} =} reshape (@var{q}, @var{size}) 21## Return a quaternion array with the specified dimensions (@var{m}, @var{n}, @dots{}) 22## whose elements are taken from the quaternion array @var{q}. The elements of the 23## quaternion are accessed in column-major order (like Fortran arrays are stored). 24## @end deftypefn 25 26## Author: Lukas Reichlin <lukas.reichlin@gmail.com> 27## Created: December 2013 28## Version: 0.1 29 30function q = reshape (q, varargin) 31 32 if (! isa (q, "quaternion")) 33 print_usage (); 34 endif 35 36 q.w = reshape (q.w, varargin{:}); 37 q.x = reshape (q.x, varargin{:}); 38 q.y = reshape (q.y, varargin{:}); 39 q.z = reshape (q.z, varargin{:}); 40 41endfunction 42