Re: [Scilab-users] {EXT} need a more efficient and faster code: suggestions welcome

2018-01-31 Thread Rafael Guerra
Hi Heinz,

Find herein a vectorised memory hog solution for Scilab 6, which is fast (~30 s 
for 20K points on Win7 laptop):

// START OF CODE (Scilab 6)
Clear
n=2;
r=23;
radius = r*grand(n,1,'def').^(1/3);
phi = 2*%pi*grand(n,1, 'def');
costheta = 1 - 2*grand(n,1, 'def');
radsintheta = radius.*sin(acos(costheta));
X = [radsintheta.*cos(phi), radsintheta.*sin(phi), radius.*costheta];
tic;
X2 = sum(X.*X, 'c');
X3 = X2.*.ones(n,1)';
X3 = X3 + X3';
D = abs(X3 - 2*(X*X'))';
D(1:n+1:$) = [];  // remove diagonal 0's
D = matrix(D,n-1,n); // reshape D to (n-1) x n size
MinDist1 = sqrt(min(D,'r'));
t1=toc();
disp(t1)
jj=-0.05:0.1:3.05;
H1 = histc(jj,MinDist1);
disp([0.05+jj(1:$-1)' H1']);
// END OF CODE

Regards,
Rafael

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] GUI programming

2018-01-31 Thread philippe
Hi

Le 24/01/2018 à 19:49, Claus Futtrup a écrit :
> Hi Scilabers
> 
> Is there a comprehensive manual or book (in English, or alt German)
> about programming GUI in Scilab? (or a comprehensive web-page)

programming GUI in scilab relies on a good comprehension of graphics
handles. The 4th chapter of my book is dedicated to graphics and contain
few pages about GUI conception (part 23.4  pages 338 to 353)  :

https://www.d-booker.fr/scilab-book1/325-scilab-fundamentals.html

You can find a simple example (with call-back inside)  detailed :

https://www.youtube.com/watch?v=zRXr22VZNJM

It's sufficient to understand the basis of GUI.
> I think that what I need is not just examples. I need explanations, and
> preferably something coherent that I can combine and work with, into
> something that works.

That was the aim of my book : giving simple examples with detailed
explanations, well ordered so that you can learn scilab with more
efficiency than jumping from one help page to another.

Philippe

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] {EXT} need a more efficient and faster code: suggestions welcome

2018-01-31 Thread Heinz
On my puny 250 Euro Win10 travel-laptop, I have achieved 66 tictocs for 20,000 
random points with your code [not that I would understand it] in Scilab 5.5.2 
and that is phenomenal and opens up new simulation possibilities.

Thanks so much
Heinz

-Original Message-
From: users [mailto:users-boun...@lists.scilab.org] On Behalf Of Stéphane 
Mottelet
Sent: 31 January 2018 16:12
To: users@lists.scilab.org
Subject: Re: [Scilab-users] {EXT} need a more efficient and faster code: 
suggestions welcome

Dear Heinz,

Here is what can be done in Scilab-5.5.2 to accelerate your computations on a 
multi-core architecture under Linux :

function out=distances(X)
 function out=distance(k)
 this=X(k,:);XX=X;XX(k,:)=[];
 DIFF=XX-ONE*this;
 out=sqrt(min((DIFF.*DIFF)*[1;1;1]));
 endfunction
 n=size(X,1);
 ONE=ones(n-1,1);
 out=parallel_run(1:n,distance);
endfunction

n=4;
r=23;
radius = r*grand(n,1,'def').^(1/3);
phi = 2*%pi*grand(n,1, 'def');
costheta = 1 - 2*grand(n,1, 'def');
radsintheta = radius.*sin(acos(costheta)); X = 
[radsintheta.*cos(phi),radsintheta.*sin(phi), radius.*costheta];

On a modest server (two 10-core/20-threads Intel(R) Xeon(R) CPU E5-2660
v2 @ 2.20GHz = 40 threads),

-->tic;distances(X);toc
  ans  =

 13.063

On a smarter server (sixteen 6-core/6-threads Intel(R) Xeon(R) CPU X7542 @ 
2.67GHz = 96 threads)

-->tic;d=distances(X);toc
  ans  =

 2.498

I hope that parallel_run will be available again in the next version of scilab.

S.

