[jira] [Commented] (MATH-797) Single step integrators

2012-07-20 Thread Gilles (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13419354#comment-13419354
 ] 

Gilles commented on MATH-797:
-

When a rule must be retrieved from a factory of high precision rules, as in the 
case for
LegendreHighPrecisionRuleFactory, a conversion is made to create two arrays 
of doubles from arrays of BigDecimal objects. This conversion can take an 
awful lot of time.
When rules must retrieved many times, this can become prohibitive.
It is thus proposed to cache the converted rules that were already retrieved, 
so that the conversion occurs only once per rule.


 Single step integrators
 ---

 Key: MATH-797
 URL: https://issues.apache.org/jira/browse/MATH-797
 Project: Commons Math
  Issue Type: Wish
Affects Versions: 3.0
Reporter: Gilles
Assignee: Gilles
Priority: Trivial
 Fix For: 3.1


 CM assumes that the user wants to integrate a complex function on a large 
 interval, so the large interval has to be subdivided into many subintervals. 
 CM does the partition, and performs convergence checks, using an iterative 
 approach.
 However, if the function is smooth enough, no subdivision of the integration 
 interval is required. Those use-cases could benefit from the efficiency gain 
 of not performing a convergence check.
 The proposal is to provide a new interface UnivariateSingleStepIntegrator:
 {code}
 interface SingleIntervalIntegrator {
 /**
  * Method for implementing a single interval integration.
  * There is no convergence checks because it is not iterative.
  *
  * @param f Function to integrate.
  * @param lower Lower bound of the interval over which to integrate.
  * @param upper Upper bound of the interval over which to integrate.
  * @return the integrated value.
  */
 double integrate(UnivariateFunction f,
  double lower,
  double upper);
 }
 {code}
 In effect, the implementation of the above integrate method of a new 
 LegendreGaussIntegratorSingleStepIntegrator would the equivalent of 
 stage(1) in the current LegendreGaussIntegrator.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (MATH-797) Single step integrators

2012-07-20 Thread Gilles (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13419357#comment-13419357
 ] 

Gilles commented on MATH-797:
-

Done revision 1363875.


 Single step integrators
 ---

 Key: MATH-797
 URL: https://issues.apache.org/jira/browse/MATH-797
 Project: Commons Math
  Issue Type: Wish
Affects Versions: 3.0
Reporter: Gilles
Assignee: Gilles
Priority: Trivial
 Fix For: 3.1


 CM assumes that the user wants to integrate a complex function on a large 
 interval, so the large interval has to be subdivided into many subintervals. 
 CM does the partition, and performs convergence checks, using an iterative 
 approach.
 However, if the function is smooth enough, no subdivision of the integration 
 interval is required. Those use-cases could benefit from the efficiency gain 
 of not performing a convergence check.
 The proposal is to provide a new interface UnivariateSingleStepIntegrator:
 {code}
 interface SingleIntervalIntegrator {
 /**
  * Method for implementing a single interval integration.
  * There is no convergence checks because it is not iterative.
  *
  * @param f Function to integrate.
  * @param lower Lower bound of the interval over which to integrate.
  * @param upper Upper bound of the interval over which to integrate.
  * @return the integrated value.
  */
 double integrate(UnivariateFunction f,
  double lower,
  double upper);
 }
 {code}
 In effect, the implementation of the above integrate method of a new 
 LegendreGaussIntegratorSingleStepIntegrator would the equivalent of 
 stage(1) in the current LegendreGaussIntegrator.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (MATH-797) Single step integrators

2012-07-20 Thread Gilles (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13419699#comment-13419699
 ] 

Gilles commented on MATH-797:
-

Revision 1364024: Added synchronized keyword on method getRuleInternal 
(class BaseRuleFactory).


 Single step integrators
 ---

 Key: MATH-797
 URL: https://issues.apache.org/jira/browse/MATH-797
 Project: Commons Math
  Issue Type: Wish
Affects Versions: 3.0
Reporter: Gilles
Assignee: Gilles
Priority: Trivial
 Fix For: 3.1


 CM assumes that the user wants to integrate a complex function on a large 
 interval, so the large interval has to be subdivided into many subintervals. 
 CM does the partition, and performs convergence checks, using an iterative 
 approach.
 However, if the function is smooth enough, no subdivision of the integration 
 interval is required. Those use-cases could benefit from the efficiency gain 
 of not performing a convergence check.
 The proposal is to provide a new interface UnivariateSingleStepIntegrator:
 {code}
 interface SingleIntervalIntegrator {
 /**
  * Method for implementing a single interval integration.
  * There is no convergence checks because it is not iterative.
  *
  * @param f Function to integrate.
  * @param lower Lower bound of the interval over which to integrate.
  * @param upper Upper bound of the interval over which to integrate.
  * @return the integrated value.
  */
 double integrate(UnivariateFunction f,
  double lower,
  double upper);
 }
 {code}
 In effect, the implementation of the above integrate method of a new 
 LegendreGaussIntegratorSingleStepIntegrator would the equivalent of 
 stage(1) in the current LegendreGaussIntegrator.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (MATH-797) Single step integrators

2012-07-12 Thread Gilles (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13412857#comment-13412857
 ] 

Gilles commented on MATH-797:
-

Gauss-Legendre quadrature (and framework for other schemes) code committed 
revision 1360706.
Adapted from an original code provided by Sébastien Brisard.

Please review.


 Single step integrators
 ---

 Key: MATH-797
 URL: https://issues.apache.org/jira/browse/MATH-797
 Project: Commons Math
  Issue Type: Wish
