diff -Nru octave-quaternion-2.2.2/debian/changelog octave-quaternion-2.4.0/debian/changelog --- octave-quaternion-2.2.2/debian/changelog 2015-08-15 12:32:56.000000000 +0000 +++ octave-quaternion-2.4.0/debian/changelog 2015-09-14 13:10:05.000000000 +0000 @@ -1,14 +1,10 @@ -octave-quaternion (2.2.2-1build2) wily; urgency=medium +octave-quaternion (2.4.0-1) unstable; urgency=medium - * No-change rebuild against liboctave3 + * Imported Upstream version 2.4.0 + * Bump Standards-Version to 3.9.6 (no changes needed) + * d/copyright: Reflect upstream changes - -- Steve Langasek Sat, 15 Aug 2015 12:32:56 +0000 - -octave-quaternion (2.2.2-1build1) wily; urgency=medium - - * No-change rebuild against liboctave3 - - -- Matthias Klose Sat, 15 Aug 2015 12:01:01 +0000 + -- Rafael Laboissiere Sat, 12 Sep 2015 12:16:28 -0300 octave-quaternion (2.2.2-1) unstable; urgency=medium diff -Nru octave-quaternion-2.2.2/debian/control octave-quaternion-2.4.0/debian/control --- octave-quaternion-2.2.2/debian/control 2015-08-15 12:32:55.000000000 +0000 +++ octave-quaternion-2.4.0/debian/control 2015-07-18 21:44:50.000000000 +0000 @@ -1,11 +1,10 @@ Source: octave-quaternion Section: math Priority: optional -Maintainer: Ubuntu Developers -XSBC-Original-Maintainer: Debian Octave Group +Maintainer: Debian Octave Group Uploaders: Rafael Laboissiere Build-Depends: debhelper (>= 9), cdbs, octave-pkg-dev (>= 1.0.1) -Standards-Version: 3.9.5 +Standards-Version: 3.9.6 Homepage: http://octave.sourceforge.net/quaternion Vcs-Git: git://anonscm.debian.org/pkg-octave/octave-quaternion.git Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-octave/octave-quaternion.git diff -Nru octave-quaternion-2.2.2/debian/copyright octave-quaternion-2.4.0/debian/copyright --- octave-quaternion-2.2.2/debian/copyright 2014-05-13 17:52:58.000000000 +0000 +++ octave-quaternion-2.4.0/debian/copyright 2015-07-18 21:44:50.000000000 +0000 @@ -4,7 +4,8 @@ Source: http://octave.sourceforge.net/quaternion/ Files: * -Copyright: 2010-2014 Lukas F. Reichlin +Copyright: 2010-2015 Lukas F. Reichlin + 2013 Willem Atsma 1998-2000, 2002, 2005-2007, Auburn University 2011 Juan Pablo Carbajal License: GPL-3+ diff -Nru octave-quaternion-2.2.2/DESCRIPTION octave-quaternion-2.4.0/DESCRIPTION --- octave-quaternion-2.2.2/DESCRIPTION 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/DESCRIPTION 2015-03-28 07:23:27.000000000 +0000 @@ -1,11 +1,11 @@ Name: quaternion -Version: 2.2.2 -Date: 2014-07-20 +Version: 2.4.0 +Date: 2015-03-21 Author: Lukas Reichlin Maintainer: Lukas Reichlin Title: Quaternion Description: Quaternion package for GNU Octave, includes a quaternion class with overloaded operators -Depends: octave (>= 3.6.0) -Autoload: yes +Depends: octave (>= 3.8.0) +Autoload: no License: GPLv3+ Url: http://octave.sf.net diff -Nru octave-quaternion-2.2.2/doc/functions.texi octave-quaternion-2.4.0/doc/functions.texi --- octave-quaternion-2.2.2/doc/functions.texi 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/doc/functions.texi 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -@chapter Quaternions +@chapter Quaternion Constructors @section quaternion @findex quaternion @@ -125,41 +125,65 @@ @end example @end deftypefn +@chapter Conversions @section q2rot @findex q2rot @deftypefn {Function File} {[@var{axis}, @var{angle}] =} q2rot (@var{q}) + @deftypefnx {Function File} {[@var{axis}, @var{angle}, @var{qn}] =} q2rot (@var{q}) Extract vector/angle form of a unit quaternion @var{q}. @strong{Inputs} @table @var @item q Unit quaternion describing the rotation. + Quaternion @var{q} can be a scalar or an array. + In the latter case, @var{q} is reshaped to a row vector + and the return values @var{axis} and @var{angle} are + concatenated horizontally, accordingly. @end table @strong{Outputs} @table @var @item axis - Eigenaxis as a 3-d unit vector @code{[x, y, z]}. + Eigenaxis as a 3-d unit vector @code{[x; y; z]}. + If input argument @var{q} is a quaternion array, + @var{axis} becomes a matrix where + @var{axis(:,i)} corresponds to @var{q(i)}. @item angle Rotation angle in radians. The positive direction is determined by the right-hand rule applied to @var{axis}. The angle lies in the interval [0, 2*pi]. + If input argument @var{q} is a quaternion array, + @var{angle} becomes a row vector where + @var{angle(i)} corresponds to @var{q(i)}. + @item qn + Optional output of diagnostic nature. + @code{qn = reshape (q, 1, [])} or, if needed, + @code{qn = reshape (unit (q), 1, [])}. @end table @strong{Example} @example @group - octave:1> axis = [0, 0, 1] + octave:1> axis = [0; 0; 1] axis = - 0 0 1 + + 0 + 0 + 1 + octave:2> angle = pi/4 angle = 0.78540 octave:3> q = rot2q (axis, angle) q = 0.9239 + 0i + 0j + 0.3827k octave:4> [vv, th] = q2rot (q) vv = - 0 0 1 + + 0 + 0 + 1 + th = 0.78540 octave:5> theta = th*180/pi theta = 45.000 @@ -182,16 +206,20 @@ @strong{Inputs} @table @var @item axis - Vector @code{[x, y, z]} describing the axis of rotation. + Vector @code{[x, y, z]} or @code{[x; y; z]} describing the axis of rotation. @item angle Rotation angle in radians. The positive direction is determined by the right-hand rule applied to @var{axis}. + If @var{angle} is a real-valued array, a quaternion array + @var{q} of the same size is returned. @end table @strong{Outputs} @table @var @item q Unit quaternion describing the rotation. + If @var{angle} is an array, @var{q(i,j)} corresponds to + the rotation angle @var{angle(i,j)}. @end table @strong{Example} @@ -210,6 +238,12 @@ @end example @end deftypefn +@section rotm2q +@findex rotm2q + + @deftypefn {Function File} {@var{q} =} rotm2q (@var{R}) + Convert 3x3 rotation matrix @var{R} to unit quaternion @var{q}. + @end deftypefn @chapter Quaternion Methods @section @@quaternion/abs @findex abs @@ -433,6 +467,22 @@ @deftypefn {Function File} {@var{qlog} =} log (@var{q}) Logarithmus naturalis of a quaternion. @end deftypefn +@section @@quaternion/mean +@findex mean + + @deftypefn {Function File} {@var{q} =} mean (@var{q}) + @deftypefnx {Function File} {@var{q} =} mean (@var{q}, @var{dim}) + @deftypefnx {Function File} {@var{q} =} mean (@var{q}, @var{opt}) + @deftypefnx {Function File} {@var{q} =} mean (@var{q}, @var{dim}, @var{opt}) + Compute the mean of the elements of the quaternion array @var{q}. + + @example + mean (q) = mean (q.w) + mean (q.x)*i + mean (q.y)*j + mean (q.z)*k + @end example + + See @code{help mean} for more information and a description of the + parameters @var{dim} and @var{opt}. + @end deftypefn @section @@quaternion/ndims @findex ndims @@ -447,6 +497,16 @@ @deftypefn {Function File} {@var{n} =} norm (@var{q}) Norm of a quaternion. @end deftypefn +@section @@quaternion/numel +@findex numel + + @deftypefn {Function File} {@var{n} =} numel (@var{q}) + @deftypefnx {Function File} {@var{n} =} numel (@var{q}, @var{idx1}, @var{idx2}, @dots{}) + For internal use only, use @code{prod(size(q))} or @code{numel (q.w)} instead. + For technical reasons, this method must return the number of elements which are + returned from cs-list indexing, no matter whether it is called with one or more + arguments. + @end deftypefn @section @@quaternion/repmat @findex repmat Binary files /tmp/tmpbI8YlJ/PoISa2k4qt/octave-quaternion-2.2.2/doc/quaternion.pdf and /tmp/tmpbI8YlJ/0Inw3EGxZt/octave-quaternion-2.4.0/doc/quaternion.pdf differ diff -Nru octave-quaternion-2.2.2/doc/quaternion.tex octave-quaternion-2.4.0/doc/quaternion.tex --- octave-quaternion-2.2.2/doc/quaternion.tex 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/doc/quaternion.tex 2015-03-28 07:22:40.000000000 +0000 @@ -5,7 +5,7 @@ @c use chapter name instead of title in the header of even pages @c @settitle Octave Quaternion Package @afourpaper -@set VERSION 2.2.2 +@set VERSION 2.4.0 @finalout @c @afourwide @c %**end of header @@ -39,7 +39,7 @@ @author Juan Pablo Carbajal @page @vskip 0pt plus 1filll -Copyright @copyright{} 2010-2014, Lukas F. Reichlin @email{lukas.reichlin@@gmail.com} +Copyright @copyright{} 2010-2015, Lukas F. Reichlin @email{lukas.reichlin@@gmail.com} This manual is generated automatically from the texinfo help strings of the package's functions. diff -Nru octave-quaternion-2.2.2/INDEX octave-quaternion-2.4.0/INDEX --- octave-quaternion-2.2.2/INDEX 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/INDEX 2015-03-28 07:22:40.000000000 +0000 @@ -1,11 +1,13 @@ quaternion >> Quaternion -Quaternions +Quaternion Constructors quaternion qi qj qk +Conversions q2rot rot2q + rotm2q Quaternion Methods @quaternion/abs @quaternion/arg @@ -32,8 +34,10 @@ @quaternion/isreal @quaternion/length @quaternion/log + @quaternion/mean @quaternion/ndims @quaternion/norm + @quaternion/numel @quaternion/repmat @quaternion/reshape @quaternion/round diff -Nru octave-quaternion-2.2.2/inst/q2rot.m octave-quaternion-2.4.0/inst/q2rot.m --- octave-quaternion-2.2.2/inst/q2rot.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/q2rot.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,5 +1,5 @@ ## Copyright (C) 1998, 1999, 2000, 2002, 2005, 2006, 2007 Auburn University -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 @@ -16,37 +16,60 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {[@var{axis}, @var{angle}] =} q2rot (@var{q}) +## @deftypefnx {Function File} {[@var{axis}, @var{angle}, @var{qn}] =} q2rot (@var{q}) ## Extract vector/angle form of a unit quaternion @var{q}. ## ## @strong{Inputs} ## @table @var ## @item q ## Unit quaternion describing the rotation. +## Quaternion @var{q} can be a scalar or an array. +## In the latter case, @var{q} is reshaped to a row vector +## and the return values @var{axis} and @var{angle} are +## concatenated horizontally, accordingly. ## @end table ## ## @strong{Outputs} ## @table @var ## @item axis -## Eigenaxis as a 3-d unit vector @code{[x, y, z]}. +## Eigenaxis as a 3-d unit vector @code{[x; y; z]}. +## If input argument @var{q} is a quaternion array, +## @var{axis} becomes a matrix where +## @var{axis(:,i)} corresponds to @var{q(i)}. ## @item angle ## Rotation angle in radians. The positive direction is ## determined by the right-hand rule applied to @var{axis}. ## The angle lies in the interval [0, 2*pi]. +## If input argument @var{q} is a quaternion array, +## @var{angle} becomes a row vector where +## @var{angle(i)} corresponds to @var{q(i)}. +## @item qn +## Optional output of diagnostic nature. +## @code{qn = reshape (q, 1, [])} or, if needed, +## @code{qn = reshape (unit (q), 1, [])}. ## @end table ## ## @strong{Example} ## @example ## @group -## octave:1> axis = [0, 0, 1] +## octave:1> axis = [0; 0; 1] ## axis = -## 0 0 1 +## +## 0 +## 0 +## 1 +## ## octave:2> angle = pi/4 ## angle = 0.78540 ## octave:3> q = rot2q (axis, angle) ## q = 0.9239 + 0i + 0j + 0.3827k ## octave:4> [vv, th] = q2rot (q) ## vv = -## 0 0 1 +## +## 0 +## 0 +## 1 +## ## th = 0.78540 ## octave:5> theta = th*180/pi ## theta = 45.000 @@ -59,41 +82,56 @@ ## Adapted from: quaternion by A. S. Hodel ## Author: Lukas Reichlin ## Created: May 2010 -## Version: 0.3 +## Version: 0.4 -function [vv, theta] = q2rot (q) +function [vv, theta, q] = q2rot (q) - if (nargin != 1 || nargout != 2) + if (nargin != 1 || nargout > 3) print_usage (); endif - if (! isa (q, "quaternion") || ! isscalar (q.w)) - error ("q2rot: require scalar quaternion as input"); + if (! isa (q, "quaternion")) + error ("q2rot: require quaternion as input"); endif - if (abs (norm (q) - 1) > 1e-12) - warning ("q2rot: ||q||=%e, setting=1 for vv, theta", norm (q)); + if (any (abs (abs (q) - 1) > 1e-12)) + warning ("q2rot:normalizing", "q2rot: abs(q) != 1, normalizing"); q = unit (q); # do we still need this with the atan2 formula? endif - s = q.w; - vv = [q.x, q.y, q.z]; - norm_vv = norm (vv); + q = reshape (q, 1, []); # row vector ## According to Wikipedia, - ## http://en.wikipedia.org/wiki/Axis%E2%80%93angle_representation#Unit_Quaternions - ## the formula using atan2 should be numerically more stable than - ## theta = acos (s) * 2; + ## + ## the formula using atan2 + ## theta = 2 * atan2 (||x||, s) + ## should be numerically more stable than + ## theta = 2 * acos (s) ## Possibly it helps if the quaternion has not exactly unit length. - theta = 2 * atan2 (norm_vv, s); - - ## if (abs (theta) > pi) - ## theta = theta - sign (theta) * 2 * pi; - ## endif + + vv = [q.x; q.y; q.z]; + norm_vv = norm (vv, 2, "cols"); + theta = 2 * atan2 (norm_vv, q.w); ## NOTE: sin (theta/2) = norm (vv) - if (norm_vv != 0) - vv ./= norm_vv; + idx = (norm_vv != 0); + if (any (idx)) + vv(:, idx) ./= ones (3, 1) * norm_vv(idx); # normalize vectors, prevent division by zero + endif + idx = ! idx; + if (any (idx)) + vv(:, idx) = [1; 0; 0] * ones (1, nnz (idx)); # set real-valued quaternions to default value endif endfunction + + +%!test +%! q = quaternion (2, 0, 0, 0); +%! w = warning ("query", "q2rot:normalizing"); +%! warning ("off", w.identifier); +%! [vv, th, qn] = q2rot (q); +%! warning (w.identifier, w.state); +%! assert (vv, [1; 0; 0], 1e-4); +%! assert (th, 0, 1e-4); +%! assert (qn == quaternion (1), true); diff -Nru octave-quaternion-2.2.2/inst/qi.m octave-quaternion-2.4.0/inst/qi.m --- octave-quaternion-2.2.2/inst/qi.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/qi.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/qj.m octave-quaternion-2.4.0/inst/qj.m --- octave-quaternion-2.2.2/inst/qj.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/qj.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/qk.m octave-quaternion-2.4.0/inst/qk.m --- octave-quaternion-2.2.2/inst/qk.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/qk.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/abs.m octave-quaternion-2.4.0/inst/@quaternion/abs.m --- octave-quaternion-2.2.2/inst/@quaternion/abs.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/abs.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/arg.m octave-quaternion-2.4.0/inst/@quaternion/arg.m --- octave-quaternion-2.2.2/inst/@quaternion/arg.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/arg.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/blkdiag.m octave-quaternion-2.4.0/inst/@quaternion/blkdiag.m --- octave-quaternion-2.2.2/inst/@quaternion/blkdiag.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/blkdiag.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/cast.m octave-quaternion-2.4.0/inst/@quaternion/cast.m --- octave-quaternion-2.2.2/inst/@quaternion/cast.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/cast.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/cat.m octave-quaternion-2.4.0/inst/@quaternion/cat.m --- octave-quaternion-2.2.2/inst/@quaternion/cat.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/cat.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/ceil.m octave-quaternion-2.4.0/inst/@quaternion/ceil.m --- octave-quaternion-2.2.2/inst/@quaternion/ceil.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/ceil.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/columns.m octave-quaternion-2.4.0/inst/@quaternion/columns.m --- octave-quaternion-2.2.2/inst/@quaternion/columns.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/columns.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/conj.m octave-quaternion-2.4.0/inst/@quaternion/conj.m --- octave-quaternion-2.2.2/inst/@quaternion/conj.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/conj.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/ctranspose.m octave-quaternion-2.4.0/inst/@quaternion/ctranspose.m --- octave-quaternion-2.2.2/inst/@quaternion/ctranspose.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/ctranspose.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/cumsum.m octave-quaternion-2.4.0/inst/@quaternion/cumsum.m --- octave-quaternion-2.2.2/inst/@quaternion/cumsum.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/cumsum.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/diag.m octave-quaternion-2.4.0/inst/@quaternion/diag.m --- octave-quaternion-2.2.2/inst/@quaternion/diag.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/diag.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/display.m octave-quaternion-2.4.0/inst/@quaternion/display.m --- octave-quaternion-2.2.2/inst/@quaternion/display.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/display.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/end.m octave-quaternion-2.4.0/inst/@quaternion/end.m --- octave-quaternion-2.2.2/inst/@quaternion/end.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/end.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/eq.m octave-quaternion-2.4.0/inst/@quaternion/eq.m --- octave-quaternion-2.2.2/inst/@quaternion/eq.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/eq.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/exp.m octave-quaternion-2.4.0/inst/@quaternion/exp.m --- octave-quaternion-2.2.2/inst/@quaternion/exp.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/exp.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/fix.m octave-quaternion-2.4.0/inst/@quaternion/fix.m --- octave-quaternion-2.2.2/inst/@quaternion/fix.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/fix.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/floor.m octave-quaternion-2.4.0/inst/@quaternion/floor.m --- octave-quaternion-2.2.2/inst/@quaternion/floor.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/floor.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/full.m octave-quaternion-2.4.0/inst/@quaternion/full.m --- octave-quaternion-2.2.2/inst/@quaternion/full.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/full.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/ge.m octave-quaternion-2.4.0/inst/@quaternion/ge.m --- octave-quaternion-2.2.2/inst/@quaternion/ge.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/ge.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/get.m octave-quaternion-2.4.0/inst/@quaternion/get.m --- octave-quaternion-2.2.2/inst/@quaternion/get.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/get.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/gt.m octave-quaternion-2.4.0/inst/@quaternion/gt.m --- octave-quaternion-2.2.2/inst/@quaternion/gt.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/gt.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/horzcat.m octave-quaternion-2.4.0/inst/@quaternion/horzcat.m --- octave-quaternion-2.2.2/inst/@quaternion/horzcat.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/horzcat.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/inv.m octave-quaternion-2.4.0/inst/@quaternion/inv.m --- octave-quaternion-2.2.2/inst/@quaternion/inv.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/inv.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/isempty.m octave-quaternion-2.4.0/inst/@quaternion/isempty.m --- octave-quaternion-2.2.2/inst/@quaternion/isempty.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/isempty.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/isfinite.m octave-quaternion-2.4.0/inst/@quaternion/isfinite.m --- octave-quaternion-2.2.2/inst/@quaternion/isfinite.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/isfinite.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/isinf.m octave-quaternion-2.4.0/inst/@quaternion/isinf.m --- octave-quaternion-2.2.2/inst/@quaternion/isinf.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/isinf.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/isnan.m octave-quaternion-2.4.0/inst/@quaternion/isnan.m --- octave-quaternion-2.2.2/inst/@quaternion/isnan.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/isnan.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/ispure.m octave-quaternion-2.4.0/inst/@quaternion/ispure.m --- octave-quaternion-2.2.2/inst/@quaternion/ispure.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/ispure.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/isreal.m octave-quaternion-2.4.0/inst/@quaternion/isreal.m --- octave-quaternion-2.2.2/inst/@quaternion/isreal.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/isreal.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/ldivide.m octave-quaternion-2.4.0/inst/@quaternion/ldivide.m --- octave-quaternion-2.2.2/inst/@quaternion/ldivide.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/ldivide.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/le.m octave-quaternion-2.4.0/inst/@quaternion/le.m --- octave-quaternion-2.2.2/inst/@quaternion/le.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/le.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/length.m octave-quaternion-2.4.0/inst/@quaternion/length.m --- octave-quaternion-2.2.2/inst/@quaternion/length.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/length.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/log.m octave-quaternion-2.4.0/inst/@quaternion/log.m --- octave-quaternion-2.2.2/inst/@quaternion/log.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/log.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/lt.m octave-quaternion-2.4.0/inst/@quaternion/lt.m --- octave-quaternion-2.2.2/inst/@quaternion/lt.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/lt.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/mean.m octave-quaternion-2.4.0/inst/@quaternion/mean.m --- octave-quaternion-2.2.2/inst/@quaternion/mean.m 1970-01-01 00:00:00.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/mean.m 2015-03-28 07:22:40.000000000 +0000 @@ -0,0 +1,48 @@ +## Copyright (C) 2013 Willem Atsma +## +## 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 3 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 should have received a copy of the GNU General Public License +## along with this program. If not, see . + +## -*- texinfo -*- +## @deftypefn {Function File} {@var{q} =} mean (@var{q}) +## @deftypefnx {Function File} {@var{q} =} mean (@var{q}, @var{dim}) +## @deftypefnx {Function File} {@var{q} =} mean (@var{q}, @var{opt}) +## @deftypefnx {Function File} {@var{q} =} mean (@var{q}, @var{dim}, @var{opt}) +## Compute the mean of the elements of the quaternion array @var{q}. +## +## @example +## mean (q) = mean (q.w) + mean (q.x)*i + mean (q.y)*j + mean (q.z)*k +## @end example +## +## See @code{help mean} for more information and a description of the +## parameters @var{dim} and @var{opt}. +## @end deftypefn + +## Author: Willem Atsma +## Created: June 2013 +## Version: 0.1 + +function q = mean (q, varargin) + + if (! isa (q, "quaternion")) + print_usage (); + endif + + w = mean (q.w, varargin{:}); + x = mean (q.x, varargin{:}); + y = mean (q.y, varargin{:}); + z = mean (q.z, varargin{:}); + + q = quaternion (w, x, y, z); + +endfunction diff -Nru octave-quaternion-2.2.2/inst/@quaternion/minus.m octave-quaternion-2.4.0/inst/@quaternion/minus.m --- octave-quaternion-2.2.2/inst/@quaternion/minus.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/minus.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/mldivide.m octave-quaternion-2.4.0/inst/@quaternion/mldivide.m --- octave-quaternion-2.2.2/inst/@quaternion/mldivide.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/mldivide.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/mpower.m octave-quaternion-2.4.0/inst/@quaternion/mpower.m --- octave-quaternion-2.2.2/inst/@quaternion/mpower.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/mpower.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/mrdivide.m octave-quaternion-2.4.0/inst/@quaternion/mrdivide.m --- octave-quaternion-2.2.2/inst/@quaternion/mrdivide.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/mrdivide.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/mtimes.m octave-quaternion-2.4.0/inst/@quaternion/mtimes.m --- octave-quaternion-2.2.2/inst/@quaternion/mtimes.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/mtimes.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/ndims.m octave-quaternion-2.4.0/inst/@quaternion/ndims.m --- octave-quaternion-2.2.2/inst/@quaternion/ndims.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/ndims.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/ne.m octave-quaternion-2.4.0/inst/@quaternion/ne.m --- octave-quaternion-2.2.2/inst/@quaternion/ne.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/ne.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/norm.m octave-quaternion-2.4.0/inst/@quaternion/norm.m --- octave-quaternion-2.2.2/inst/@quaternion/norm.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/norm.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/numel.m octave-quaternion-2.4.0/inst/@quaternion/numel.m --- octave-quaternion-2.2.2/inst/@quaternion/numel.m 1970-01-01 00:00:00.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/numel.m 2015-03-28 07:22:40.000000000 +0000 @@ -0,0 +1,37 @@ +## Copyright (C) 2010-2015 Lukas F. Reichlin +## +## 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 3 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 should have received a copy of the GNU General Public License +## along with this program. If not, see . + +## -*- texinfo -*- +## @deftypefn {Function File} {@var{n} =} numel (@var{q}) +## @deftypefnx {Function File} {@var{n} =} numel (@var{q}, @var{idx1}, @var{idx2}, @dots{}) +## For internal use only, use @code{prod(size(q))} or @code{numel (q.w)} instead. +## For technical reasons, this method must return the number of elements which are +## returned from cs-list indexing, no matter whether it is called with one or more +## arguments. +## @end deftypefn + +## Author: Lukas Reichlin +## Created: February 2015 +## Version: 0.1 + +function ret = numel (q, varargin) + + ret = builtin ("numel", q, varargin{:}); + +endfunction + + +%!test +%! assert (numel (quaternion (eye (3))), 1); diff -Nru octave-quaternion-2.2.2/inst/@quaternion/plus.m octave-quaternion-2.4.0/inst/@quaternion/plus.m --- octave-quaternion-2.2.2/inst/@quaternion/plus.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/plus.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/power.m octave-quaternion-2.4.0/inst/@quaternion/power.m --- octave-quaternion-2.2.2/inst/@quaternion/power.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/power.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## Copyright (c) 2011 Juan Pablo Carbajal ## ## This program is free software: you can redistribute it and/or modify diff -Nru octave-quaternion-2.2.2/inst/@quaternion/private/keys_vals.m octave-quaternion-2.4.0/inst/@quaternion/private/keys_vals.m --- octave-quaternion-2.2.2/inst/@quaternion/private/keys_vals.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/private/keys_vals.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/private/norm2.m octave-quaternion-2.4.0/inst/@quaternion/private/norm2.m --- octave-quaternion-2.2.2/inst/@quaternion/private/norm2.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/private/norm2.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/private/normv.m octave-quaternion-2.4.0/inst/@quaternion/private/normv.m --- octave-quaternion-2.2.2/inst/@quaternion/private/normv.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/private/normv.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/quaternion.m octave-quaternion-2.4.0/inst/@quaternion/quaternion.m --- octave-quaternion-2.2.2/inst/@quaternion/quaternion.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/quaternion.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/rdivide.m octave-quaternion-2.4.0/inst/@quaternion/rdivide.m --- octave-quaternion-2.2.2/inst/@quaternion/rdivide.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/rdivide.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/repmat.m octave-quaternion-2.4.0/inst/@quaternion/repmat.m --- octave-quaternion-2.2.2/inst/@quaternion/repmat.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/repmat.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/reshape.m octave-quaternion-2.4.0/inst/@quaternion/reshape.m --- octave-quaternion-2.2.2/inst/@quaternion/reshape.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/reshape.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/round.m octave-quaternion-2.4.0/inst/@quaternion/round.m --- octave-quaternion-2.2.2/inst/@quaternion/round.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/round.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/rows.m octave-quaternion-2.4.0/inst/@quaternion/rows.m --- octave-quaternion-2.2.2/inst/@quaternion/rows.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/rows.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/set.m octave-quaternion-2.4.0/inst/@quaternion/set.m --- octave-quaternion-2.2.2/inst/@quaternion/set.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/set.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/size_equal.m octave-quaternion-2.4.0/inst/@quaternion/size_equal.m --- octave-quaternion-2.2.2/inst/@quaternion/size_equal.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/size_equal.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/size.m octave-quaternion-2.4.0/inst/@quaternion/size.m --- octave-quaternion-2.2.2/inst/@quaternion/size.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/size.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/sparse.m octave-quaternion-2.4.0/inst/@quaternion/sparse.m --- octave-quaternion-2.2.2/inst/@quaternion/sparse.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/sparse.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/squeeze.m octave-quaternion-2.4.0/inst/@quaternion/squeeze.m --- octave-quaternion-2.2.2/inst/@quaternion/squeeze.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/squeeze.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/subsasgn.m octave-quaternion-2.4.0/inst/@quaternion/subsasgn.m --- octave-quaternion-2.2.2/inst/@quaternion/subsasgn.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/subsasgn.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/subsref.m octave-quaternion-2.4.0/inst/@quaternion/subsref.m --- octave-quaternion-2.2.2/inst/@quaternion/subsref.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/subsref.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/sum.m octave-quaternion-2.4.0/inst/@quaternion/sum.m --- octave-quaternion-2.2.2/inst/@quaternion/sum.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/sum.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/times.m octave-quaternion-2.4.0/inst/@quaternion/times.m --- octave-quaternion-2.2.2/inst/@quaternion/times.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/times.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/transpose.m octave-quaternion-2.4.0/inst/@quaternion/transpose.m --- octave-quaternion-2.2.2/inst/@quaternion/transpose.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/transpose.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/tril.m octave-quaternion-2.4.0/inst/@quaternion/tril.m --- octave-quaternion-2.2.2/inst/@quaternion/tril.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/tril.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/triu.m octave-quaternion-2.4.0/inst/@quaternion/triu.m --- octave-quaternion-2.2.2/inst/@quaternion/triu.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/triu.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/uminus.m octave-quaternion-2.4.0/inst/@quaternion/uminus.m --- octave-quaternion-2.2.2/inst/@quaternion/uminus.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/uminus.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/unit.m octave-quaternion-2.4.0/inst/@quaternion/unit.m --- octave-quaternion-2.2.2/inst/@quaternion/unit.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/unit.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/uplus.m octave-quaternion-2.4.0/inst/@quaternion/uplus.m --- octave-quaternion-2.2.2/inst/@quaternion/uplus.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/uplus.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/@quaternion/vertcat.m octave-quaternion-2.4.0/inst/@quaternion/vertcat.m --- octave-quaternion-2.2.2/inst/@quaternion/vertcat.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/@quaternion/vertcat.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 diff -Nru octave-quaternion-2.2.2/inst/rot2q.m octave-quaternion-2.4.0/inst/rot2q.m --- octave-quaternion-2.2.2/inst/rot2q.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/rot2q.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,5 +1,5 @@ ## Copyright (C) 1998, 1999, 2000, 2002, 2005, 2006, 2007 Auburn University -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 @@ -26,16 +26,20 @@ ## @strong{Inputs} ## @table @var ## @item axis -## Vector @code{[x, y, z]} describing the axis of rotation. +## Vector @code{[x, y, z]} or @code{[x; y; z]} describing the axis of rotation. ## @item angle ## Rotation angle in radians. The positive direction is ## determined by the right-hand rule applied to @var{axis}. +## If @var{angle} is a real-valued array, a quaternion array +## @var{q} of the same size is returned. ## @end table ## ## @strong{Outputs} ## @table @var ## @item q ## Unit quaternion describing the rotation. +## If @var{angle} is an array, @var{q(i,j)} corresponds to +## the rotation angle @var{angle(i,j)}. ## @end table ## ## @strong{Example} @@ -58,38 +62,49 @@ ## Adapted from: quaternion by A. S. Hodel ## Author: Lukas Reichlin ## Created: May 2010 -## Version: 0.1 +## Version: 0.2 function q = rot2q (vv, theta) - if (nargin != 2 || nargout != 1) + if (nargin != 2 || nargout > 1) print_usage (); endif - if (! isvector (vv) || length (vv) != 3) - error ("vv must be a length three vector"); + if (! is_real_array (vv) || ! isvector (vv) || length (vv) != 3) + error ("rot2q: first argument 'axis' must be a length three vector"); endif - if (! isscalar (theta)) - error ("theta must be a scalar"); + if (! is_real_array (theta)) + error ("rot2q: second argument 'angle' must be a scalar"); endif if (norm (vv) == 0) - error ("quaternion: vv is zero"); + error ("rot2q: first argument 'axis' is zero"); endif if (abs (norm (vv) - 1) > 1e-12) - warning ("quaternion: ||vv|| != 1, normalizing") + warning ("rot2q:axis", "rot2q: ||axis|| != 1, normalizing") vv = vv / norm (vv); endif - if (abs (theta) > 2*pi) - warning ("quaternion: |theta| > 2 pi, normalizing") + if (any ((abs (theta) > 2*pi)(:))) + warning ("rot2q:angle", "rot2q: |angle| > 2 pi, normalizing") theta = rem (theta, 2*pi); endif - vv = vv * sin (theta / 2); - d = cos (theta / 2); - q = quaternion (d, vv(1), vv(2), vv(3)); + w = cos (theta ./ 2); + st2 = sin (theta ./ 2); + x = vv(1) .* st2; + y = vv(2) .* st2; + z = vv(3) .* st2; + + q = quaternion (w, x, y, z); endfunction + + +%!shared ax, an +%! q = rot2q ([1;0;0], -1.2*pi); +%! [ax, an] = q2rot (q); +%!assert (abs (ax(1)), 1, 1e-4); +%!assert (an*ax(1), -1.2*pi, 1e-4); diff -Nru octave-quaternion-2.2.2/inst/rotm2q.m octave-quaternion-2.4.0/inst/rotm2q.m --- octave-quaternion-2.2.2/inst/rotm2q.m 1970-01-01 00:00:00.000000000 +0000 +++ octave-quaternion-2.4.0/inst/rotm2q.m 2015-03-28 07:22:40.000000000 +0000 @@ -0,0 +1,84 @@ +## Copyright (C) 2013 Willem Atsma +## +## 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 3 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 should have received a copy of the GNU General Public License +## along with this program. If not, see . + +## -*- texinfo -*- +## @deftypefn {Function File} {@var{q} =} rotm2q (@var{R}) +## Convert 3x3 rotation matrix @var{R} to unit quaternion @var{q}. +## @end deftypefn + +## Author: Willem Atsma +## Based on C code from +## Created: May 2013 +## Version: 0.1 + +function q = rotm2q (R) + + if (nargin != 1) + print_usage (); + endif + + if (! is_real_array (R) || ! isequal (size (R), [3, 3])) + error ("rotm2q: require a (3x3) rotation matrix"); + endif + + T = trace (R); + + if (T > 0) + s = 0.5 / sqrt (T+1); + w = 0.25 / s; + x = (R(3,2) - R(2,3)) * s; + y = (R(1,3) - R(3,1)) * s; + z = (R(2,1) - R(1,2)) * s; + else + if (R(1,1) > R(2,2) && R(1,1) > R(3,3)) + s = 2 * sqrt (1 + R(1,1) - R(2,2) - R(3,3)); + w = (R(3,2) - R(2,3)) / s; + x = 0.25 * s; + y = (R(1,2) + R(2,1)) / s; + z = (R(1,3) + R(3,1)) / s; + elseif (R(2,2) > R(3,3)) + s = 2 * sqrt (1 + R(2,2) - R(1,1) - R(3,3)); + w = (R(1,3) - R(3,1)) / s; + x = (R(1,2) + R(2,1)) / s; + y = 0.25 * s; + z = (R(2,3) + R(3,2) ) / s; + else + s = 2 * sqrt (1 + R(3,3) - R(1,1) - R(2,2)); + w = (R(2,1) - R(1,2)) / s; + x = (R(1,3) + R(3,1)) / s; + y = (R(2,3) + R(3,2)) / s; + z = 0.25 * s; + endif + endif + + q = quaternion (w, x, y, z); + +endfunction + + +%!test +%! R = eye (3); +%! q = rotm2q (R); +%! assert (q.w, 1, 1e-4); +%! assert (q.x, 0, 1e-4); +%! assert (q.y, 0, 1e-4); +%! assert (q.z, 0, 1e-4); + +%!test +%! R = [[1;0;0], [0;0;1], [0;-1;0]]; +%! q = rotm2q (R); +%! [ax, an] = q2rot (q); +%! assert (ax(:), [1;0;0], 1e-4); +%! assert (an, pi/2, 1e-4); diff -Nru octave-quaternion-2.2.2/inst/test_quaternion.m octave-quaternion-2.4.0/inst/test_quaternion.m --- octave-quaternion-2.2.2/inst/test_quaternion.m 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/inst/test_quaternion.m 2015-03-28 07:22:40.000000000 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010-2014 Lukas F. Reichlin +## Copyright (C) 2010-2015 Lukas F. Reichlin ## ## 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 @@ -34,3 +34,8 @@ test @quaternion/lt test @quaternion/ndims test @quaternion/ne +test @quaternion/numel + +test q2rot +test rot2q +test rotm2q diff -Nru octave-quaternion-2.2.2/NEWS octave-quaternion-2.4.0/NEWS --- octave-quaternion-2.2.2/NEWS 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/NEWS 2015-03-28 07:30:54.000000000 +0000 @@ -1,6 +1,36 @@ Summary of important user-visible changes for releases of the quaternion package =============================================================================== +quaternion-2.4.0 Release Date: 2015-03-21 Release Manager: Lukas Reichlin +=============================================================================== + +** q2rot + -- Vectorized code to support the input of multiple quaternions. + -- Return axis as a column vector. + -- Add test. + +** rot2q + -- Support for multiple rotation angles (vectorized code). + -- Improved error messages. + -- Add test. + +** The following functions are new: + + rotm2q + +** The following functions are now overloaded for quaternions: + + mean numel + + (Thanks to Willem Atsma for all the changes above) + +** The quaternion package now depends on Octave version 3.8.0 or beyond. + +** In order to comply with modified Octave Forge rules, the package no longer + auto-loads. See "help pkg" for details on auto-loading. + + +=============================================================================== quaternion-2.2.2 Release Date: 2014-07-20 Release Manager: Lukas Reichlin =============================================================================== diff -Nru octave-quaternion-2.2.2/src/is_real_array.cc octave-quaternion-2.4.0/src/is_real_array.cc --- octave-quaternion-2.2.2/src/is_real_array.cc 2014-07-20 11:33:53.000000000 +0000 +++ octave-quaternion-2.4.0/src/is_real_array.cc 2015-03-28 07:22:40.000000000 +0000 @@ -1,6 +1,6 @@ /* -Copyright (C) 2010-2014 Lukas F. Reichlin +Copyright (C) 2010-2015 Lukas F. Reichlin 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