[Scilab-users] Generating a boolean vector or matrix

2019-09-04 Thread Federico Miyara
Dear all, I need to create a boolean vector, such as [%t, %t, %t, %t] but with a number of components given by a variable n. I couldn't find a function similar to ones(1,n). However I've found a workaround: a = ones(1,n) & %t It shouldn't work because ones(1,n) is not boolean, but it does. Q

Re: [Scilab-users] Generating a boolean vector or matrix

2019-09-04 Thread Dang Ngoc Chan, Christophe
Hello, > De : Federico Miyara > Envoyé : mercredi 4 septembre 2019 09:11 > > I need to create a boolean vector, such as [%t, %t, %t, %t] […] I > couldn't find a function similar to ones(1,n). > > However I've found a workaround: > > a = ones(1,n) & %t > […] > 1) Why does it work? Because "A numbe

Re: [Scilab-users] Generating a boolean vector or matrix

2019-09-04 Thread Stéphane Mottelet
Hello, Le 04/09/2019 à 09:11, Federico Miyara a écrit : Dear all, I need to create a boolean vector, such as [%t, %t, %t, %t] but with a number of components given by a variable n. I couldn't find a function similar to ones(1,n). However I've found a workaround: a = ones(1,n) & %t It sho

Re: [Scilab-users] Generating a boolean vector or matrix

2019-09-04 Thread Stéphane Mottelet
Le 04/09/2019 à 09:39, Stéphane Mottelet a écrit : Hello, Le 04/09/2019 à 09:11, Federico Miyara a écrit : Dear all, I need to create a boolean vector, such as [%t, %t, %t, %t] but with a number of components given by a variable n. I couldn't find a function similar to ones(1,n). Howeve

Re: [Scilab-users] Generating a boolean vector or matrix

2019-09-04 Thread Federico Miyara
Stéphane, Questions: 1) Why does it work? 2) Is there some native function to create bolean matrices 3) If not, are there any plans to introduce functions such as true(m,n) or false(m,n)? Yes, there : https://codereview.scilab.org/#/c/19964/ S. with the following syntax: ones(n,m,"boole

Re: [Scilab-users] Generating a boolean vector or matrix

2019-09-04 Thread Stéphane Mottelet
Le 04/09/2019 à 20:19, Federico Miyara a écrit : Stéphane, Questions: 1) Why does it work? 2) Is there some native function to create bolean matrices 3) If not, are there any plans to introduce functions such as true(m,n) or false(m,n)? Yes, there : https://codereview.scilab.org/#/c/19964

Re: [Scilab-users] Generating a boolean vector or matrix

2019-09-05 Thread Lamy Alain
Hi, I’m not convinced the new syntax: ones(n, m, “boolean”) is a good idea or is necessary because it makes “integer” (“constant”) and “boolean” 2 identical types. There is a simple way to do the same : repmat(%t, n, m) Alain ___ users mailing list u

Re: [Scilab-users] Generating a boolean vector or matrix

2019-09-05 Thread Stéphane Mottelet
Le 05/09/2019 à 08:55, Lamy Alain a écrit : Hi, I’m not convinced the new syntax: ones(n, m, “boolean”) is a good idea or is necessary because it makes “integer” (“constant”) and “boolean” 2 identical types. Sorry Alain can you explain it further ? There is a simple way to do the same :

Re: [Scilab-users] Generating a boolean vector or matrix

2019-09-05 Thread Federico Miyara
Christophe, Thanks! Two more questions (for anybody reading and willing to reply): 1) Is there an exclusive or function? I couldn't find it, a search leads to the XOR mode of combining graphic pixels. It would be most useful since it is one of the operations in the Galois field GF(2). Curren

Re: [Scilab-users] Generating a boolean vector or matrix

2019-09-05 Thread Federico Miyara
On 05/09/2019 04:13, Stéphane Mottelet wrote: Le 05/09/2019 à 08:55, Lamy Alain a écrit : Hi, I’m not convinced the new syntax: ones(n, m, “boolean”) is a good idea or is necessary because it makes “integer” (“constant”) and “boolean” 2 identical types. Sorry Alain can you explain it f

Re: [Scilab-users] Generating a boolean vector or matrix

2019-09-05 Thread stephane . mottelet
When I say ineficient, I mean that kind of behavior: --> tic;repmat(uint8(0),1,1);toc  ans  =    1.622535 compared to proposed implementation: --> tic;a=zeros(1,1,"uint8");toc  ans  =    0.063472 S. Quoting Stéphane Mottelet : Le 05/09/2019 à 08:55, Lamy Alain a écrit :

