knowledge-database (beta)

Current group: comp.soft-sys.matlab

Speeding up VAR

Speeding up VAR  
Christopher Smith
 Re: Speeding up VAR  
Christopher Smith
From:Christopher Smith
Subject:Speeding up VAR
Date:Sun, 23 Jan 2005 11:40:38 -0500
I need a little help vectorizing the code below. What I am doing is
computing the variance of 50 different populations. For each
population, I want to test a set of conditions, s_x(f) and s_x(g),
before estimating the variance of those that test true for both
conditions.

---

arrayZ = set of observations [where size = (1000, 50)]

for f = 1:1000;
for g = 1:1000;
a = (arrayX < s_x(f)) .* logicalArrayA;
b = (arrayY < s_x(g)) .* logicalArrayB;

intermediateStepOne = a + b;
intermediateStepTwo = IntermediateStep1 .* arrayZ;


resultSet(f,g) = var(intermediateStepTwo);

end
end

Thanks, Chris


From:Christopher Smith
Subject:Re: Speeding up VAR
Date:Sun, 23 Jan 2005 14:58:47 -0500
ALL

Was just wondering, if I were to work backwards from the maximum to
the minimum, could I gain a shortcut advantage?

For example, say I'm testing from 1:10 for f for those numbers less
than the f. If I start at 10 and all variables are less than 10,
then I have a logical array of all 1s.

I then step to 9 -- some pass, some do not. That is, some are less
than 9, but some are not.

I then step to 8 -- now, I don't need to retest those that already
failed because they were not less than 9 in the previous step. Do I
gain a speed advantage by eliminating those that previously failed
that by definition fail on the next iterative step?

How would something like this be coded?

Chris

Chris

Christopher Smith wrote:
>
>
> I need a little help vectorizing the code below. What I am doing
> is
> computing the variance of 50 different populations. For each
> population, I want to test a set of conditions, s_x(f) and s_x(g),
> before estimating the variance of those that test true for both
> conditions.
>
> ---
>
> arrayZ = set of observations [where size = (1000, 50)]
>
> for f = 1:1000;
> for g = 1:1000;
> a = (arrayX < s_x(f)) .* logicalArrayA;
> b = (arrayY < s_x(g)) .* logicalArrayB;
>
> intermediateStepOne = a + b;
> intermediateStepTwo = IntermediateStep1 .* arrayZ;
>
>
> resultSet(f,g) = var(intermediateStepTwo);
>
> end
> end
>
> Thanks, Chris
>
>
   

Copyright © 2006 knowledge-database   -   All rights reserved