1 /*
2 * Copyright (C) 2023 Alberto Irurueta Carro (alberto@irurueta.com)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package com.irurueta.numerical.integration;
17
18 import com.irurueta.algebra.WrongSizeException;
19
20 /**
21 * Computes function integration by using Romberg's method and Mid-Point Quadrature.
22 * Mid-point algorithm is suitable for improper integrations.
23 *
24 * @see MidPointMatrixQuadrature
25 */
26 public class RombergMidPointQuadratureMatrixIntegrator extends RombergMatrixIntegrator<MidPointMatrixQuadrature> {
27
28 /**
29 * Constructor.
30 *
31 * @param a Lower limit of integration.
32 * @param b Upper limit of integration.
33 * @param listener listener to evaluate a single dimension matrix (multivariate) function at
34 * required points.
35 * @param eps required accuracy.
36 * @throws WrongSizeException if size notified by provided listener is invalid.
37 */
38 public RombergMidPointQuadratureMatrixIntegrator(
39 final double a, final double b, final MatrixSingleDimensionFunctionEvaluatorListener listener,
40 final double eps) throws WrongSizeException {
41 super(new MidPointMatrixQuadrature(a, b, listener), eps);
42 }
43
44 /**
45 * Constructor with default accuracy.
46 *
47 * @param a Lower limit of integration.
48 * @param b Upper limit of integration.
49 * @param listener listener to evaluate a single dimension matrix (multivariate) function at
50 * required points.
51 * @throws WrongSizeException if size notified by provided listener is invalid.
52 */
53 public RombergMidPointQuadratureMatrixIntegrator(
54 final double a, final double b, final MatrixSingleDimensionFunctionEvaluatorListener listener)
55 throws WrongSizeException {
56 this(a, b, listener, EPS);
57 }
58
59 /**
60 * Gets type of quadrature.
61 *
62 * @return type of quadrature.
63 */
64 @Override
65 public QuadratureType getQuadratureType() {
66 return QuadratureType.MID_POINT;
67 }
68 }