Re: [Scilab-users] Generating a boolean vector or matrix

2019-09-05 Thread CHEZE David 227480
+1 interested in this patch De : users De la part de Stéphane Mottelet Envoyé : jeudi 5 septembre 2019 08:46 À : users@lists.scilab.org Objet : Re: [Scilab-users] Generating a boolean vector or matrix Le 04/09/2019 à 20:19, Federico Miyara a écrit : Stéphane, Questions: 1) Why does it work

Re: [Scilab-users] Generating a boolean vector or matrix

2019-09-05 Thread Lamy Alain
What I didn’t like at first is to use “ones” for a boolean type. (although I know the 2 types are almost interchangeable in Scilab). The existing function bool2s changes %t into 1. So thinking about it a little more, OK for the proposed extensions of “ones” and “zeros”. Alain ___

Re: [Scilab-users] Generating a boolean vector or matrix

2019-09-05 Thread Antoine Monmayrant
Le 05/09/2019 à 11:28, Lamy Alain a écrit : What I didn’t like at first is to use “ones” for a boolean type. That was also my first reaction. When comparing the learning curve and overall ease of use of scilab with other options (matlab, julia, python), I always come to the conclusion that

Re: [Scilab-users] Generating a boolean vector or matrix

2019-09-05 Thread Stéphane Mottelet
Le 05/09/2019 à 12:44, Antoine Monmayrant a écrit : Le 05/09/2019 à 11:28, Lamy Alain a écrit : What I didn’t like at first is to use “ones” for a boolean type. That was also my first reaction. When comparing the learning curve and overall ease of use of scilab with other options (matlab,

Re: [Scilab-users] Generating a boolean vector or matrix

2019-09-13 Thread Samuel Gougeon
Le 04/09/2019 à 09:11, Federico Miyara a écrit : Dear all, I need to create a boolean vector, such as [%t, %t, %t, %t] but with a number of components given by a variable n. I couldn't find a function similar to ones(1,n). However I've found a workaround: a = ones(1,n) & %t It shouldn't w

Re: [Scilab-users] Generating a boolean vector or matrix

2019-09-13 Thread Stéphane Mottelet
Le 13/09/2019 à 15:04, Samuel Gougeon a écrit : Le 04/09/2019 à 09:11, Federico Miyara a écrit : Dear all, I need to create a boolean vector, such as [%t, %t, %t, %t] but with a number of components given by a variable n. I couldn't find a function similar to ones(1,n). However I've found

Re: [Scilab-users] Generating a boolean vector or matrix

2019-09-13 Thread Samuel Gougeon
Le 13/09/2019 à 15:32, Stéphane Mottelet a écrit : .../... I am neither very convinced by the ones(m,n,.,"boolean") and zeros(m,n,.. "boolean") proposal, for the same reason initially exposed by Alain. But why not. In the same commit, Stéphane proposes to allow using the *"logical"* keyword

Re: [Scilab-users] Generating a boolean vector or matrix

2019-09-13 Thread Samuel Gougeon
Le 13/09/2019 à 15:32, Stéphane Mottelet a écrit : .../... OK Samuel, I can forget this one. However, "double" should be kept as an equivalent of "constant", even if not the name of a scilab type returned by typeof(). We already have the macro "double()" (instead of "constant()") and the keywo

Re: [Scilab-users] Generating a boolean vector or matrix

2019-09-13 Thread Stéphane Mottelet
Le 13/09/2019 à 16:17, Samuel Gougeon a écrit : Le 13/09/2019 à 15:32, Stéphane Mottelet a écrit : .../... OK Samuel, I can forget this one. However, "double" should be kept as an equivalent of "constant", even if not the name of a scilab type returned by typeof(). We already have the macro "

Re: [Scilab-users] Generating a boolean vector or matrix

2019-09-15 Thread Samuel Gougeon
Le 05/09/2019 à 12:44, Antoine Monmayrant a écrit : Le 05/09/2019 à 11:28, Lamy Alain a écrit : What I didn’t like at first is to use “ones” for a boolean type. That was also my first reaction. When comparing the learning curve and overall ease of use of scilab with other options (matlab, ju

Re: [Scilab-users] Generating a boolean vector or matrix

2019-09-17 Thread Federico Miyara
Stéphane, I hope no. These are typical -- IMO fake -- functions that i would not expect in Scilab (and in any other language). There are many trivial and fast ways to create a boolean array of given dimensions. true(m,n) may be fake if, as in other message has been clarified, boolean take