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

Stéphane Mottelet stephane.mottelet at utc.fr
Wed Jan 31 11:30:23 CET 2018


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 <stephane.mottelet at utc.fr> 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-bounces at 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 at 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 at lists.scilab.org
>> http://lists.scilab.org/mailman/listinfo/users
>>
> _______________________________________________
> users mailing list
> users at 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




More information about the users mailing list