Le 31/01/2018 à 10:53, Stéphane Mottelet a écrit :
> Replacing
>
> MinDist=[MinDist sqrt(min(sum(DIFF.^2,2)))];
>
> by
>
> MinDist=[MinDist sqrt(min(sum(DIFF.*DIFF,2)))];
>
> will be at least twice faster. Crunching elapsed time could be done by 
> using parallel_run (with 5.5.2 version) if you have a multi-core 
> processor.
>
> S.
>
> Le 31/01/2018 à 09:36, Dang Ngoc Chan, Christophe a écrit :
>> Hello,
>>
>> The following suggestions will probably not have a drastic influence 
>> (I don't see how it could be more vectorised) but his a little thing 
>> I see:
>>
>>> De : users [mailto:users-boun...@lists.scilab.org] De la part de 
>>> Heinz Nabielek Envoyé : mercredi 31 janvier 2018 00:13
>>>
>>> MinDist=[MinDist sqrt(min(sum(DIFF.^2,2)))];
>> Maybe you could concatenate the squares of the distance and then 
>> compute the square root of the whole vector in the end:
>>
>> sqMinDist=[sqMinDist min(sum(DIFF.^2,2))];
>>
>> …
>>
>> end
>>
>> …
>>
>> MinDist = sqrt(sqMinDist)
>>
>> Hope this helps,
>>
>> Regards
>>
>> --
>> Christophe Dang Ngoc Chan
>> Mechanical calculation engineer
>> This e-mail may contain confidential and/or privileged information. 
>> If you are not the intended recipient (or have received this e-mail 
>> in error), please notify the sender immediately and destroy this 
>> e-mail. Any unauthorized copying, disclosure or distribution of the 
>> material in this e-mail is strictly forbidden.
>> ___
>> users mailing list
>> users@lists.scilab.org
>> http://lists.scilab.org/mailman/listinfo/users
>
>

--
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable Département Génie 
des Procédés Industriels Sorbonne Universités - Université de Technologie de 
Compiègne CS 60319, 60203 Compiègne cedex Tel : +33(0)344234688 
http://www.utc.fr/~mottelet

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] {EXT} need a more efficient and faster code: suggestions welcome

2018-01-31 Thread stephane . mottelet

 Hello,

Don't even think about using parallel_run under OSX. It used to work  
(with some tweaking) with scilab-5.5.1 under Mavericks, but since  
5.5.2 version, it has become completely unstable.


S.

Heinz  a écrit :


My latest tictoc is 366: would that be 6.1 minutes?
I am away from my 2 iMacs at home and running Scilab on a lowly  
Intel Pentium CPU N3540 @ 2.16GHz Win10 laptop. Your "2.498" for  
40,000 points are phenomenal regarding the fact that the running  
time increases with the square of the number of points.


The later iMac has a Quad-Core-i7 at 3.2 GHz: can I run your code  
version there under the older Scilab? Not that I understand how  
parallel processing works...

Heinz

-Original Message-
From: users [mailto:users-boun...@lists.scilab.org] On Behalf Of  
Stéphane Mottelet

Sent: 31 January 2018 16:12
To: users@lists.scilab.org
Subject: Re: [Scilab-users] {EXT} need a more efficient and faster  
code: suggestions welcome


Dear Heinz,

Here is what can be done in Scilab-5.5.2 to accelerate your  
computations on a multi-core architecture under Linux :


function out=distances(X)
    function out=distance(k)
        this=X(k,:);XX=X;XX(k,:)=[];
        DIFF=XX-ONE*this;
        out=sqrt(min((DIFF.*DIFF)*[1;1;1]));
    endfunction
    n=size(X,1);
    ONE=ones(n-1,1);
    out=parallel_run(1:n,distance);
endfunction

n=4;
r=23;
radius = r*grand(n,1,'def').^(1/3);
phi = 2*%pi*grand(n,1, 'def');
costheta = 1 - 2*grand(n,1, 'def');
radsintheta = radius.*sin(acos(costheta)); X =  
[radsintheta.*cos(phi),radsintheta.*sin(phi), radius.*costheta];


On a modest server (two 10-core/20-threads Intel(R) Xeon(R) CPU E5-2660
v2 @ 2.20GHz = 40 threads),

-->tic;distances(X);toc
ans  =

    13.063

On a smarter server (sixteen 6-core/6-threads Intel(R) Xeon(R) CPU  
X7542 @ 2.67GHz = 96 threads)


-->tic;d=distances(X);toc
ans  =

    2.498

I hope that parallel_run will be available again in the next version  
of scilab.


S.

Le 31/01/2018 à 10:53, Stéphane Mottelet a écrit :

Replacing

    MinDist=[MinDist sqrt(min(sum(DIFF.^2,2)))];

by

    MinDist=[MinDist sqrt(min(sum(DIFF.*DIFF,2)))];

will be at least twice faster. Crunching elapsed time could be done by
using parallel_run (with 5.5.2 version) if you have a multi-core
processor.

S.

Le 31/01/2018 à 09:36, Dang Ngoc Chan, Christophe a écrit :

Hello,

The following suggestions will probably not have a drastic influence
(I don't see how it could be more vectorised) but his a little thing
I see:


De : users [mailto:users-boun...@lists.scilab.org] De la part de
Heinz Nabielek Envoyé : mercredi 31 janvier 2018 00:13

    MinDist=[MinDist sqrt(min(sum(DIFF.^2,2)))];


Maybe you could concatenate the squares of the distance and then
compute the square root of the whole vector in the end:

sqMinDist=[sqMinDist min(sum(DIFF.^2,2))];

…

end

…

MinDist = sqrt(sqMinDist)

Hope this helps,

Regards

--
Christophe Dang Ngoc Chan
Mechanical calculation engineer
This e-mail may contain confidential and/or privileged information.
If you are not the intended recipient (or have received this e-mail
in error), please notify the sender immediately and destroy this
e-mail. Any unauthorized copying, disclosure or distribution of the
material in this e-mail is strictly forbidden.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


--
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable  
Département Génie des Procédés Industriels Sorbonne Universités -  
Université de Technologie de Compiègne CS 60319, 60203 Compiègne  
cedex Tel : +33(0)344234688 http://www.utc.fr/~mottelet


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users

___
users mailing list
users@lists.scilab.orghttp://lists.scilab.org/mailman/listinfo/users
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] {EXT} need a more efficient and faster code: suggestions welcome

2018-01-31 Thread Heinz
My latest tictoc is 366: would that be 6.1 minutes?
I am away from my 2 iMacs at home and running Scilab on a lowly Intel Pentium 
CPU N3540 @ 2.16GHz Win10 laptop. Your "2.498" for 40,000 points are phenomenal 
regarding the fact that the running time increases with the square of the 
number of points.

The later iMac has a Quad-Core-i7 at 3.2 GHz: can I run your code version there 
under the older Scilab? Not that I understand how parallel processing works...
Heinz

-Original Message-
From: users [mailto:users-boun...@lists.scilab.org] On Behalf Of Stéphane 
Mottelet
Sent: 31 January 2018 16:12
To: users@lists.scilab.org
Subject: Re: [Scilab-users] {EXT} need a more efficient and faster code: 
suggestions welcome

Dear Heinz,

Here is what can be done in Scilab-5.5.2 to accelerate your computations on a 
multi-core architecture under Linux :

function out=distances(X)
 function out=distance(k)
 this=X(k,:);XX=X;XX(k,:)=[];
 DIFF=XX-ONE*this;
 out=sqrt(min((DIFF.*DIFF)*[1;1;1]));
 endfunction
 n=size(X,1);
 ONE=ones(n-1,1);
 out=parallel_run(1:n,distance);
endfunction

n=4;
r=23;
radius = r*grand(n,1,'def').^(1/3);
phi = 2*%pi*grand(n,1, 'def');
costheta = 1 - 2*grand(n,1, 'def');
radsintheta = radius.*sin(acos(costheta)); X = 
[radsintheta.*cos(phi),radsintheta.*sin(phi), radius.*costheta];

On a modest server (two 10-core/20-threads Intel(R) Xeon(R) CPU E5-2660
v2 @ 2.20GHz = 40 threads),

-->tic;distances(X);toc
  ans  =

 13.063

On a smarter server (sixteen 6-core/6-threads Intel(R) Xeon(R) CPU X7542 @ 
2.67GHz = 96 threads)

-->tic;d=distances(X);toc
  ans  =

 2.498

I hope that parallel_run will be available again in the next version of scilab.

S.

