Bug or feature?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug or feature?

Shmuel Tomer
In matlab:

   >> [1 2] == [1]
 
   ans =
 
        1     0
 
   >> [1 2] == []
 
   ans =
 
        0
     
but in octave:

   octave:1> [1 2] == [1]
   ans =
 
     1  0
 
   octave:2> [1 2] == []
   error: operator ==: nonconformant arguments (op1 is 1x2, op2 is 0x0)

Is this a bug or a feature?

In other words, would it be correct to reverse the order of the
following two tests in the macro MX_MX_BOOL_OP (src/ops.h, lines
94-100)?

      if (m1_nr != m2_nr || m1_nc != m2_nc) \
        { \
          gripe_nonconformant ("operator " op, m1_nr, m1_nc, m2_nr, m2_nc); \
          return Matrix (); \
        } \
      if (m1_nr == 0 || m1_nc == 0) \
        return empty_result; \

Would that have (disastrous) effects, other than to provide a Matlab compatible
behavior? I don't prefer this behavior per se, but being able to use octave in
my site may depend on wheter the users need to go through the existing zillion
scripts and change every occurrence of
        if myString == ''
to
        if strcmp(myString, '')
       

Thanks!






Reply | Threaded
Open this post in threaded view
|

Bug or feature?

John W. Eaton-6
On 20-Jan-1997, Shmuel Tomer <[hidden email]> wrote:

: In matlab:
:
:    >> [1 2] == [1]
:  
:    ans =
:  
:         1     0
:  
:    >> [1 2] == []
:  
:    ans =
:  
:         0
:      
: but in octave:
:
:    octave:1> [1 2] == [1]
:    ans =
:  
:      1  0
:  
:    octave:2> [1 2] == []
:    error: operator ==: nonconformant arguments (op1 is 1x2, op2 is 0x0)
:
: Is this a bug or a feature?

I think I would call this a bug.

: In other words, would it be correct to reverse the order of the
: following two tests in the macro MX_MX_BOOL_OP (src/ops.h, lines
: 94-100)?
:
:       if (m1_nr != m2_nr || m1_nc != m2_nc) \
:         { \
:           gripe_nonconformant ("operator " op, m1_nr, m1_nc, m2_nr, m2_nc); \
:           return Matrix (); \
:         } \
:       if (m1_nr == 0 || m1_nc == 0) \
:         return empty_result; \
:
: Would that have (disastrous) effects, other than to provide a Matlab
: compatible behavior?

I don't think that simply switching the order of the tests is enough
to make this part of Octave compatible with Matlab.  I've just posted
a patch to the bug-octave mailing list that might do a better job.

: I don't prefer this behavior per se, but being able to use octave in
: my site may depend on wheter the users need to go through the
: existing zillion scripts and change every occurrence of
:
: if myString == ''
: to
: if strcmp(myString, '')

The patch will also make

  myString == ''

work as you expect.

Thanks,

jwe


Reply | Threaded
Open this post in threaded view
|

temp dir when plotting

Control Systems Group-2
It seems every time I use plot command, there is a temp file named
oct-00802xea or something like that being written to the /tmp directory
on my system. The only trouble is, I only got 3M available on that
partition. When that happens I have to either delete all those temp
files or quit octave and restart.

Are there any way to specify a directory other than /tmp to write
those temp files to? If so, how?

Reply | Threaded
Open this post in threaded view
|

temp dir when plotting

John W. Eaton-6
On  3-Feb-1997, Control Systems Group <[hidden email]> wrote:

| It seems every time I use plot command, there is a temp file named
| oct-00802xea or something like that being written to the /tmp directory
| on my system. The only trouble is, I only got 3M available on that
| partition. When that happens I have to either delete all those temp
| files or quit octave and restart.
|
| Are there any way to specify a directory other than /tmp to write
| those temp files to? If so, how?

You can use another directory by setting the environment variable
TMPDIR before starting Octave.

Or you can clear the temporary files by running the command
purge_tmp_files.

Unfortunately, it's not possible to make Octave run this command
automatically because Octave currently has no way of knowing when
gnuplot is finished with the files.

jwe