octave-maintainers
[Top][All Lists]
Advanced

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

Re: Updating who/whos


From: Oyvind Kristiansen
Subject: Re: Updating who/whos
Date: Sat, 7 Feb 2004 13:49:26 +0100 (CET)


On Fri, 6 Feb 2004, John W. Eaton wrote:

> On  4-Feb-2004, Oyvind Kristiansen <address@hidden> wrote:
>
> | I've written a patch for updating who/whos.
> |
> | What's new:
> | -ability to print information on memory used by variables
> | -ability to print descriptor of dimensions, instead of just rows and cols
> | (as it is today)
> |
> | Two internal variables now rule the output from who/whos:
> | -who_traditional=true|false (defaults to false), tells Octave what
> | ordering is to be used per line of information, and what kind of
> | information is to be displayed. who_traditional=true will
> | cause an output similar to the output from who/whos in Matlab.
> | who_traditional=true, will cause an output much like the existing output.
> | -who_print_dims controls how many dimensions will be displayed. In Matlab,
> | when an array is 2x3x2x4, Matlab will tell it's a 4-D array. Octave will
> | check who_print_dims to find out how to print this information.
>
> I agree that whos needs to be updated for N-d arrays objects, but I'm
> not sure that we need to have output that exactly mimics the output
> from Matlab.  But maybe there is a reason that is needed.  If so, what
> is it?

I can agree. But I think that the name of the variable is the most
important aspect of the variable, and that it should be printed first.

Also, I think the Matlab summary is necessary: "Grand total is xxx
element(s) using yyy byte(s)".

And, lastly, I think the matlab'ish way of printing headers meets the eye.
I think a header like:
  Name    Size      Bytes    Class

is much nicer (and "cleaner") than:
prot    type    rows  cols   name
====    ====    ====  ====   ====

>
> So, I think I would prefer to see the format updated so that it always
> displays the full list of dimensions (at least up to some more
> reasonable limit -- perhaps 8 would be enough for most uses.)
>
> Displaying the number of bytes used is also reasonable.
>
> Currently, Octave displays information about whether a variable is
> read-only but even I can't remember what the code means, and I don't
> think it is particularly useful, so maybe that could go away.
>
> Or, if you really think that there should be multiple output formats
> allowed, then I think a much better solution would be to provide a way
> to control the output using some kind of format string.
>

A format string is generally a good idea:
* it is possible to choose what information to print
* it is possible to choose how to organize the information is printed

There are however some drawbacks/points to consider:
* it will require more computation in advance to make the format
  more general (the original whos printout requires little computation in
  advance).
* in the current patch, computational effort in advance can easily be
  determined
* not all ways of printing variables will be favorable (for instance,
  name of variable is the most important aspect. Also, I think the way
  Matlab aligns bytes comunt together with class column is nice and
  "space-conserving"
* how sophisticated should a format string be to be useful? Should it
  contain information on alignment, and minimum space required by each
  column?

I think point 3 and 4 are the most important.

-Oeyvind

However, I favor the format string myself.

> Comments?
>
> jwe
>



reply via email to

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