Le 31/01/2018 à 10:53, Stéphane Mottelet a écrit :
> Replacing
>
> MinDist=[MinDist sqrt(min(sum(DIFF.^2,2)))];
>
> by
>
> MinDist=[MinDist sqrt(min(sum(DIFF.*DIFF,2)))];
>
> will be at least twice faster. Crunching elapsed time could be done by 
> using parallel_run (with 5.5.2 version) if you have a multi-core 
> processor.
>
> S.
>
> Le 31/01/2018 à 09:36, Dang Ngoc Chan, Christophe a écrit :
>> Hello,
>>
>> The following suggestions will probably not have a drastic influence 
>> (I don't see how it could be more vectorised) but his a little thing 
>> I see:
>>
>>> De : users [mailto:users-boun...@lists.scilab.org] De la part de 
>>> Heinz Nabielek Envoyé : mercredi 31 janvier 2018 00:13
>>>
>>> MinDist=[MinDist sqrt(min(sum(DIFF.^2,2)))];
>> Maybe you could concatenate the squares of the distance and then 
>> compute the square root of the whole vector in the end:
>>
>> sqMinDist=[sqMinDist min(sum(DIFF.^2,2))];
>>
>> …
>>
>> end
>>
>> …
>>
>> MinDist = sqrt(sqMinDist)
>>
>> Hope this helps,
>>
>> Regards
>>
>> --
>> Christophe Dang Ngoc Chan
>> Mechanical calculation engineer
>> This e-mail may contain confidential and/or privileged information. 
>> If you are not the intended recipient (or have received this e-mail 
>> in error), please notify the sender immediately and destroy this 
>> e-mail. Any unauthorized copying, disclosure or distribution of the 
>> material in this e-mail is strictly forbidden.
>> ___
>> users mailing list
>> users@lists.scilab.org
>> http://lists.scilab.org/mailman/listinfo/users
>
>

--
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable Département Génie 
des Procédés Industriels Sorbonne Universités - Université de Technologie de 
Compiègne CS 60319, 60203 Compiègne cedex Tel : +33(0)344234688 
http://www.utc.fr/~mottelet

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] {EXT} need a more efficient and faster code: suggestions welcome

2018-01-31 Thread Stéphane Mottelet

Dear Heinz,

Here is what can be done in Scilab-5.5.2 to accelerate your computations 
on a multi-core architecture under Linux :


function out=distances(X)
    function out=distance(k)
    this=X(k,:);XX=X;XX(k,:)=[];
    DIFF=XX-ONE*this;
    out=sqrt(min((DIFF.*DIFF)*[1;1;1]));
    endfunction
    n=size(X,1);
    ONE=ones(n-1,1);
    out=parallel_run(1:n,distance);
endfunction

n=4;
r=23;
radius = r*grand(n,1,'def').^(1/3);
phi = 2*%pi*grand(n,1, 'def');
costheta = 1 - 2*grand(n,1, 'def');
radsintheta = radius.*sin(acos(costheta));
X = [radsintheta.*cos(phi),radsintheta.*sin(phi), radius.*costheta];

On a modest server (two 10-core/20-threads Intel(R) Xeon(R) CPU E5-2660 
v2 @ 2.20GHz = 40 threads),


-->tic;distances(X);toc
 ans  =

    13.063

On a smarter server (sixteen 6-core/6-threads Intel(R) Xeon(R) CPU X7542 
@ 2.67GHz = 96 threads)


-->tic;d=distances(X);toc
 ans  =

    2.498

I hope that parallel_run will be available again in the next version of 
scilab.


S.

Le 31/01/2018 à 10:53, Stéphane Mottelet a écrit :

Replacing

    MinDist=[MinDist sqrt(min(sum(DIFF.^2,2)))];

by

    MinDist=[MinDist sqrt(min(sum(DIFF.*DIFF,2)))];

will be at least twice faster. Crunching elapsed time could be done by 
using parallel_run (with 5.5.2 version) if you have a multi-core 
processor.


S.

Le 31/01/2018 à 09:36, Dang Ngoc Chan, Christophe a écrit :

Hello,

The following suggestions will probably not have a drastic influence
(I don't see how it could be more vectorised)
but his a little thing I see:

De : users [mailto:users-boun...@lists.scilab.org] De la part de 
Heinz Nabielek

Envoyé : mercredi 31 janvier 2018 00:13

    MinDist=[MinDist sqrt(min(sum(DIFF.^2,2)))];

Maybe you could concatenate the squares of the distance
and then compute the square root of the whole vector in the end:

sqMinDist=[sqMinDist min(sum(DIFF.^2,2))];

…

end

…

MinDist = sqrt(sqMinDist)

Hope this helps,

Regards

--
Christophe Dang Ngoc Chan
Mechanical calculation engineer
This e-mail may contain confidential and/or privileged information. 
If you are not the intended recipient (or have received this e-mail 
in error), please notify the sender immediately and destroy this 
e-mail. Any unauthorized copying, disclosure or distribution of the 
material in this e-mail is strictly forbidden.

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users





--
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Stacked 2D plot in 3D

2018-01-31 Thread Jean-Philippe Grivet

Hi Claus, Rafeal and Samuel,

Here is another method for stacked plots, which was suggested to me 
years ago by Serge Steer.

I used it succssfully for about 12 individual curves.

Cheers,
JP Grivet



Le 28/01/2018 20:19, Claus Futtrup a écrit :

Hi Rafael and Samuel

Thank you both for great suggestions - and as I thought - I was on the 
wrong path. Indeed I looked at plot3d3 and didn't catch that this one 
is suitable for what I wish to do. I see clearly with the example by 
Samuel that it is quite a smart way. I initially made the mistake to 
feed vectors (frequencies + angles), and it complained (and it 
revealed, it seems, that plot3d3 is based on param3d1). I see it needs 
matrices. The example by Rafael made that clear to me. Thanks Rafael 
for a very good example to work with.


Best regards,
Claus

On Sun, Jan 28, 2018 at 5:24 PM, Rafael Guerra 
> wrote:


Hi Samuel,

Absolutely, the two param3d functions should be merged.

The vectorised assignment example should also be included in the
helpfile.

Regards,
Rafael

-Original Message-
From: users [mailto:users-boun...@lists.scilab.org
] On Behalf Of Samuel Gougeon
Sent: Sunday, January 28, 2018 5:17 PM
To: Users mailing list for Scilab >
Subject: Re: [Scilab-users] Stacked 2D plot in 3D

Hello Rafael,

About param3d() and param3d1():
In 3 days, it will be the 10th birthday of this report:
http://bugzilla.scilab.org/6155 
Shall we make a present to other users? :) By the way, beyond
their pages, don't you think the functions themselves should be
merged?

Le 28/01/2018 à 16:39, Rafael Guerra a écrit :
> .../...
> for i=1:nf;
>  e.children(i).foreground = color('dark blue');
>  e.children(i).thickness = 2;
> end

Or more simply:

e.children.foreground = color('dark blue'); e.children.thickness = 2;

This kind of vectorized assignment (almost always) works.

Cheers
Samuel

___
users mailing list
users@lists.scilab.org 
http://lists.scilab.org/mailman/listinfo/users

___
users mailing list
users@lists.scilab.org 
http://lists.scilab.org/mailman/listinfo/users





___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users




---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel 
antivirus Avast.
https://www.avast.com/antivirus
x=linspace(-10,10,500);
clf;ax=gca();
ax.axes_visible='on';
xmin=-10;
xmax=+10;
ymin=-1;
ymax=2
ax.data_bounds=[xmin,ymin;xmax ymax];
yshift=0.2;
drawlater
for xshift=5:-0.4:-5
  xfpoly([xmin x xmax],[ymin yshift+sinc(x+xshift) ymin],1)
  e=gce();e.background=-2;
  yshift=yshift-0.02;
end
drawnow()
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] ?==?utf-8?q? ?==?utf-8?q? ?= {EXT} need a more efficient and faster code: suggestions welcom

2018-01-31 Thread Antoine Monmayrant
Argh, OK, I get it: scilab treats A.^2 exactly like A.^%pi and not like "square 
it".
Makes sense, thank you for the info.
I wonder how julia is performing with respect to A.^2 compared to A.*A...

Antoine
 
 
Le Mercredi, Janvier 31, 2018 11:30 CET, Stéphane Mottelet 
 a écrit: 
 
