Looking for vectorized (vector-valued) numerical integrators... 
Author Message
 Looking for vectorized (vector-valued) numerical integrators...

Let's say my integrand function is indeed vector-valued,

I have to break that function down and repetitively call it multiple
times in order to compute the integral of the vector-valued function?

That's very time consuming considering the fact that there are a lot
of commonalities in these separate function evaluations...

I saw neither IMSL nor NAG have the vector-valued numerical
integrator.

Suppose my I want to evaluate a batch of numerical integrations where
the integrands are similar.

Could you please elaborate a bit more about how to leverage the fact
that the integrals are similar in their nature?

To be more specific, my project requires building a 2D grid,

at each grid node, an evaluation of the numerical integral is
conducted and the result is stored;

The numerical integral is very complicated.

However, along the vertical direction, only one small subset of
parameters are changed;

along the horizontal direction, only another very small subset of the
parameters are changed.

Most of the calculations are the same, except the pieces involving
those varying parameters. They are just too intertwined for a human to
sort them out manually to do something like a "cache"...

That's why I am considering the vectorization of the integrals. But I
have no idea about how to do it!

Please shed some lights on me?

Thanks a lot!



Sat, 16 Jan 2010 00:19:51 GMT  
 Looking for vectorized (vector-valued) numerical integrators...

Quote:
> Let's say my integrand function is indeed vector-valued,

> I have to break that function down and repetitively call it multiple
> times in order to compute the integral of the vector-valued function?

> That's very time consuming considering the fact that there are a lot
> of commonalities in these separate function evaluations...

> I saw neither IMSL nor NAG have the vector-valued numerical
> integrator.

> Suppose my I want to evaluate a batch of numerical integrations where
> the integrands are similar.

> Could you please elaborate a bit more about how to leverage the fact
> that the integrals are similar in their nature?

> To be more specific, my project requires building a 2D grid,

> at each grid node, an evaluation of the numerical integral is
> conducted and the result is stored;

> The numerical integral is very complicated.

> However, along the vertical direction, only one small subset of
> parameters are changed;

> along the horizontal direction, only another very small subset of the
> parameters are changed.

> Most of the calculations are the same, except the pieces involving
> those varying parameters. They are just too intertwined for a human to
> sort them out manually to do something like a "cache"...

> That's why I am considering the vectorization of the integrals. But I
> have no idea about how to do it!

> Please shed some lights on me?

> Thanks a lot!

I think this condition was not clarified.
 Does the result of the integration at an intersection affect the data
of the surrounding intersections in the 2-D grid. I.e. the overall
operation is not a step-wise algorithm, just a serial sequential sets
of computations?