Affects Versions: 3.0
Reporter: Gilles
Assignee: Gilles
Priority: Trivial
 Fix For: 3.1


 CM assumes that the user wants to integrate a complex function on a large 
 interval, so the large interval has to be subdivided into many subintervals. 
 CM does the partition, and performs convergence checks, using an iterative 
 approach.
 However, if the function is smooth enough, no subdivision of the integration 
 interval is required. Those use-cases could benefit from the efficiency gain 
 of not performing a convergence check.
 The proposal is to provide a new interface UnivariateSingleStepIntegrator:
 {code}
 interface SingleIntervalIntegrator {
 /**
  * Method for implementing a single interval integration.
  * There is no convergence checks because it is not iterative.
  *
  * @param f Function to integrate.
  * @param lower Lower bound of the interval over which to integrate.
  * @param upper Upper bound of the interval over which to integrate.
  * @return the integrated value.
  */
 double integrate(UnivariateFunction f,
  double lower,
  double upper);
 }
 {code}
 In effect, the implementation of the above integrate method of a new 
 LegendreGaussIntegratorSingleStepIntegrator would the equivalent of 
 stage(1) in the current LegendreGaussIntegrator.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (MATH-797) Single step integrators

2012-06-28 Thread Gilles (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13403231#comment-13403231
 ] 

Gilles commented on MATH-797:
-

I'd rather include the algorithm for computing the points and weights. So, if 
you don't mind (and the paperwork is all done), could you please post the code 
which you wanted to donate?


 Single step integrators
 ---

 Key: MATH-797
 URL: https://issues.apache.org/jira/browse/MATH-797
 Project: Commons Math
  Issue Type: Wish
Affects Versions: 3.0
Reporter: Gilles
Assignee: Gilles
Priority: Trivial
 Fix For: 3.1


 CM assumes that the user wants to integrate a complex function on a large 
 interval, so the large interval has to be subdivided into many subintervals. 
 CM does the partition, and performs convergence checks, using an iterative 
 approach.
 However, if the function is smooth enough, no subdivision of the integration 
 interval is required. Those use-cases could benefit from the efficiency gain 
 of not performing a convergence check.
 The proposal is to provide a new interface UnivariateSingleStepIntegrator:
 {code}
 interface SingleIntervalIntegrator {
 /**
  * Method for implementing a single interval integration.
  * There is no convergence checks because it is not iterative.
  *
  * @param f Function to integrate.
  * @param lower Lower bound of the interval over which to integrate.
  * @param upper Upper bound of the interval over which to integrate.
  * @return the integrated value.
  */
 double integrate(UnivariateFunction f,
  double lower,
  double upper);
 }
 {code}
 In effect, the implementation of the above integrate method of a new 
 LegendreGaussIntegratorSingleStepIntegrator would the equivalent of 
 stage(1) in the current LegendreGaussIntegrator.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (MATH-797) Single step integrators

2012-06-27 Thread Gilles (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13402095#comment-13402095
 ] 

Gilles commented on MATH-797:
-

Sorry, I don't get the Not really, no.

When you say:
bq. [...] we basically need a mother class to handle Gauss points and Gauss 
weights, [...]
I can only suggest {{GaussIntegrator}} as the name for this class.

*IIUC*, the constructor would be something like
{code}
public GaussIntegrator(double[] points, double[] weights) { /* ... */ }
{code}

And there would be a factory:
{code}
public class GaussIntegratorFactory {
  public static GaussIntegrator legendre(int order) { /* ... */ }
  public static GaussIntegrator chebyshev(int order) { /* ... */ }
  // etc.
}
{code}

At first sight, this is all what should be in the public API. Or am I mistaken?


 Single step integrators
 ---

 Key: MATH-797
 URL: https://issues.apache.org/jira/browse/MATH-797
 Project: Commons Math
  Issue Type: Wish
Affects Versions: 3.0
Reporter: Gilles
Assignee: Gilles
Priority: Trivial
 Fix For: 3.1


 CM assumes that the user wants to integrate a complex function on a large 
 interval, so the large interval has to be subdivided into many subintervals. 
 CM does the partition, and performs convergence checks, using an iterative 
 approach.
 However, if the function is smooth enough, no subdivision of the integration 
 interval is required. Those use-cases could benefit from the efficiency gain 
 of not performing a convergence check.
 The proposal is to provide a new interface UnivariateSingleStepIntegrator:
 {code}
 interface SingleIntervalIntegrator {
 /**
  * Method for implementing a single interval integration.
  * There is no convergence checks because it is not iterative.
  *
  * @param f Function to integrate.
  * @param lower Lower bound of the interval over which to integrate.
  * @param upper Upper bound of the interval over which to integrate.
  * @return the integrated value.
  */
 double integrate(UnivariateFunction f,
  double lower,
  double upper);
 }
 {code}
 In effect, the implementation of the above integrate method of a new 
 LegendreGaussIntegratorSingleStepIntegrator would the equivalent of 
 stage(1) in the current LegendreGaussIntegrator.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (MATH-797) Single step integrators

2012-06-27 Thread JIRA

[ 
https://issues.apache.org/jira/browse/MATH-797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13402148#comment-13402148
 ] 

Sébastien Brisard commented on MATH-797:


Yes, that's much better than what I had in mind. I thought of something like 
{{GaussIntegrator}} as a mother class, with various impls: 
{{GaussLegendreIntegrator extends GaussIntegrator}}, {{GaussChebyshevIntegrator 
extends GaussIntegrator}}, and so on. That's why I was saying that 
{{GaussIntegrator}} was a bad name for {{GaussLegendreIntegrator}}.