> I am an old school guy and have learned scientific computing with 
> Fortran... Using mutiplication instead of power elevation is an old 
> trick which should not be necessary with a more clever interpreter 
> (which should detect that 2 is actually a (small) integer and use 
> multiplication instead)
> 
> S.
> 
> Le 31/01/2018 à 11:22, Antoine Monmayrant a écrit :
> > Hello Stéphane,
> >
> > Sorry to hijack the discussion but I didn't know that there was such a 
> > difference between A.*A and A.^2.
> > Could you tell us more about it?
> > Why is is twice faster to use the A.*A form?
> > Is this documented somewhere?
> >
> > Cheers,
> >
> > Antoine
> >   
> >   
> > Le Mercredi, Janvier 31, 2018 10:53 CET, Stéphane Mottelet 
> >  a écrit:
> >   
> >> Replacing
> >>
> >>       MinDist=[MinDist sqrt(min(sum(DIFF.^2,2)))];
> >>
> >> by
> >>
> >>       MinDist=[MinDist sqrt(min(sum(DIFF.*DIFF,2)))];
> >>
> >> will be at least twice faster. Crunching elapsed time could be done by
> >> using parallel_run (with 5.5.2 version) if you have a multi-core processor.
> >>
> >> S.
> >>
> >> Le 31/01/2018 à 09:36, Dang Ngoc Chan, Christophe a écrit :
> >>> Hello,
> >>>
> >>> The following suggestions will probably not have a drastic influence
> >>> (I don't see how it could be more vectorised)
> >>> but his a little thing I see:
> >>>
>  De : users [mailto:users-boun...@lists.scilab.org] De la part de Heinz 
>  Nabielek
>  Envoyé : mercredi 31 janvier 2018 00:13
> 
>   MinDist=[MinDist sqrt(min(sum(DIFF.^2,2)))];
> >>> Maybe you could concatenate the squares of the distance
> >>> and then compute the square root of the whole vector in the end:
> >>>
> >>> sqMinDist=[sqMinDist min(sum(DIFF.^2,2))];
> >>>
> >>> …
> >>>
> >>> end
> >>>
> >>> …
> >>>
> >>> MinDist = sqrt(sqMinDist)
> >>>
> >>> Hope this helps,
> >>>
> >>> Regards
> >>>
> >>> --
> >>> Christophe Dang Ngoc Chan
> >>> Mechanical calculation engineer
> >>> This e-mail may contain confidential and/or privileged information. If 
> >>> you are not the intended recipient (or have received this e-mail in 
> >>> error), please notify the sender immediately and destroy this e-mail. Any 
> >>> unauthorized copying, disclosure or distribution of the material in this 
> >>> e-mail is strictly forbidden.
> >>> ___
> >>> users mailing list
> >>> users@lists.scilab.org
> >>> http://lists.scilab.org/mailman/listinfo/users
> >>
> >> -- 
> >> Stéphane Mottelet
> >> Ingénieur de recherche
> >> EA 4297 Transformations Intégrées de la Matière Renouvelable
> >> Département Génie des Procédés Industriels
> >> Sorbonne Universités - Université de Technologie de Compiègne
> >> CS 60319, 60203 Compiègne cedex
> >> Tel : +33(0)344234688
> >> http://www.utc.fr/~mottelet
> >>
> >> ___
> >> users mailing list
> >> users@lists.scilab.org
> >> http://lists.scilab.org/mailman/listinfo/users
> >>
> > ___
> > users mailing list
> > users@lists.scilab.org
> > http://lists.scilab.org/mailman/listinfo/users
> 
> 
> -- 
> Stéphane Mottelet
> Ingénieur de recherche
> EA 4297 Transformations Intégrées de la Matière Renouvelable
> Département Génie des Procédés Industriels
> Sorbonne Universités - Université de Technologie de Compiègne
> CS 60319, 60203 Compiègne cedex
> Tel : +33(0)344234688
> http://www.utc.fr/~mottelet
> 
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] ?==?utf-8?q? {EXT} need a more efficient and faster code: suggestions welcome

2018-01-31 Thread Stéphane Mottelet
I am an old school guy and have learned scientific computing with 
Fortran... Using mutiplication instead of power elevation is an old 
trick which should not be necessary with a more clever interpreter 
(which should detect that 2 is actually a (small) integer and use 
multiplication instead)


S.

Le 31/01/2018 à 11:22, Antoine Monmayrant a écrit :

Hello Stéphane,

Sorry to hijack the discussion but I didn't know that there was such a 
difference between A.*A and A.^2.
Could you tell us more about it?
Why is is twice faster to use the A.*A form?
Is this documented somewhere?

Cheers,

Antoine
  
  
Le Mercredi, Janvier 31, 2018 10:53 CET, Stéphane Mottelet  a écrit:
  

Replacing

      MinDist=[MinDist sqrt(min(sum(DIFF.^2,2)))];

by

      MinDist=[MinDist sqrt(min(sum(DIFF.*DIFF,2)))];

will be at least twice faster. Crunching elapsed time could be done by
using parallel_run (with 5.5.2 version) if you have a multi-core processor.

S.

Le 31/01/2018 à 09:36, Dang Ngoc Chan, Christophe a écrit :

Hello,

The following suggestions will probably not have a drastic influence
(I don't see how it could be more vectorised)
but his a little thing I see:


De : users [mailto:users-boun...@lists.scilab.org] De la part de Heinz Nabielek
Envoyé : mercredi 31 janvier 2018 00:13

 MinDist=[MinDist sqrt(min(sum(DIFF.^2,2)))];

Maybe you could concatenate the squares of the distance
and then compute the square root of the whole vector in the end:

sqMinDist=[sqMinDist min(sum(DIFF.^2,2))];

…

end

…

MinDist = sqrt(sqMinDist)

Hope this helps,

Regards

--
Christophe Dang Ngoc Chan
Mechanical calculation engineer
This e-mail may contain confidential and/or privileged information. If you are 
not the intended recipient (or have received this e-mail in error), please 
notify the sender immediately and destroy this e-mail. Any unauthorized 
copying, disclosure or distribution of the material in this e-mail is strictly 
forbidden.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


--
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users



--
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] ?==?utf-8?q? {EXT} need a more efficient and faster code: suggestions welcome

