octave-maintainers
[Top][All Lists]
Advanced

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

Re: diagonal matrices specializations


From: Søren Hauberg
Subject: Re: diagonal matrices specializations
Date: Tue, 02 Dec 2008 08:56:15 +0100

tir, 02 12 2008 kl. 08:23 +0100, skrev Jaroslav Hajek:
> 2. There was a prior debate how the special diagonal matrices should
> be displayed & saved. Saving to external formats is out of question,
> of course, but displaying and Octave's native saving is debatable.
> Displaying a diagonal matrix by printing out just the diagonal (after
> a notification of diagonality) is no doubt more informative than
> displaying it as full. Similarly, when Octave saves a matrix in its
> native format, it can be useful to preserve the diagonality
> information rather than forgetting it. OTOH, there's compatibility.
> In the patch presented, neither option is exploited, i.e. the matrix
> is always converted to full.
> My personal preference is to alter the printing and leave the saving,
> but I'd like to hear more opinions about this.

First of all, I very much agree with the rationale, that Octave should
make it easy to write code that is easy to read.

As to saving and displaying, I'd also prefer if diagonal matrices are
displayed in a way where only the diagonal elements are shown.
Obviously, it should be easy to tell whatever is printed from what is
printed when displaying a vector.

When it comes to saving, I believe diagonal matrices should be saved as
such. I don't believe the Octave format has ever been backwards
compatible. That is, I don't think there are any guaranties that you can
load a file created by Octave 3.0 in Octave 2.0. When new things (such
as function handles, objects, ...) have been added the the file format
has just been extended (at least that's my understanding), and I think
we should do the same thing here. Otherwise we would get two different
behaviours when doing

  some_computation
  save my_file.mat
  clear all
  load my_file.mat
  some_computation

which I think would be confusing.

If you decide to save diagonal matrices as full matrices, then at least
you should print a warning when saving such matrices.

Thanks for doing stuff like this,
Soren



reply via email to

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