But I like your way of seeing things very much. Plus it would be fairly easy to 
start with a basic implementation, only legendre, limited order, and build on 
this later on.

I think that {{GaussIntegrator}} should not implement {{UnivariateIntegrator}}, 
because the implicit weighting function would otherwise be misleading. What do 
you think?

 Single step integrators
 ---

 Key: MATH-797
 URL: https://issues.apache.org/jira/browse/MATH-797
 Project: Commons Math
  Issue Type: Wish
Affects Versions: 3.0
Reporter: Gilles
Assignee: Gilles
Priority: Trivial
 Fix For: 3.1


 CM assumes that the user wants to integrate a complex function on a large 
 interval, so the large interval has to be subdivided into many subintervals. 
 CM does the partition, and performs convergence checks, using an iterative 
 approach.
 However, if the function is smooth enough, no subdivision of the integration 
 interval is required. Those use-cases could benefit from the efficiency gain 
 of not performing a convergence check.
 The proposal is to provide a new interface UnivariateSingleStepIntegrator:
 {code}
 interface SingleIntervalIntegrator {
 /**
  * Method for implementing a single interval integration.
  * There is no convergence checks because it is not iterative.
  *
  * @param f Function to integrate.
  * @param lower Lower bound of the interval over which to integrate.
  * @param upper Upper bound of the interval over which to integrate.
  * @return the integrated value.
  */
 double integrate(UnivariateFunction f,
  double lower,
  double upper);
 }
 {code}
 In effect, the implementation of the above integrate method of a new 
 LegendreGaussIntegratorSingleStepIntegrator would the equivalent of 
 stage(1) in the current LegendreGaussIntegrator.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (MATH-797) Single step integrators

2012-06-27 Thread Gilles (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13402643#comment-13402643
 ] 

Gilles commented on MATH-797:
-

bq. I think that GaussIntegrator should not implement UnivariateIntegrator, 
because the implicit weighting function would otherwise be misleading.

If I refer to your nice ASCII equation, it indeed seems that 
{{UnivariateIntegrator}} and {{GaussIntegrator}} are different concept that 
happen to intersect at the Legendre point. :-)
Anyways, it will be easier to start by not trying to make the concepts depend 
on each other or otherwise overlap. Maybe adapters can be added later on.

So, are we set to go?


 Single step integrators
 ---

 Key: MATH-797
 URL: https://issues.apache.org/jira/browse/MATH-797
 Project: Commons Math
  Issue Type: Wish
Affects Versions: 3.0
Reporter: Gilles
Assignee: Gilles
Priority: Trivial
 Fix For: 3.1


 CM assumes that the user wants to integrate a complex function on a large 
 interval, so the large interval has to be subdivided into many subintervals. 
 CM does the partition, and performs convergence checks, using an iterative 
 approach.
 However, if the function is smooth enough, no subdivision of the integration 
 interval is required. Those use-cases could benefit from the efficiency gain 
 of not performing a convergence check.
 The proposal is to provide a new interface UnivariateSingleStepIntegrator:
 {code}
 interface SingleIntervalIntegrator {
 /**
  * Method for implementing a single interval integration.
  * There is no convergence checks because it is not iterative.
  *
  * @param f Function to integrate.
  * @param lower Lower bound of the interval over which to integrate.
  * @param upper Upper bound of the interval over which to integrate.
  * @return the integrated value.
  */
 double integrate(UnivariateFunction f,
  double lower,
  double upper);
 }
 {code}
 In effect, the implementation of the above integrate method of a new 
 LegendreGaussIntegratorSingleStepIntegrator would the equivalent of 
 stage(1) in the current LegendreGaussIntegrator.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (MATH-797) Single step integrators

2012-06-27 Thread JIRA

[ 
https://issues.apache.org/jira/browse/MATH-797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13402854#comment-13402854
 ] 

Sébastien Brisard commented on MATH-797:


