> Now, my question: Are there some general rules or recommendations on > how and where to make the type casts? For example, > a) is it more useful to do the type casts directly after/before I/O > operations to avoid additional casts or to do them more close to the > computations to save memory for intermediate data arrays? > b) Is it more useful to use a complex representation for real data in > order to avoid implicit type casts at mixed real/complex computation > vis or is it more useful to save the memory for the unnecessary > imaginary part? >
In general, you want to avoid changing types back and forth. Both explicit conversions and automatic coercion dots almost always represent additional storage. It is sometimes possible to put the coercion inside a loop to avoid building a large buffer that then needs to be converted. But in general, it is best to look for the most common type and go with it. You can also use the profiler to get a better idea of how much is being used in order to make your experiments make more sense. If you want more details, post pictures and more detailed questions. Greg McKaskle
