> Similarly,  
> instead of
> 
> Foo x = y.clone();
> 
> do something like
> 
> x.copyDataFrom(y);
> 
> where of course you have to write copyDataFrom().

in C you can do something like:

(toward the beginning of your code)

CovZ        = (double *)calloc(p*p*K,sizeof(double));

(and then inside some kind of loop where you
occasionally need to zero out an array the same
size as CovZ)

memcpy(wishart_C,CovZ,sizeof(double)*K*p*p);

note that CovZ's only purpose is to sit around as
a big chunk of zeros and occasionally be used to
erase an array of the same size.

this is actually a passably fast way to zero out a
chunk of ram, be it an array, a few pages of data,
or whatever.  (faster than a for loop over the array
entries, for instance).  data copying, similarly,
can be made fairly quick, especially if you're
dealing with large chunks of ram.

not having to worry about preserving structure
during the copying is what makes this so quick.
(i.e. start at this byte, finish at this byte,
and just do it a page at a time).

s.


 
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com
_______________________________________________
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/

Reply via email to