Ok! Thank you,
Emerson Em sexta-feira, 28 de novembro de 2014 16h06min10s UTC-2, Stefan Karpinski escreveu: > > Something is going on with the type inference of backslash, e.g. see > > (@code_typed rand(3,3)\rand(3))[1].args[3] > > But I can't figure out what. Issue filed: > https://github.com/JuliaLang/julia/issues/9191. > > On Fri, Nov 28, 2014 at 11:51 AM, Emerson Vitor Castelani < > [email protected] <javascript:>> wrote: > >> Hi Stefan. I am very grateful by your attention. Each variable typed >> correctly doesn't change the perfomance. Do you have other suggestion to me? >> >> Thanks, >> >> -Emerson >> >> Em quarta-feira, 26 de novembro de 2014 17h52min57s UTC-2, Stefan >> Karpinski escreveu: >>> >>> I wonder if \ might be type unstable. >>> >>> On Wed, Nov 26, 2014 at 2:49 PM, Stefan Karpinski <[email protected]> >>> wrote: >>> >>>> It turns out that doesn't actually matter but there are other unrelated >>>> ill-typed variables in the code: >>>> >>>> Xb, o, y, r, e, Nj, ind, q, t >>>> >>>> >>>> I haven't determined why this is happening, but something is ill-typed >>>> here. >>>> >>>> On Wed, Nov 26, 2014 at 1:20 PM, Tim Holy <[email protected]> wrote: >>>> >>>>> Stefan's point is more relevant than you realize; if the type of the >>>>> variable >>>>> is uncertain, the loop will be very slow. You can make that resize >>>>> operation a >>>>> separate function, from which you call your main routine. >>>>> >>>>> --Tim >>>>> >>>>> On Wednesday, November 26, 2014 09:26:35 AM Emerson Vitor Castelani >>>>> wrote: >>>>> > Humm, It's useful but I guess that the problem is something in loop >>>>> while... >>>>> > >>>>> > Em quarta-feira, 26 de novembro de 2014 15h05min03s UTC-2, Stefan >>>>> Karpinski >>>>> > >>>>> > escreveu: >>>>> > > I'm not sure if this is the problem, but changing the type of a >>>>> variable >>>>> > > in a function body causes problems for type inference. For that >>>>> reason, >>>>> > > the >>>>> > > first two lines of this code may cause performance issue if you >>>>> call this >>>>> > > with b and c as matrices. A more Julian idiom for this is to do >>>>> something >>>>> > > like this: >>>>> > > >>>>> > > function simplex(A::Matrix, b::Vector, c::Vector) >>>>> > > >>>>> > > (m,n) = size(A); >>>>> > > ... >>>>> > > >>>>> > > end >>>>> > > simplex(A::Matrix, b::Matrix, c::Matrix) = simplex(A, vec(b), >>>>> vec(c)) >>>>> > > >>>>> > > >>>>> > > This also avoids copying the data of b and c needlessly. >>>>> > > >>>>> > > On Wednesday, November 26, 2014, Emerson Vitor Castelani < >>>>> > > >>>>> > > [email protected] <javascript:>> wrote: >>>>> > >> Have you considered the example scsd8.mat? >>>>> > >> >>>>> > >> Em quarta-feira, 26 de novembro de 2014 14h39min14s UTC-2, Pileas >>>>> > >> >>>>> > >> escreveu: >>>>> > >>> Result with tic() toc() at the very beginning and at the very >>>>> end: >>>>> > >>> >>>>> > >>> elapsed time: 0.025719973 seconds >>>>> > >>> >>>>> > >>> >>>>> > >>> Τη Τετάρτη, 26 Νοεμβρίου 2014 11:06:26 π.μ. UTC-5, ο χρήστης >>>>> Emerson >>>>> > >>> >>>>> > >>> Vitor Castelani έγραψε: >>>>> > >>>> Well, I am tried to implement a simple version of simplex in >>>>> Julia and >>>>> > >>>> I have had some troubles. In Julia, my algorithm spends about >>>>> 30 sec >>>>> > >>>> and in >>>>> > >>>> matlab/octave 3 sec for the same problem. So, I saw some tips >>>>> in order >>>>> > >>>> to >>>>> > >>>> get a better performance but the best that I got in Julia was >>>>> 17-20 >>>>> > >>>> sec. >>>>> > >>>> The codes are in attachment. I am new in Julia and the >>>>> algorithms are >>>>> > >>>> little roughly implemented but they are very similar. >>>>> > >>>> >>>>> > >>>> Thanks >>>>> >>>>> >>>> >>> >
