About diagonal matrices
José Luis García Pallero
jgpallero at gmail.com
Fri Feb 20 10:07:03 CST 2009
Hi,
Playing with the new diag() function in octave 3.1.52 I can see some
extrange behaviour (or I don't understand some particular cases). For
example, for the matrix
a = diag([2 3 4])
This is a diagonal matrix: typeinfo(a) -> diagonal matrix
But if I add a scalar: typeinfo(4+a) -> matrix
If I multiply by a scalar: typeinfo(4*a) -> diagonal matrix
But if I multiply by a scalar in element-by-element form: typeinfo(4.*a) ->
matrix
If I divide by a scalar in element-by-element form: typeinfo(4./a) -> matrix
For a power operation: typeinfo(a^2) -> diagonal matrix
But element-by-element: typeinfo(a.^2) -> matrix
For functions: typeinfo(sqrt(a)) -> matrix (the same for sin(), cos(), etc.)
Has any reason for this behaviour?
--
*****************************************
José Luis García Pallero
jgpallero at gmail.com
(o<
/ / \
V_/_
Use Debian GNU/Linux and enjoy!
*****************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www-old.cae.wisc.edu/pipermail/help-octave/attachments/20090220/dc184404/attachment.html
More information about the Help-octave
mailing list