is this a bug?

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

is this a bug?

Vu Nguyen-Cong
The following is what I did with octave-2.0.8 on Linux

z = [
   1       0       0
   1       0       0
   0       1       0
   0       1       0
   0       0       1
   0       0       1
];

z(:, any(z))

ans =

  1  1  1
  1  1  1
  0  0  0
  0  0  0
  0  0  0
  0  0  0

Vu Nguyen-Cong
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: is this a bug?

Mario Storti-4

Vu Nguyen-Cong <[hidden email]> writes:

> The following is what I did with octave-2.0.8 on Linux
>
> z = [
>    1       0       0
>    1       0       0
>    0       1       0
>    0       1       0
>    0       0       1
>    0       0       1
> ];
>
> z(:, any(z))
>
> ans =
>
>   1  1  1
>   1  1  1
>   0  0  0
>   0  0  0
>   0  0  0
>   0  0  0
>
> Vu Nguyen-Cong
> [hidden email]

I think it's OK. any(z) is [1 1 1] and Octave understands z(:,[1 1 1])
as [z(:,1) z(:,1) z(:,1)].

Hope this helps,

Mario

%%%%%%<>%%%%%%<>%%%%%%<>%%%%%%<>%%%%%%<>%%%%%%<>%%%%%%<>%%%%%
Mario Alberto Storti               | Fax: (54)(42) 55.09.44 |
Grupo de Tecnologia Mecanica       | Tel: (54)(42) 55.91.75 |
INTEC, Guemes 3450 - 3000 Santa Fe | Home: Gob. Vera 3161   |
Argentina                          |       (54)(42) 55.00.23|
Reply: [hidden email]  |                        |
                http://venus.unl.edu.ar/gtm-eng.html        |


Reply | Threaded
Open this post in threaded view
|

Re: is this a bug?

John W. Eaton-6
On  2-Jul-1997, Mario Storti <[hidden email]> wrote:

| Vu Nguyen-Cong <[hidden email]> writes:
|
| > The following is what I did with octave-2.0.8 on Linux
| >
| > z = [
| >    1       0       0
| >    1       0       0
| >    0       1       0
| >    0       1       0
| >    0       0       1
| >    0       0       1
| > ];
| >
| > z(:, any(z))
| >
| > ans =
| >
| >   1  1  1
| >   1  1  1
| >   0  0  0
| >   0  0  0
| >   0  0  0
| >   0  0  0
| >
| > Vu Nguyen-Cong
| > [hidden email]
|
| I think it's OK. any(z) is [1 1 1] and Octave understands z(:,[1 1 1])
| as [z(:,1) z(:,1) z(:,1)].

If you set prefer_zero_one_indexing to 1, Octave will return the
original matrix for this example.  Is that what you were expecting?

The next major release of Octave will have a boolean type that will
eliminate this ambiguity and the need for the prefer_zero_one_indexing
variable.

jwe


Reply | Threaded
Open this post in threaded view
|

Re: is this a bug?

Vu Nguyen-Cong
> The following is what I did with octave-2.0.8 on Linux
>
> z = [
>    1       0       0
>    1       0       0
>    0       1       0
>    0       1       0
>    0       0       1
>    0       0       1
> ];
>
> z(:, any(z))
>
> ans =
>
>   1  1  1
>   1  1  1
>   0  0  0
>   0  0  0
>   0  0  0
>   0  0  0
>
> Vu Nguyen-Cong
> [hidden email]
>
>
> If you set prefer_zero_one_indexing to 1, Octave will return the
> original matrix for this example.  Is that what you were expecting?
>
> The next major release of Octave will have a boolean type that will
> eliminate this ambiguity and the need for the prefer_zero_one_indexing
> variable.
>
> jwe

Thank you indeed for your help.
Regards,
Vu Nguyen-Cong


Reply | Threaded
Open this post in threaded view
|

Re: is this a bug?

Miroslaw Kwasniak
> > The following is what I did with octave-2.0.8 on Linux
> >
> > z = [
> >    1       0       0
> >    1       0       0
> >    0       1       0
> >    0       1       0
> >    0       0       1
> >    0       0       1
> > ];
> >
> > z(:, any(z))
> >
> > ans =
> >
> >   1  1  1
> >   1  1  1
> >   0  0  0
> >   0  0  0
> >   0  0  0
> >   0  0  0
> >
> > Vu Nguyen-Cong
> > [hidden email]
> >
> >
> > If you set prefer_zero_one_indexing to 1, Octave will return the
> > original matrix for this example.  Is that what you were expecting?
> >
> > The next major release of Octave will have a boolean type that will
> > eliminate this ambiguity and the need for the prefer_zero_one_indexing
> > variable.
> >
> > jwe
>
> Thank you indeed for your help.
> Regards,
> Vu Nguyen-Cong
>

Matlab (and Octave) compatybile solution is:

                  z(:,find(any(z)))

Mirek