{quote}
If I refer to your nice ASCII equation
{quote}
[Maxima|http://maxima.sourceforge.net/] is a very faithful friend of mine...

I now remember why I implemented {{GaussLegendreFactory}}, 
{{GaussChebyshevFactory}}, and the likes, instead of one big factory qs you 
suggested. The reason for this is that n-point rules are computed recursively: 
you need first to compute the (n-1), (n-2), ... 1-point rules. I therefore 
cached all previously computed rules, which can make one single factory messy, 
because you would need one cache for each rule. However
* I am not sure that caching is indeed necessary: computing a new rule will 
presumably not occur too often in particular applications, and we can probably 
allow for the CPU-cost,
* we could also think of a factory method which would take the (n-1) point rule 
and return the n-point rule.
* the two approaches (one big factory vs. multiple factories) is anyway 
tractable: we can still define multiple factories, and have one 
{{GaussIntegratorFactory}} which holds singleton references to each of these 
specific factories. I have to say I find your idea of one big single factory 
very neat.

{quote}
So, are we set to go?
{quote}
I think so. I guess you will start with implementing the stripped down G-L 
integrator, where all points and weights have been precomputed (not computed 
on-the-fly), so you are not likely to have the above problem.

 Single step integrators
 ---

 Key: MATH-797
 URL: https://issues.apache.org/jira/browse/MATH-797
 Project: Commons Math
  Issue Type: Wish
Affects Versions: 3.0
Reporter: Gilles
Assignee: Gilles
Priority: Trivial
 Fix For: 3.1


 CM assumes that the user wants to integrate a complex function on a large 
 interval, so the large interval has to be subdivided into many subintervals. 
 CM does the partition, and performs convergence checks, using an iterative 
 approach.
 However, if the function is smooth enough, no subdivision of the integration 
 interval is required. Those use-cases could benefit from the efficiency gain 
 of not performing a convergence check.
 The proposal is to provide a new interface UnivariateSingleStepIntegrator:
 {code}
 interface SingleIntervalIntegrator {
 /**
  * Method for implementing a single interval integration.
  * There is no convergence checks because it is not iterative.
  *
  * @param f Function to integrate.
  * @param lower Lower bound of the interval over which to integrate.
  * @param upper Upper bound of the interval over which to integrate.
  * @return the integrated value.
  */
 double integrate(UnivariateFunction f,
  double lower,
  double upper);
 }
 {code}
 In effect, the implementation of the above integrate method of a new 
 LegendreGaussIntegratorSingleStepIntegrator would the equivalent of 
 stage(1) in the current LegendreGaussIntegrator.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (MATH-797) Single step integrators

2012-06-26 Thread Gilles (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13401373#comment-13401373
 ] 

Gilles commented on MATH-797:
-

Sébastien,

Do you intend to work on this (in which case we'll change the assignee), or 
shall I implement the single-step Legendre-Gauss part (using the code 
provided by the team I referred to above)?


 Single step integrators
 ---

 Key: MATH-797
 URL: https://issues.apache.org/jira/browse/MATH-797
 Project: Commons Math
  Issue Type: Wish
Affects Versions: 3.0
Reporter: Gilles
Assignee: Gilles
Priority: Trivial
 Fix For: 3.1


 CM assumes that the user wants to integrate a complex function on a large 
 interval, so the large interval has to be subdivided into many subintervals. 
 CM does the partition, and performs convergence checks, using an iterative 
 approach.
 However, if the function is smooth enough, no subdivision of the integration 
 interval is required. Those use-cases could benefit from the efficiency gain 
 of not performing a convergence check.
 The proposal is to provide a new interface UnivariateSingleStepIntegrator:
 {code}
 interface SingleIntervalIntegrator {
 /**
  * Method for implementing a single interval integration.
  * There is no convergence checks because it is not iterative.
  *
  * @param f Function to integrate.
  * @param lower Lower bound of the interval over which to integrate.
  * @param upper Upper bound of the interval over which to integrate.
  * @return the integrated value.
  */
 double integrate(UnivariateFunction f,
  double lower,
  double upper);
 }
 {code}
 In effect, the implementation of the above integrate method of a new 
 LegendreGaussIntegratorSingleStepIntegrator would the equivalent of 
 stage(1) in the current LegendreGaussIntegrator.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (MATH-797) Single step integrators

2012-06-26 Thread JIRA

[ 
https://issues.apache.org/jira/browse/MATH-797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13401388#comment-13401388
 ] 

Sébastien Brisard commented on MATH-797:


I would be happy to get involved in this, but certainly do not want to tread on 
anyone's toes...
I guess it all really depends on how urgently you need this feature (I'm quite 
busy with testing the vector implementations, right now, plus summer vacations 
are approaching...).

My understanding of the above conclusion was that it is better to create a new 
hierarchy of classes for Gauss-like integrators. Personally, I'd rather we take 
some time to discuss the interface common to these integrators. Implementation 
could then be quite fast, as I could easily refactor what I've already written, 
and provide various implementations (see above), including tests; also we could 
refactor what has already been done on your side.

So I would say: OK to get involved (but not tomorrow!), but let's discuss first 
!

May be to fire up the discussion, I could include the interfaces I had designed 
a few years back. It's just to initiate the discussion, though... So here goes. 
I started by defining a Gauss integration rule
{code:java}
public interface GaussianRule {
/**
 * Copies the abscissae of all integration points in the specified 
array,
 * starting at the specified location. This method will generate an
 * {@link ArrayIndexOutOfBoundsException} if the specified array is not
 * large enough.
 * 
 * @param x
 *the array in which the nodes are to be copied
 * @param pos
 *the index of the first cell to be filled
 */
void copyNodes(final double[] x, final int pos);

/**
 * Copies the weights of all integration points in the specified array,
 * starting at the specified location. This method will generate an
 * {@link ArrayIndexOutOfBoundsException} if the specified array is not
 * large enough.
 * 
 * @param w
 *the array in which the weights are to be copied
 * @param pos
 *the index of the first cell to be filled
 */
void copyWeights(final double[] w, final int pos);

/**
 * Returns the abscissa of the codei/code-th integration point.
 * 
 * @param i
 *the index of the node
 * @return the abscissa of the node
 */
double getNode(final int i);

/**
 * Returns the number of integration points of this quadrature rule.
 * 
 * @return the number of integration points
 */
int getNumNodes();

/**
 * Returns the value of the weight of the codei/code-th integration
 * point.
 * 
 * @param i
 *the index of the node
 * @return the weight of the node
 */
double getWeight(final int i);

/**
 * Returns the weighted integral of the specified function between the
 * natural bounds of this quadrature rule.
 * 
 * @param f
 *the univariate real function to be integrated
 * @return the estimate of the integral
 */
double integrate(final UnivariateRealFunction f);

/**
 * Returns the maximum degree of polynomials for which integration with 
this
 * quadrature rule is exact.
 * 
 * @return the maximum degree
 */
int getMaximumDegreeForExactness();

/**
 * Returns the lower-bound of the integration interval for which this 
rule
 * is designed. Appropriate change of the integration variable may allow
 * integration on a different interval.
 * 
 * @return the lower bound of the integration interval
 */
double getRangeOfIntegrationLowerBound();

/**
 * Returns the upper-bound of the integration interval for which this 
rule
 * is designed. Appropriate change of the integration variable may allow
 * integration on a different interval.
 * 
 * @return the upper bound of the integration interval
 */
double getRangeOfIntegrationUpperBound();
}
{code}

Then, each integration rule (Gauss-Legendre, Gauss-Chebyshev, etc...) is 
created with a factory
{code:java}
public interface GaussianRuleFactory {
/**
 * Returns a new coden/code-point Gaussian quadrature rule. If no rule
 * has been defined for the specified number of integration points, this
 * method returns codenull/code.
 * 
 * @param n
 *the number of integration points
 * @return the quadrature rule
 */
GaussianRule create(final int n);
}

{code}

Example for Gauss-Legendre 

[jira] [Commented] (MATH-797) Single step integrators

2012-06-26 Thread Gilles (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13401433#comment-13401433
 ] 

Gilles commented on MATH-797:
-

I'm not familiar _at all_ with those algorithms, so I wouldn't be able to 
comment much.

However, I'm indeed eager to propose something quite soon (because time for 
code changes starts to run out for some teams in the project I work for). If 
not, they will keep their fork from the current CM code (and we run the risk 
of implementing something that nobody will actually test).

Thus, what I would propose is to create a code that performs what is requested, 
using a stripped-down version of your code (i.e. no interface, minimum number 
of accessors, ...), maybe hiding everything in a 
SingleStepGaussLegendreIntegrator class. This will enable to quickly assess 
correctness (e.g. comparing with the current CM code) and performance (the 
reason for the reporter's request).
Then we can gradually add more flexibility/refinements (public factories, 
etc.) as we agree on their API.

How does that sound?


 Single step integrators
 ---

 Key: MATH-797
 URL: https://issues.apache.org/jira/browse/MATH-797
 Project: Commons Math
  Issue Type: Wish
Affects Versions: 3.0
Reporter: Gilles
Assignee: Gilles
Priority: Trivial
 Fix For: 3.1


 CM assumes that the user wants to integrate a complex function on a large 
 interval, so the large interval has to be subdivided into many subintervals. 
 CM does the partition, and performs convergence checks, using an iterative 
 approach.
 However, if the function is smooth enough, no subdivision of the integration 
 interval is required. Those use-cases could benefit from the efficiency gain 
 of not performing a convergence check.
 The proposal is to provide a new interface UnivariateSingleStepIntegrator:
 {code}
 interface SingleIntervalIntegrator {
 /**
  * Method for implementing a single interval integration.
  * There is no convergence checks because it is not iterative.
  *
  * @param f Function to integrate.
  * @param lower Lower bound of the interval over which to integrate.
  * @param upper Upper bound of the interval over which to integrate.
  * @return the integrated value.
  */
 double integrate(UnivariateFunction f,
  double lower,
  double upper);
 }
 {code}
 In effect, the implementation of the above integrate method of a new 
 LegendreGaussIntegratorSingleStepIntegrator would the equivalent of 
 stage(1) in the current LegendreGaussIntegrator.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (MATH-797) Single step integrators

2012-06-26 Thread JIRA

[ 
https://issues.apache.org/jira/browse/MATH-797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13401444#comment-13401444
 ] 

Sébastien Brisard commented on MATH-797:


Fine by me. Only, I would not call it a {{SingleStepLegendreGaussIntegrator}}, 
as Gauss integrators _are_ single-step by nature (of course, you can use 
refined Gauss-like integrators, like Gauss-Kronrod, but that's another story). 
It's a shame that the name {{LegendreGaussIntegrator}} should already be taken, 
by a class that is not that useful...

What we could do is create {{SingleStepLegendreGaussIntegrator}} for the time 
being in 3.1. Then, I think the best we could do is get rid in 4.0 of the 
existing {{LegendreGaussIntegrator}}, rename 
{{SingleStepLegendreGaussIntegrator}} and include it in a hierarchy of 
Gauss-like integrators.

What do you think?

Sébastien

 Single step integrators
 ---

 Key: MATH-797
 URL: https://issues.apache.org/jira/browse/MATH-797
 Project: Commons Math
  Issue Type: Wish
Affects Versions: 3.0
Reporter: Gilles
Assignee: Gilles
Priority: Trivial
 Fix For: 3.1


 CM assumes that the user wants to integrate a complex function on a large 
 interval, so the large interval has to be subdivided into many subintervals. 
 CM does the partition, and performs convergence checks, using an iterative 
 approach.
 However, if the function is smooth enough, no subdivision of the integration 
 interval is required. Those use-cases could benefit from the efficiency gain 
 of not performing a convergence check.
 The proposal is to provide a new interface UnivariateSingleStepIntegrator:
 {code}
 interface SingleIntervalIntegrator {
 /**
  * Method for implementing a single interval integration.
  * There is no convergence checks because it is not iterative.
  *
  * @param f Function to integrate.
  * @param lower Lower bound of the interval over which to integrate.
  * @param upper Upper bound of the interval over which to integrate.
  * @return the integrated value.
  */
 double integrate(UnivariateFunction f,
  double lower,
  double upper);
 }
 {code}
 In effect, the implementation of the above integrate method of a new 
 LegendreGaussIntegratorSingleStepIntegrator would the equivalent of 
 stage(1) in the current LegendreGaussIntegrator.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (MATH-797) Single step integrators

2012-06-26 Thread Gilles (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13401805#comment-13401805
 ] 

Gilles commented on MATH-797:
-

bq. [...] I would not call it a {{SingleStepLegendreGaussIntegrator}}, as Gauss 
integrators are single-step  [...]

Maybe just {{GaussIntegrator}} then?


 Single step integrators
 ---

 Key: MATH-797
 URL: https://issues.apache.org/jira/browse/MATH-797
 Project: Commons Math
  Issue Type: Wish
Affects Versions: 3.0
Reporter: Gilles
Assignee: Gilles
Priority: Trivial
 Fix For: 3.1


 CM assumes that the user wants to integrate a complex function on a large 
 interval, so the large interval has to be subdivided into many subintervals. 
 CM does the partition, and performs convergence checks, using an iterative 
 approach.
 However, if the function is smooth enough, no subdivision of the integration 
 interval is required. Those use-cases could benefit from the efficiency gain 
 of not performing a convergence check.
 The proposal is to provide a new interface UnivariateSingleStepIntegrator:
 {code}
 interface SingleIntervalIntegrator {
 /**
  * Method for implementing a single interval integration.
  * There is no convergence checks because it is not iterative.
  *
  * @param f Function to integrate.
  * @param lower Lower bound of the interval over which to integrate.
  * @param upper Upper bound of the interval over which to integrate.
  * @return the integrated value.
  */
 double integrate(UnivariateFunction f,
  double lower,
  double upper);
 }
 {code}
 In effect, the implementation of the above integrate method of a new 
 LegendreGaussIntegratorSingleStepIntegrator would the equivalent of 
 stage(1) in the current LegendreGaussIntegrator.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (MATH-797) Single step integrators

2012-06-26 Thread JIRA

[ 
https://issues.apache.org/jira/browse/MATH-797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13401938#comment-13401938
 ] 

Sébastien Brisard commented on MATH-797:


Not really, no. Gauss integrator is the generic name for a bunch of integration 
schemes which read
{noformat}
 bn - 1
/ 
[ \
I  f(t) w(t) dt =  w  f(t )
] /  ii
/ 
ai = 0
{noformat}
where {{w(t)}} is a weighting function. The Gauss points t[i] and weights w[i] 
are chosen so that the above formula is *exact* for {{f(t)}} polynomial, 
{{deg(f) = 2 * n - 1}}. Various choices of {{w(t)}} lead to various Gauss 
integration rules
* {{w(t) = 1}} is the so-called Gauss-Legendre rule,
* {{w(t) = (1 - x^2)^(-1 / 2)}}: Gauss-Chebyshev,
* etc...

So, we basically need a mother class to handle Gauss points and Gauss weights, 
as well as the above formula. Then, to implement a new Gauss integration rule, 
we would only need to derive it from this mother class.

 Single step integrators
 ---

 Key: MATH-797
 URL: https://issues.apache.org/jira/browse/MATH-797
 Project: Commons Math
  Issue Type: Wish
Affects Versions: 3.0
Reporter: Gilles
Assignee: Gilles
Priority: Trivial
 Fix For: 3.1


 CM assumes that the user wants to integrate a complex function on a large 
 interval, so the large interval has to be subdivided into many subintervals. 
 CM does the partition, and performs convergence checks, using an iterative 
 approach.
 However, if the function is smooth enough, no subdivision of the integration 
 interval is required. Those use-cases could benefit from the efficiency gain 
 of not performing a convergence check.
 The proposal is to provide a new interface UnivariateSingleStepIntegrator:
 {code}
 interface SingleIntervalIntegrator {
 /**
  * Method for implementing a single interval integration.
  * There is no convergence checks because it is not iterative.
  *
  * @param f Function to integrate.
  * @param lower Lower bound of the interval over which to integrate.
  * @param upper Upper bound of the interval over which to integrate.
  * @return the integrated value.
  */
 double integrate(UnivariateFunction f,
  double lower,
  double upper);
 }
 {code}
 In effect, the implementation of the above integrate method of a new 
 LegendreGaussIntegratorSingleStepIntegrator would the equivalent of 
 stage(1) in the current LegendreGaussIntegrator.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (MATH-797) Single step integrators

2012-06-03 Thread Luc Maisonobe (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13288125#comment-13288125
 ] 

Luc Maisonobe commented on MATH-797:


Big +1 from me.
We also hit some problems with iterations with the current integrators at work, 
and had to recode some stripped down versions with fixed steps. Having 
deterministic integration without convergence checks for some simple cases 
using Gauss-Legendre would be fine.

We also dicussed some time ago about extending the order of Gauss-Legendre in 
another issue (I don't remember which one) but did not implement it at that 
time. It would be nice to do it now.


 Single step integrators
 ---

 Key: MATH-797
 URL: https://issues.apache.org/jira/browse/MATH-797
 Project: Commons Math
  Issue Type: Wish
Affects Versions: 3.0
Reporter: Gilles
Assignee: Gilles
Priority: Trivial
 Fix For: 3.1


 CM assumes that the user wants to integrate a complex function on a large 
 interval, so the large interval has to be subdivided into many subintervals. 
 CM does the partition, and performs convergence checks, using an iterative 
 approach.
 However, if the function is smooth enough, no subdivision of the integration 
 interval is required. Those use-cases could benefit from the efficiency gain 
 of not performing a convergence check.
 The proposal is to provide a new interface UnivariateSingleStepIntegrator:
 {code}
 interface SingleIntervalIntegrator {
 /**
  * Method for implementing a single interval integration.
  * There is no convergence checks because it is not iterative.
  *
  * @param f Function to integrate.
  * @param lower Lower bound of the interval over which to integrate.
  * @param upper Upper bound of the interval over which to integrate.
  * @return the integrated value.
  */
 double integrate(UnivariateFunction f,
  double lower,
  double upper);
 }
 {code}
 In effect, the implementation of the above integrate method of a new 
 LegendreGaussIntegratorSingleStepIntegrator would the equivalent of 
 stage(1) in the current LegendreGaussIntegrator.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (MATH-797) Single step integrators

2012-06-03 Thread JIRA

[ 
https://issues.apache.org/jira/browse/MATH-797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13288163#comment-13288163
 ] 

Sébastien Brisard commented on MATH-797:


I have a jQuadrature project sitting in my workspace for almost two years now, 
which I'm very happy to refactor and contribute if we settle on a proper 
interface for Gauss integrators. I have currently implemented: Gauss-Legendre, 
Gauss-Chebyshev (first and second kinds), Gauss-Hermite. Integration points and 
weights are computed and cached if needed, so the order is not limited.

In NR for example, the integration points were computed with built-in Newton 
iterations. I chose bracketing instead. It may be a bit slower, but it's not 
called very often (only when new Gaussian rules are needed), and accuracy of 
the computed roots is then garanteed (to within 1ulp). It's more difficult to 
insure the accuracy of the weights (when you compute them on-the-fly), and I 
wrote a high accuracy computation of integration points and weights for the 
Gauss-Legendre rule, using {{BigDecimal}} (at that time, I knew but did not use 
Commons-Math, shame on me!).

If any of this seems interesting to you, it's right here !

One point worth noting: with Gauss integration schemes, I always wondered 
whether calling the integration method {{integrate(f, a, b)}} was a good idea. 
Indeed, generic integration schemes do not integrate the provided univariate 
function {{f(x)}}, but the weighted function {{f(x) * w(x)}}, which might be 
confusing. Of course, there is no such ambiguity with Gauss-Legendre...

 Single step integrators
 ---

 Key: MATH-797
 URL: https://issues.apache.org/jira/browse/MATH-797
 Project: Commons Math
  Issue Type: Wish
Affects Versions: 3.0
Reporter: Gilles
Assignee: Gilles
Priority: Trivial
 Fix For: 3.1


 CM assumes that the user wants to integrate a complex function on a large 
 interval, so the large interval has to be subdivided into many subintervals. 
 CM does the partition, and performs convergence checks, using an iterative 
 approach.
 However, if the function is smooth enough, no subdivision of the integration 
 interval is required. Those use-cases could benefit from the efficiency gain 
 of not performing a convergence check.
 The proposal is to provide a new interface UnivariateSingleStepIntegrator:
 {code}
 interface SingleIntervalIntegrator {
 /**
  * Method for implementing a single interval integration.
  * There is no convergence checks because it is not iterative.
  *
  * @param f Function to integrate.
  * @param lower Lower bound of the interval over which to integrate.
  * @param upper Upper bound of the interval over which to integrate.
  * @return the integrated value.
  */
 double integrate(UnivariateFunction f,
  double lower,
  double upper);
 }
 {code}
 In effect, the implementation of the above integrate method of a new 
 LegendreGaussIntegratorSingleStepIntegrator would the equivalent of 
 stage(1) in the current LegendreGaussIntegrator.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (MATH-797) Single step integrators

2012-06-03 Thread Luc Maisonobe (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13288195#comment-13288195
 ] 

Luc Maisonobe commented on MATH-797:


Sounds good.

If you intend to contribute a bunch of code that is already existing and not 
developed within the Apache Commons project, then we would need some paperwork 
before including it. All IP holders of this code should sign a Software Grant 
that allow the foundation to distribute this under the Apache V2 license. See 
[http://www.apache.org/licenses/#grants].

 Single step integrators
 ---

 Key: MATH-797
 URL: https://issues.apache.org/jira/browse/MATH-797
 Project: Commons Math
  Issue Type: Wish
Affects Versions: 3.0
Reporter: Gilles
Assignee: Gilles
Priority: Trivial
 Fix For: 3.1


 CM assumes that the user wants to integrate a complex function on a large 
 interval, so the large interval has to be subdivided into many subintervals. 
 CM does the partition, and performs convergence checks, using an iterative 
 approach.
 However, if the function is smooth enough, no subdivision of the integration 
 interval is required. Those use-cases could benefit from the efficiency gain 
 of not performing a convergence check.
 The proposal is to provide a new interface UnivariateSingleStepIntegrator:
 {code}
 interface SingleIntervalIntegrator {
 /**
  * Method for implementing a single interval integration.
  * There is no convergence checks because it is not iterative.
  *
  * @param f Function to integrate.
  * @param lower Lower bound of the interval over which to integrate.
  * @param upper Upper bound of the interval over which to integrate.
  * @return the integrated value.
  */
 double integrate(UnivariateFunction f,
  double lower,
  double upper);
 }
 {code}
 In effect, the implementation of the above integrate method of a new 
 LegendreGaussIntegratorSingleStepIntegrator would the equivalent of 
 stage(1) in the current LegendreGaussIntegrator.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (MATH-797) Single step integrators

2012-06-03 Thread JIRA

[ 
https://issues.apache.org/jira/browse/MATH-797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13288210#comment-13288210
 ] 

Sébastien Brisard commented on MATH-797:


No, no. That's personal code I've never managed to really finish...

 Single step integrators
 ---

 Key: MATH-797
 URL: https://issues.apache.org/jira/browse/MATH-797
 Project: Commons Math
  Issue Type: Wish
Affects Versions: 3.0
Reporter: Gilles
Assignee: Gilles
Priority: Trivial
 Fix For: 3.1


 CM assumes that the user wants to integrate a complex function on a large 
 interval, so the large interval has to be subdivided into many subintervals. 
 CM does the partition, and performs convergence checks, using an iterative 
 approach.
 However, if the function is smooth enough, no subdivision of the integration 
 interval is required. Those use-cases could benefit from the efficiency gain 
 of not performing a convergence check.
 The proposal is to provide a new interface UnivariateSingleStepIntegrator:
 {code}
 interface SingleIntervalIntegrator {
 /**
  * Method for implementing a single interval integration.
  * There is no convergence checks because it is not iterative.
  *
  * @param f Function to integrate.
  * @param lower Lower bound of the interval over which to integrate.
  * @param upper Upper bound of the interval over which to integrate.
  * @return the integrated value.
  */
 double integrate(UnivariateFunction f,
  double lower,
  double upper);
 }
 {code}
 In effect, the implementation of the above integrate method of a new 
 LegendreGaussIntegratorSingleStepIntegrator would the equivalent of 
 stage(1) in the current LegendreGaussIntegrator.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (MATH-797) Single step integrators

2012-06-02 Thread JIRA

[ 
https://issues.apache.org/jira/browse/MATH-797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13287998#comment-13287998
 ] 

Sébastien Brisard commented on MATH-797:


I don't really follow. Are you proposing to duplicate all existing integrators 
(one single step, one adaptative implementation)? The immediate answer would be 
to decide that all integrators are single step, and define one iterative 
integrator, which would be provided with a single step integrator at the time 
of construction. But that does not work (see below).

I think that we can't have one single policy for all integrators
* trapezoid, Simpson and Romberg integrators are iterative in nature, and IIRC, 
there are some clever optimisations which prevent the separation 
single-step/iterative: the next iteration has to have access to internal 
calculations done in the previous iteration.
* Gauss-like integrators are in my view single step integrators. Indeed, I 
think that people use Gauss integration schemes in order to have absolute 
control on the number of operations which are carried out. This goes opposite 
to the current implementation of these integrators in CM3.

So, to sum up, I think that if we were to create a second interface, maybe we 
could think about creating a GaussIntegrator, dedicated to Gaussian integration 
schemes. These schemes would not be iterative, like what is proposed in this 
ticket. All other existing integrators would remain unchanged.

By the way, the maximum number of integration points in the Gauss-Legendre 
scheme is limiting. I have some reliable (hi accuracy) code to compute the 
points and weights at any order. Also, I have an implementation for other 
Gauss-like schemes, which I'm happy to contribute if we can agree on a common 
interface with Gaussian integration schemes (which I find very useful and 
efficient).

 Single step integrators
 ---

 Key: MATH-797
 URL: https://issues.apache.org/jira/browse/MATH-797
 Project: Commons Math
  Issue Type: Wish
Affects Versions: 3.0
Reporter: Gilles
Assignee: Gilles
Priority: Trivial
 Fix For: 3.1


 CM assumes that the user wants to integrate a complex function on a large 
 interval, so the large interval has to be subdivided into many subintervals. 
 CM does the partition, and performs convergence checks, using an iterative 
 approach.
 However, if the function is smooth enough, no subdivision of the integration 
 interval is required. Those use-cases could benefit from the efficiency gain 
 of not performing a convergence check.
 The proposal is to provide a new interface UnivariateSingleStepIntegrator:
 {code}
 interface SingleIntervalIntegrator {
 /**
  * Method for implementing a single interval integration.
  * There is no convergence checks because it is not iterative.
  *
  * @param f Function to integrate.
  * @param lower Lower bound of the interval over which to integrate.
  * @param upper Upper bound of the interval over which to integrate.
  * @return the integrated value.
  */
 double integrate(UnivariateFunction f,
  double lower,
  double upper);
 }
 {code}
 In effect, the implementation of the above integrate method of a new 
 LegendreGaussIntegratorSingleStepIntegrator would the equivalent of 
 stage(1) in the current LegendreGaussIntegrator.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (MATH-797) Single step integrators

2012-06-02 Thread Gilles (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13288028#comment-13288028
 ] 

Gilles commented on MATH-797:
-

Actually, I filed this issue on behalf of another team within the project I 
work for.
They indeed are currently using a stripped-down (single step) version of the 
LegendreGaussIntegrator.
Their problem is mainly an efficiency one because for their use-case, they know 
in advance that a single iteration is enough.

So, your proposal is quite fine (i.e. focus only on  Gauss-like integrators and 
make them more flexible). Thanks!


 Single step integrators
 ---

 Key: MATH-797
 URL: https://issues.apache.org/jira/browse/MATH-797
 Project: Commons Math
  Issue Type: Wish
Affects Versions: 3.0
Reporter: Gilles
Assignee: Gilles
Priority: Trivial
 Fix For: 3.1


 CM assumes that the user wants to integrate a complex function on a large 
 interval, so the large interval has to be subdivided into many subintervals. 
 CM does the partition, and performs convergence checks, using an iterative 
 approach.
 However, if the function is smooth enough, no subdivision of the integration 
 interval is required. Those use-cases could benefit from the efficiency gain 
 of not performing a convergence check.
 The proposal is to provide a new interface UnivariateSingleStepIntegrator:
 {code}
 interface SingleIntervalIntegrator {
 /**
  * Method for implementing a single interval integration.
  * There is no convergence checks because it is not iterative.
  *
  * @param f Function to integrate.
  * @param lower Lower bound of the interval over which to integrate.
  * @param upper Upper bound of the interval over which to integrate.
  * @return the integrated value.
  */
 double integrate(UnivariateFunction f,
  double lower,
  double upper);
 }
 {code}
 In effect, the implementation of the above integrate method of a new 
 LegendreGaussIntegratorSingleStepIntegrator would the equivalent of 
 stage(1) in the current LegendreGaussIntegrator.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira