octave-maintainers
[Top][All Lists]
Advanced

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

Re: format compact and loose


From: John W. Eaton
Subject: Re: format compact and loose
Date: Tue, 6 Sep 2011 22:55:30 -0400

On  6-Sep-2011, Jordi Gutiérrez Hermoso wrote:

| Moving to maintainers' list....
| 
| 2011/9/6 Ben Abbott <address@hidden>:
| >
| > On Sep 6, 2011, at 8:41 PM, Jordi Gutiérrez Hermoso wrote:
| >
| >> 2011/9/5 Zbigniew Komarnicki <address@hidden>:
| >>
| >>> So is there any possibility to obtain result similar as in matlab,
| >>> i.e. the result will more compact when we use e.g.
| >>
| >>> to obtain something like this:
| >>>
| >>> octave:5> rand(2, 3, 3)
| >>> ans =
| >>> ans(:,:,1) =
| >>>   0.602732   0.212420   0.216894
| >>>   0.515855   0.749427   0.053278
| >>> ans(:,:,2) =
| >>>   0.24050   0.13761   0.79709
| >>>   0.84495   0.77959   0.94395
| >>> ans(:,:,3) =
| >>>   0.16946   0.54929   0.15251
| >>>   0.78924   0.86582   0.20346
| >>>
| >>> Is this currently possible or there should be introduce change in
| >>> source code in Octave to obtain such 'compact result' ?
| >>
| >> No, I don't believe this is currently possible right now. I'm thinking
| >> of pushing a patch to enable this on the development branch, but I
| >> would like first some confirmation that this change isn't going to
| >> break something. Is there a reason why we keep that space there?
| 
| > If you'd like to post it here, or to the developers mail-list, I'd
| > be happy to test it.
| 
| Thanks for offering. My patch is attached. I'm not sure if this breaks
| things if e.g. you're not using a pager or some other output
| situations I haven't thought of. But you offered to test, so I'll let
| you do that. :P
| 
| Also, for anyone checking my C++: I made the compact_format variable
| visible in two more TUs besides its original pr-output.cc. Yes! A
| global variable! ;-) But I think it's ok to pollute the global
| namespace a little here.

I'd rather avoid the global if possible.  The print_with_name function
already accepts a parameter for padding that doesn't seem to be used
anywhere in Octave itself now, so I guess you could use it for the
compact_format feature instead of whatever it was originally intended
for.  Then you'll need to pass it on to print_name_tag.  Does adding
an extra parameter to that function cause a lot of trouble?

If it is necessary to make compact_format global, then please declare
it in pr-output.h instead of adding individual extern declarations in
multiple places.

Though we are not editing ChangeLog files directly, the preferred
format still has some merit, so I'd still like for people to include
the names of the functions or variables that have changed, like

* pr-output.cc (compact_format): No longer static.
* pr-output.cc (compacdt_format): Provide decl.
* ov-base.cc (octave_class::print_name_tag): Omit extra vertical space
if compact_format is true.

etc.

Thanks,

jwe


reply via email to

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