help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

About diagonal matrices


From: José Luis García Pallero
Subject: About diagonal matrices
Date: Fri, 20 Feb 2009 17:07:03 +0100

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
address@hidden
(o<
/ / \
V_/_
Use Debian GNU/Linux and enjoy!
*****************************************

reply via email to

[Prev in Thread] Current Thread [Next in Thread]