Mercurial > forge
changeset 11165:3266b6195c08 octave-forge
quaternion: error if nargin is not 2
author | paramaniac |
---|---|
date | Thu, 25 Oct 2012 03:59:55 +0000 |
parents | 9401a757a3d6 |
children | d5af411649a3 |
files | main/quaternion/inst/@quaternion/ldivide.m main/quaternion/inst/@quaternion/mldivide.m |
diffstat | 2 files changed, 12 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/main/quaternion/inst/@quaternion/ldivide.m Wed Oct 24 21:43:38 2012 +0000 +++ b/main/quaternion/inst/@quaternion/ldivide.m Thu Oct 25 03:59:55 2012 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010 Lukas F. Reichlin +## Copyright (C) 2010, 2012 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 @@ -18,10 +18,14 @@ ## Author: Lukas Reichlin <lukas.reichlin@gmail.com> ## Created: May 2010 -## Version: 0.1 +## Version: 0.2 function q = ldivide (a, b) + if (nargin != 2) + error ("quaternion: ldivide: this is a binary operator"); + endif + q = a.^-1 .* b; endfunction
--- a/main/quaternion/inst/@quaternion/mldivide.m Wed Oct 24 21:43:38 2012 +0000 +++ b/main/quaternion/inst/@quaternion/mldivide.m Thu Oct 25 03:59:55 2012 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2010 Lukas F. Reichlin +## Copyright (C) 2010, 2012 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 @@ -18,10 +18,14 @@ ## Author: Lukas Reichlin <lukas.reichlin@gmail.com> ## Created: May 2010 -## Version: 0.1 +## Version: 0.2 function q = mldivide (a, b) + if (nargin != 2) + error ("quaternion: mldivide: this is a binary operator"); + endif + q = inv (a) * b; endfunction