2018-01-31 Thread Antoine Monmayrant
Hello Stéphane,

Sorry to hijack the discussion but I didn't know that there was such a 
difference between A.*A and A.^2.
Could you tell us more about it?
Why is is twice faster to use the A.*A form?
Is this documented somewhere?

Cheers,

Antoine 
 
 
Le Mercredi, Janvier 31, 2018 10:53 CET, Stéphane Mottelet 
 a écrit: 
 
> Replacing
> 
>      MinDist=[MinDist sqrt(min(sum(DIFF.^2,2)))];
> 
> by
> 
>      MinDist=[MinDist sqrt(min(sum(DIFF.*DIFF,2)))];
> 
> will be at least twice faster. Crunching elapsed time could be done by 
> using parallel_run (with 5.5.2 version) if you have a multi-core processor.
> 
> S.
> 
> Le 31/01/2018 à 09:36, Dang Ngoc Chan, Christophe a écrit :
> > Hello,
> >
> > The following suggestions will probably not have a drastic influence
> > (I don't see how it could be more vectorised)
> > but his a little thing I see:
> >
> >> De : users [mailto:users-boun...@lists.scilab.org] De la part de Heinz 
> >> Nabielek
> >> Envoyé : mercredi 31 janvier 2018 00:13
> >>
> >> MinDist=[MinDist sqrt(min(sum(DIFF.^2,2)))];
> > Maybe you could concatenate the squares of the distance
> > and then compute the square root of the whole vector in the end:
> >
> > sqMinDist=[sqMinDist min(sum(DIFF.^2,2))];
> >
> > …
> >
> > end
> >
> > …
> >
> > MinDist = sqrt(sqMinDist)
> >
> > Hope this helps,
> >
> > Regards
> >
> > --
> > Christophe Dang Ngoc Chan
> > Mechanical calculation engineer
> > This e-mail may contain confidential and/or privileged information. If you 
> > are not the intended recipient (or have received this e-mail in error), 
> > please notify the sender immediately and destroy this e-mail. Any 
> > unauthorized copying, disclosure or distribution of the material in this 
> > e-mail is strictly forbidden.
> > ___
> > users mailing list
> > users@lists.scilab.org
> > http://lists.scilab.org/mailman/listinfo/users
> 
> 
> -- 
> Stéphane Mottelet
> Ingénieur de recherche
> EA 4297 Transformations Intégrées de la Matière Renouvelable
> Département Génie des Procédés Industriels
> Sorbonne Universités - Université de Technologie de Compiègne
> CS 60319, 60203 Compiègne cedex
> Tel : +33(0)344234688
> http://www.utc.fr/~mottelet
> 
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] {EXT} need a more efficient and faster code: suggestions welcome

2018-01-31 Thread Stéphane Mottelet

moreover,

    MinDist=[MinDist sqrt(min((DIFF.*DIFF)*[1;1;1]))];

is even faster.

S.

Le 31/01/2018 à 10:53, Stéphane Mottelet a écrit :

Replacing

    MinDist=[MinDist sqrt(min(sum(DIFF.^2,2)))];

by

    MinDist=[MinDist sqrt(min(sum(DIFF.*DIFF,2)))];

will be at least twice faster. Crunching elapsed time could be done by 
using parallel_run (with 5.5.2 version) if you have a multi-core 
processor.


S.

Le 31/01/2018 à 09:36, Dang Ngoc Chan, Christophe a écrit :

Hello,

The following suggestions will probably not have a drastic influence
(I don't see how it could be more vectorised)
but his a little thing I see:

De : users [mailto:users-boun...@lists.scilab.org] De la part de 
Heinz Nabielek

Envoyé : mercredi 31 janvier 2018 00:13

    MinDist=[MinDist sqrt(min(sum(DIFF.^2,2)))];

Maybe you could concatenate the squares of the distance
and then compute the square root of the whole vector in the end:

sqMinDist=[sqMinDist min(sum(DIFF.^2,2))];

…

end

…

MinDist = sqrt(sqMinDist)

Hope this helps,

Regards

--
Christophe Dang Ngoc Chan
Mechanical calculation engineer
This e-mail may contain confidential and/or privileged information. 
If you are not the intended recipient (or have received this e-mail 
in error), please notify the sender immediately and destroy this 
e-mail. Any unauthorized copying, disclosure or distribution of the 
material in this e-mail is strictly forbidden.

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users





--
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] {EXT} need a more efficient and faster code: suggestions welcome

2018-01-31 Thread Stéphane Mottelet

Replacing

    MinDist=[MinDist sqrt(min(sum(DIFF.^2,2)))];

by

    MinDist=[MinDist sqrt(min(sum(DIFF.*DIFF,2)))];

will be at least twice faster. Crunching elapsed time could be done by 
using parallel_run (with 5.5.2 version) if you have a multi-core processor.


S.

Le 31/01/2018 à 09:36, Dang Ngoc Chan, Christophe a écrit :

Hello,

The following suggestions will probably not have a drastic influence
(I don't see how it could be more vectorised)
but his a little thing I see:


De : users [mailto:users-boun...@lists.scilab.org] De la part de Heinz Nabielek
Envoyé : mercredi 31 janvier 2018 00:13

MinDist=[MinDist sqrt(min(sum(DIFF.^2,2)))];

Maybe you could concatenate the squares of the distance
and then compute the square root of the whole vector in the end:

sqMinDist=[sqMinDist min(sum(DIFF.^2,2))];

…

end

…

MinDist = sqrt(sqMinDist)

Hope this helps,

Regards

--
Christophe Dang Ngoc Chan
Mechanical calculation engineer
This e-mail may contain confidential and/or privileged information. If you are 
not the intended recipient (or have received this e-mail in error), please 
notify the sender immediately and destroy this e-mail. Any unauthorized 
copying, disclosure or distribution of the material in this e-mail is strictly 
forbidden.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users



--
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] {EXT} need a more efficient and faster code: suggestions welcome

2018-01-31 Thread Heinz
Thanks Christophe- I should have thought of it myself...
I have difficulties handling the SciLab timer: how do you do this exactly?
Heinz

PS: Had you noticed that the resulting probability had been predicted by Prof 
Paul Hertz in Heidelberg, Mathematische Annalen, Vol 67 (1909), 387ff as early 
as 20 December 1908? My 'real' materials problem is much more complex, but this 
part shown here would determine the time consuming part.

-Original Message-
From: users [mailto:users-boun...@lists.scilab.org] On Behalf Of Dang Ngoc 
Chan, Christophe
Sent: 31 January 2018 09:36
To: Users mailing list for Scilab 
Subject: Re: [Scilab-users] {EXT} need a more efficient and faster code: 
suggestions welcome

Hello,

The following suggestions will probably not have a drastic influence (I don't 
see how it could be more vectorised) but his a little thing I see:

> De : users [mailto:users-boun...@lists.scilab.org] De la part de Heinz 
> Nabielek Envoyé : mercredi 31 janvier 2018 00:13
>
>MinDist=[MinDist sqrt(min(sum(DIFF.^2,2)))];

Maybe you could concatenate the squares of the distance and then compute the 
square root of the whole vector in the end:

sqMinDist=[sqMinDist min(sum(DIFF.^2,2))];

…

end

…

MinDist = sqrt(sqMinDist)

Hope this helps,

Regards

--
Christophe Dang Ngoc Chan
Mechanical calculation engineer
This e-mail may contain confidential and/or privileged information. If you are 
not the intended recipient (or have received this e-mail in error), please 
notify the sender immediately and destroy this e-mail. Any unauthorized 
copying, disclosure or distribution of the material in this e-mail is strictly 
forbidden.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] {EXT} need a more efficient and faster code: suggestions welcome

2018-01-31 Thread Dang Ngoc Chan, Christophe
Hello,

The following suggestions will probably not have a drastic influence
(I don't see how it could be more vectorised)
but his a little thing I see:

> De : users [mailto:users-boun...@lists.scilab.org] De la part de Heinz 
> Nabielek
> Envoyé : mercredi 31 janvier 2018 00:13
>
>MinDist=[MinDist sqrt(min(sum(DIFF.^2,2)))];

Maybe you could concatenate the squares of the distance
and then compute the square root of the whole vector in the end:

sqMinDist=[sqMinDist min(sum(DIFF.^2,2))];

…

end

…

MinDist = sqrt(sqMinDist)

Hope this helps,

Regards

--
Christophe Dang Ngoc Chan
Mechanical calculation engineer
This e-mail may contain confidential and/or privileged information. If you are 
not the intended recipient (or have received this e-mail in error), please 
notify the sender immediately and destroy this e-mail. Any unauthorized 
copying, disclosure or distribution of the material in this e-mail is strictly 
forbidden.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users