If NOT, you can consider subtracting the partial direction-specific
parameters of this intersection (in one direction) from the last
intersection computed, (and do the same in the other direction of the
2-D grid, all as a first process in a grid pass) and redefine your
integral function to be the sum of tw parts, (the last integral and
the correction or deviation cused by the next, based on the calculated
differences in the two directions. This uses points (x-1,y),(x,y-1),
(x,y).



Sat, 16 Jan 2010 06:58:43 GMT  
 Looking for vectorized (vector-valued) numerical integrators...


Quote:

>> Let's say my integrand function is indeed vector-valued,

>> I have to break that function down and repetitively call it multiple
>> times in order to compute the integral of the vector-valued function?

>> That's very time consuming considering the fact that there are a lot
>> of commonalities in these separate function evaluations...

>> I saw neither IMSL nor NAG have the vector-valued numerical
>> integrator.

>> Suppose my I want to evaluate a batch of numerical integrations where
>> the integrands are similar.

>> Could you please elaborate a bit more about how to leverage the fact
>> that the integrals are similar in their nature?

>> To be more specific, my project requires building a 2D grid,

>> at each grid node, an evaluation of the numerical integral is
>> conducted and the result is stored;

>> The numerical integral is very complicated.

>> However, along the vertical direction, only one small subset of
>> parameters are changed;

>> along the horizontal direction, only another very small subset of the
>> parameters are changed.

>> Most of the calculations are the same, except the pieces involving
>> those varying parameters. They are just too intertwined for a human to
>> sort them out manually to do something like a "cache"...

>> That's why I am considering the vectorization of the integrals. But I
>> have no idea about how to do it!

>> Please shed some lights on me?

>> Thanks a lot!

> I think this condition was not clarified.
> Does the result of the integration at an intersection affect the data
> of the surrounding intersections in the 2-D grid. I.e. the overall
> operation is not a step-wise algorithm, just a serial sequential sets
> of computations?

> If NOT, you can consider subtracting the partial direction-specific
> parameters of this intersection (in one direction) from the last
> intersection computed, (and do the same in the other direction of the
> 2-D grid, all as a first process in a grid pass) and redefine your
> integral function to be the sum of tw parts, (the last integral and
> the correction or deviation cused by the next, based on the calculated
> differences in the two directions. This uses points (x-1,y),(x,y-1),
> (x,y).

Hi Terence, this provides one line of thought! Thanks!

The overall 2D grids are just parallel, there is no interdependency
originally.

I originally thought of reusing some parts of calculation; but you impose
additive or multiplicative relations between the two nodes, that's very
interesting...



Sat, 16 Jan 2010 12:43:17 GMT  
 Looking for vectorized (vector-valued) numerical integrators...


Quote:

>> Let's say my integrand function is indeed vector-valued,

>> I have to break that function down and repetitively call it multiple
>> times in order to compute the integral of the vector-valued function?

>> That's very time consuming considering the fact that there are a lot
>> of commonalities in these separate function evaluations...

>> I saw neither IMSL nor NAG have the vector-valued numerical
>> integrator.

>> Suppose my I want to evaluate a batch of numerical integrations where
>> the integrands are similar.

>> Could you please elaborate a bit more about how to leverage the fact
>> that the integrals are similar in their nature?

>> To be more specific, my project requires building a 2D grid,

>> at each grid node, an evaluation of the numerical integral is
>> conducted and the result is stored;

>> The numerical integral is very complicated.

>> However, along the vertical direction, only one small subset of
>> parameters are changed;

>> along the horizontal direction, only another very small subset of the
>> parameters are changed.

>> Most of the calculations are the same, except the pieces involving
>> those varying parameters. They are just too intertwined for a human to
>> sort them out manually to do something like a "cache"...

>> That's why I am considering the vectorization of the integrals. But I
>> have no idea about how to do it!

>> Please shed some lights on me?

>> Thanks a lot!

> I think this condition was not clarified.
> Does the result of the integration at an intersection affect the data
> of the surrounding intersections in the 2-D grid. I.e. the overall
> operation is not a step-wise algorithm, just a serial sequential sets
> of computations?

> If NOT, you can consider subtracting the partial direction-specific
> parameters of this intersection (in one direction) from the last
> intersection computed, (and do the same in the other direction of the
> 2-D grid, all as a first process in a grid pass) and redefine your
> integral function to be the sum of tw parts, (the last integral and
> the correction or deviation cused by the next, based on the calculated
> differences in the two directions. This uses points (x-1,y),(x,y-1),
> (x,y).

I am trying to use Maple to generate C code that reuses some of the common
factors.

Let me know if this plan is good:

as you might recall, I took the pains of generating the real part and
imaginary part of the expression, because I want to only put the real part
into the integral, since none of the numerical integrator in IMSL and NAG
accepts complex-valued integrands. They of course have a reason:
complex-valued evaluations are highly inefficient.

Now suppose I do obtain the real and imaginary parts, and used only the real
part in the integral. That solves my first level problem. Now I have a
second layer problem. Every time when the integral is numerically evaluated,
the integrand function is invoked and the integrand value is computed.
However, the integral is along variable "v". Many other sub-steps or small
pieces of computations could be reused. And if they are really reused, then
the numerical integral will be much faster. Is there a way to take these
things into account when evaluting the numerical integral?

Now there comes the third layer problem:

I am evaluating the integrals numerically to build a 2D grid. On one
dimension, the integrand only varies in the value of parameter t. In the
other dimension, the integrand only varies in the value of parameter a.
Again many small steps should be reused, instead of being recomputed
everytime.

Enlightened by your example above, I am thinking of putting a few varying
parameters together, say v=0, 1, 2, 3, 4, and make it an array, and let
Maple generate C code for array-input-array-output functions. Then if the
numerical integrator supports array input and array output, I will be
gaining a lot of speedup. Dissappointedly, I haven't seen anything like this
in IMSL or NAG. They all use single point input and sing point output.

Any thoughts?



Sat, 16 Jan 2010 12:44:01 GMT  
 Looking for vectorized (vector-valued) numerical integrators...

Quote:



> >> Let's say my integrand function is indeed vector-valued,

> >> I have to break that function down and repetitively call it multiple
> >> times in order to compute the integral of the vector-valued function?

> >> That's very time consuming considering the fact that there are a lot
> >> of commonalities in these separate function evaluations...

> >> I saw neither IMSL nor NAG have the vector-valued numerical
> >> integrator.

> >> Suppose my I want to evaluate a batch of numerical integrations where
> >> the integrands are similar.

> >> Could you please elaborate a bit more about how to leverage the fact
> >> that the integrals are similar in their nature?

> >> To be more specific, my project requires building a 2D grid,

> >> at each grid node, an evaluation of the numerical integral is
> >> conducted and the result is stored;

> >> The numerical integral is very complicated.

> >> However, along the vertical direction, only one small subset of
> >> parameters are changed;

> >> along the horizontal direction, only another very small subset of the
> >> parameters are changed.

> >> Most of the calculations are the same, except the pieces involving
> >> those varying parameters. They are just too intertwined for a human to
> >> sort them out manually to do something like a "cache"...

> >> That's why I am considering the vectorization of the integrals. But I
> >> have no idea about how to do it!

> >> Please shed some lights on me?

> >> Thanks a lot!

> > I think this condition was not clarified.
> > Does the result of the integration at an intersection affect the data
> > of the surrounding intersections in the 2-D grid. I.e. the overall
> > operation is not a step-wise algorithm, just a serial sequential sets
> > of computations?

> > If NOT, you can consider subtracting the partial direction-specific
> > parameters of this intersection (in one direction) from the last
> > intersection computed, (and do the same in the other direction of the
> > 2-D grid, all as a first process in a grid pass) and redefine your
> > integral function to be the sum of tw parts, (the last integral and
> > the correction or deviation cused by the next, based on the calculated
> > differences in the two directions. This uses points (x-1,y),(x,y-1),
> > (x,y).

> I am trying to use Maple to generate C code that reuses some of the common
> factors.

> Let me know if this plan is good:

> as you might recall, I took the pains of generating the real part and
> imaginary part of the expression, because I want to only put the real part
> into the integral, since none of the numerical integrator in IMSL and NAG
> accepts complex-valued integrands. They of course have a reason:
> complex-valued evaluations are highly inefficient.

> Now suppose I do obtain the real and imaginary parts, and used only the real
> part in the integral. That solves my first level problem. Now I have a
> second layer problem. Every time when the integral is numerically evaluated,
> the integrand function is invoked and the integrand value is computed.
> However, the integral is along variable "v". Many other sub-steps or small
> pieces of computations could be reused. And if they are really reused, then
> the numerical integral will be much faster. Is there a way to take these
> things into account when evaluting the numerical integral?

> Now there comes the third layer problem:

> I am evaluating the integrals numerically to build a 2D grid. On one
> dimension, the integrand only varies in the value of parameter t. In the
> other dimension, the integrand only varies in the value of parameter a.
> Again many small steps should be reused, instead of being recomputed
> everytime.

> Enlightened by your example above, I am thinking of putting a few varying
> parameters together, say v=0, 1, 2, 3, 4, and make it an array, and let
> Maple generate C code for array-input-array-output functions. Then if the
> numerical integrator supports array input and array output, I will be
> gaining a lot of speedup. Dissappointedly, I haven't seen anything like this
> in IMSL or NAG. They all use single point input and sing point output.

> Any thoughts?

I suggest you use Maple to generate fortran directly rather than c
(and presumably translating it by hand).

Simon Geard



Sat, 16 Jan 2010 17:02:14 GMT  
 Looking for vectorized (vector-valued) numerical integrators...

Quote:




> > >> Let's say my integrand function is indeed vector-valued,

> > >> I have to break that function down and repetitively call it multiple
> > >> times in order to compute the integral of the vector-valued function?

> > >> That's very time consuming considering the fact that there are a lot
> > >> of commonalities in these separate function evaluations...

> > >> I saw neither IMSL nor NAG have the vector-valued numerical
> > >> integrator.

> > >> Suppose my I want to evaluate a batch of numerical integrations where
> > >> the integrands are similar.

> > >> Could you please elaborate a bit more about how to leverage the fact
> > >> that the integrals are similar in their nature?

> > >> To be more specific, my project requires building a 2D grid,

> > >> at each grid node, an evaluation of the numerical integral is
> > >> conducted and the result is stored;

> > >> The numerical integral is very complicated.

> > >> However, along the vertical direction, only one small subset of
> > >> parameters are changed;

> > >> along the horizontal direction, only another very small subset of the
> > >> parameters are changed.

> > >> Most of the calculations are the same, except the pieces involving
> > >> those varying parameters. They are just too intertwined for a human to
> > >> sort them out manually to do something like a "cache"...

> > >> That's why I am considering the vectorization of the integrals. But I
> > >> have no idea about how to do it!

> > >> Please shed some lights on me?

> > >> Thanks a lot!

> > > I think this condition was not clarified.
> > > Does the result of the integration at an intersection affect the data
> > > of the surrounding intersections in the 2-D grid. I.e. the overall
> > > operation is not a step-wise algorithm, just a serial sequential sets
> > > of computations?

> > > If NOT, you can consider subtracting the partial direction-specific
> > > parameters of this intersection (in one direction) from the last
> > > intersection computed, (and do the same in the other direction of the
> > > 2-D grid, all as a first process in a grid pass) and redefine your
> > > integral function to be the sum of tw parts, (the last integral and
> > > the correction or deviation cused by the next, based on the calculated
> > > differences in the two directions. This uses points (x-1,y),(x,y-1),
> > > (x,y).

> > I am trying to use Maple to generate C code that reuses some of the common
> > factors.

> > Let me know if this plan is good:

> > as you might recall, I took the pains of generating the real part and
> > imaginary part of the expression, because I want to only put the real part
> > into the integral, since none of the numerical integrator in IMSL and NAG
> > accepts complex-valued integrands. They of course have a reason:
> > complex-valued evaluations are highly inefficient.

> > Now suppose I do obtain the real and imaginary parts, and used only the real
> > part in the integral. That solves my first level problem. Now I have a
> > second layer problem. Every time when the integral is numerically evaluated,
> > the integrand function is invoked and the integrand value is computed.
> > However, the integral is along variable "v". Many other sub-steps or small
> > pieces of computations could be reused. And if they are really reused, then
> > the numerical integral will be much faster. Is there a way to take these
> > things into account when evaluting the numerical integral?

> > Now there comes the third layer problem:

> > I am evaluating the integrals numerically to build a 2D grid. On one
> > dimension, the integrand only varies in the value of parameter t. In the
> > other dimension, the integrand only varies in the value of parameter a.
> > Again many small steps should be reused, instead of being recomputed
> > everytime.

> > Enlightened by your example above, I am thinking of putting a few varying
> > parameters together, say v=0, 1, 2, 3, 4, and make it an array, and let
> > Maple generate C code for array-input-array-output functions. Then if the
> > numerical integrator supports array input and array output, I will be
> > gaining a lot of speedup. Dissappointedly, I haven't seen anything like this
> > in IMSL or NAG. They all use single point input and sing point output.

> > Any thoughts?

> I suggest you use Maple to generate Fortran directly rather than c
> (and presumably translating it by hand).

> Simon Geard

After second thought and third thought, I now think you are probably
right. I should use Maple to generate Fortran code.

How to let Maple know in the following function

S:=makeproc(my_expression, parameters=[a, b, c, d]);

"a" should be a vector of dim "m", and correspondingly,

S should vector-valued, i.e.,

S(a[1])= some_value1;
S(a[2])= some_value2;
S(a[3])= some_value3;
...

How to generate such Fortran code using Maple?

Thanks a lot!



Sun, 17 Jan 2010 09:29:07 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Looking for other customizers of Rational Compilation Integrator

2. no vector = vector*vector in BLAS?

3. Numerical Recipes singular value decomposition routine

4. calculation with numerical values of string

5. check on numerical value?

6. Constructing SFRotation values from positional vector

7. How to model unknown values in a vector?

8. Find the smallest value of standard logic vector (7 downto 0)

9. Vector-valued subscripts ....

10. vector valued function as argument

11. Value and index of an element of a vector: How

12. Vector-valued functions in f90

 

 
Powered by phpBB® Forum Software