From: <par...@us...> - 2012-05-02 05:52:01
|
Revision: 10353 http://octave.svn.sourceforge.net/octave/?rev=10353&view=rev Author: paramaniac Date: 2012-05-02 05:51:55 +0000 (Wed, 02 May 2012) Log Message: ----------- quaternion: doc and test for vector = diag (matrix) Modified Paths: -------------- trunk/octave-forge/main/quaternion/inst/@quaternion/diag.m Modified: trunk/octave-forge/main/quaternion/inst/@quaternion/diag.m =================================================================== --- trunk/octave-forge/main/quaternion/inst/@quaternion/diag.m 2012-05-01 20:43:31 UTC (rev 10352) +++ trunk/octave-forge/main/quaternion/inst/@quaternion/diag.m 2012-05-02 05:51:55 UTC (rev 10353) @@ -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 @@ -22,11 +22,13 @@ ## If it is negative, it is placed on the -K-th sub-diagonal. ## The default value of K is 0, and the vector is placed ## on the main diagonal. +## Given a matrix argument, instead of a vector, @command{diag} +## extracts the @var{K}-th diagonal of the matrix. ## @end deftypefn ## Author: Lukas Reichlin <luk...@gm...> ## Created: May 2010 -## Version: 0.1 +## Version: 0.2 function a = diag (a, b = 0) @@ -42,7 +44,7 @@ endfunction -%!shared R, S +%!shared R, S, T, U %! Q = quaternion (2, 3, 4, 5); %! R = diag ([Q, Q, Q]); %! W = diag ([2, 2, 2]); @@ -50,4 +52,7 @@ %! Y = diag ([4, 4, 4]); %! Z = diag ([5, 5, 5]); %! S = quaternion (W, X, Y, Z); +%! T = diag (R); +%! U = [Q; Q; Q]; %!assert (R == S); +%!assert (T == U); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |