From: <jpi...@us...> - 2011-12-12 09:03:44
|
Revision: 9371 http://octave.svn.sourceforge.net/octave/?rev=9371&view=rev Author: jpicarbajal Date: 2011-12-12 09:03:34 +0000 (Mon, 12 Dec 2011) Log Message: ----------- quaternion_oo: Bug in mpower corrected q^0 Modified Paths: -------------- trunk/octave-forge/extra/quaternion_oo/inst/@quaternion/mpower.m trunk/octave-forge/main/mechanics/inst/core/private/sub2ind_tril.m Modified: trunk/octave-forge/extra/quaternion_oo/inst/@quaternion/mpower.m =================================================================== --- trunk/octave-forge/extra/quaternion_oo/inst/@quaternion/mpower.m 2011-12-12 07:01:48 UTC (rev 9370) +++ trunk/octave-forge/extra/quaternion_oo/inst/@quaternion/mpower.m 2011-12-12 09:03:34 UTC (rev 9371) @@ -30,7 +30,7 @@ if fix (b) == b # only integers are poorly implemented [n m] = size (a.w); - w = ones (n,m); + w = eye (n,m); x = zeros (n,m); q = quaternion(w,x,x,x); while b-- @@ -39,8 +39,9 @@ a = q; else error ("quaternion:devel", ... - "quaternion: power: implemented for scalar quaternions only"); - end + "quaternion: power: implemented for integer exponents only"); + a = expm(b * logm (a)); + endif end Modified: trunk/octave-forge/main/mechanics/inst/core/private/sub2ind_tril.m =================================================================== --- trunk/octave-forge/main/mechanics/inst/core/private/sub2ind_tril.m 2011-12-12 07:01:48 UTC (rev 9370) +++ trunk/octave-forge/main/mechanics/inst/core/private/sub2ind_tril.m 2011-12-12 09:03:34 UTC (rev 9371) @@ -1,5 +1,5 @@ %% Copyright (c) 2011 Juan Pablo Carbajal <car...@if...> -%% +%% %% 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 @@ -32,7 +32,7 @@ %% @end example %% %% The following example shows how to convert the two-dimensional -%% index `(3,2)' of the 4-by-4 matrix in the example to a linear index. +%% index `(3,2)' of the 4-by-4 matrix in the previous example to a linear index. %% %% @example %% linear_index = sub2ind_tril (4, 3, 2) @@ -54,15 +54,15 @@ any(size(r) != size(c)) print_usage; endif - + R = zeros(size(r)); C = zeros(size(c)); - + below = r >= c; above = !below; R(below) = r(below); C(below) = c(below); - + R(above) = c(above); C(above) = r(above); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |