From: dave levine on 9 Feb 2010 13:47 "Oleg Komarov" <oleg.komarovRemove.this(a)hotmail.it> wrote in message <hks9qv$muq$1(a)fred.mathworks.com>... > "dave levine" > > Oleg, > > Thank you. Do I just place this inside a single for loop? I need a whole vector of values of n1. > > > > Also, how does this histc function work? I need to be able to translate this code into C++ after I get this matlab algorithm working. > > > > Thanks > > The power of matlab is that you don't need loops here. > n2 is already a vector of values, same as n1 (see te equal test above). > > histc is a built-in matlab fcn, so code isn't available. > > Matlab is definitely not the starting point to write in C++ style since its language tries to avoid as much as possible loops. > > Oleg This histc works great when the number of values is small, but i need something that is zippy with 200,000+ samples to process. Right now it is doing less than 5k. It ran with 48000 data points: Elapsed time is 389.979217 seconds. Is there another way?
From: Oleg Komarov on 9 Feb 2010 13:58 > This histc works great when the number of values is small, but i need something that is zippy with 200,000+ samples to process. Right now it is doing less than 5k. > > It ran with 48000 data points: Elapsed time is 389.979217 seconds. > > Is there another way? YOUR LOOP == > 34.923162 seconds. Using time1 and time2 as you supplied them: > edges = [time1 inf]; > [trash,n2] = histc(time2,edges); HISTC == > Elapsed time is 0.005901 seconds. Oleg
From: dave levine on 9 Feb 2010 14:05 "Oleg Komarov" <oleg.komarovRemove.this(a)hotmail.it> wrote in message <hksb7r$m7r$1(a)fred.mathworks.com>... > > This histc works great when the number of values is small, but i need something that is zippy with 200,000+ samples to process. Right now it is doing less than 5k. > > > > It ran with 48000 data points: Elapsed time is 389.979217 seconds. > > > > Is there another way? > > > YOUR LOOP == > 34.923162 seconds. > Using time1 and time2 as you supplied them: > > edges = [time1 inf]; > > [trash,n2] = histc(time2,edges); > HISTC == > Elapsed time is 0.005901 seconds. > > Oleg > Oops, I apologize for being dense. This works great, even with huge sets! Even with 10x the points: Elapsed time is 0.087216 seconds. It does not ever increase in computational cost like nested for loops do. Ill try to recreate the histc function in C++, or create an equivalent Thanks Oleg
From: Oleg Komarov on 9 Feb 2010 14:12 "Oleg Komarov" > > This histc works great when the number of values is small, but i need something that is zippy with 200,000+ samples to process. Right now it is doing less than 5k. > > > > It ran with 48000 data points: Elapsed time is 389.979217 seconds. > > > > Is there another way? > > > YOUR LOOP == > 34.923162 seconds. > Using time1 and time2 as you supplied them: > > edges = [time1 inf]; > > [trash,n2] = histc(time2,edges); > HISTC == > Elapsed time is 0.005901 seconds. > > Oleg Now I understand, samples... 200 000 * 50 000 datapoints = 10e10...*0.006 secs (per loop) = 1666 hrs... or 400 secs * 40 = 4,5 hrs...well it's not so bad after all... :) If you give us more details about what you're trying to accomplish...maybe we can help. Oleg
From: Oleg Komarov on 9 Feb 2010 14:13 "dave levine" <drp2_delete.this(a)unh.edu> wrote in message <hksblh$k59$1(a)fred.mathworks.com>... > "Oleg Komarov" <oleg.komarovRemove.this(a)hotmail.it> wrote in message <hksb7r$m7r$1(a)fred.mathworks.com>... > > > This histc works great when the number of values is small, but i need something that is zippy with 200,000+ samples to process. Right now it is doing less than 5k. > > > > > > It ran with 48000 data points: Elapsed time is 389.979217 seconds. > > > > > > Is there another way? > > > > > > YOUR LOOP == > 34.923162 seconds. > > Using time1 and time2 as you supplied them: > > > edges = [time1 inf]; > > > [trash,n2] = histc(time2,edges); > > HISTC == > Elapsed time is 0.005901 seconds. > > > > Oleg > > > > Oops, I apologize for being dense. This works great, even with huge sets! Even with 10x the points: Elapsed time is 0.087216 seconds. It does not ever increase in computational cost like nested for loops do. > > Ill try to recreate the histc function in C++, or create an equivalent > > Thanks Oleg Ah ok I got it right the first time. Oleg
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: Numerical integration - Trapz, quad, quadl... Next: Evaluating Taylor expansion |