[Scilab-users] More rapid calculation
Stéphane Mottelet
stephane.mottelet at utc.fr
Thu Feb 15 11:45:07 CET 2018
Le 15/02/2018 à 00:02, fujimoto2005 a écrit :
> Sorry, my code contains line "exec user file "
> I attached revised version which contains the line as a user function.
> Please see it.
>
> Best regards
>
> corSmplebaseZ1andZ2_with_UserFunc.sce
> <http://mailinglists.scilab.org/file/t497065/corSmplebaseZ1andZ2_with_UserFunc.sce>
>
>
>
> --
> Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
Hello,
In your code, most of the cpu time is spent between lines 40-54 (random
generation of big matrices), then between lines 54-60, where one of the
bottlenecks is the use of repmat (and you use it twice) and the
"cumsum".In previous posts of Heinz Nabielek related to code
optimization, you may have noticed that using matrix multiplication by a
vector of ones gives the same result BUT uses the BLAS ! For example,
compare these timings, with size(timePoints_V)=[1 25000] and sample=5000) :
tic;repmat(timePoints_V,2*sample,1);disp(toc())
12.372273
tic;ones(2*sample,1)*timePoints_V;disp(toc())
1.823105
On my machine (MacPro, OSX, Scilab 6.0.0), this last piece of code uses
100% cpu (four cores).
S.
--
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