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 single dimension matrix (multivariate) function integration by using Mid-Point
22 * quadrature up to desired accuracy.
23 */
24 public class MidPointQuadratureMatrixIntegrator extends QuadratureMatrixIntegrator<MidPointMatrixQuadrature> {
25
26 /**
27 * Constructor.
28 *
29 * @param a Lower limit of integration.
30 * @param b Upper limit of integration.
31 * @param listener listener to evaluate a single dimension matrix (multivariate) function at
32 * required points.
33 * @param eps required accuracy.
34 * @throws WrongSizeException if size notified by provided listener is invalid.
35 */
36 public MidPointQuadratureMatrixIntegrator(
37 final double a, final double b, final MatrixSingleDimensionFunctionEvaluatorListener listener,
38 final double eps) throws WrongSizeException {
39 super(new MidPointMatrixQuadrature(a, b, listener), eps);
40 }
41
42 /**
43 * Constructor with default accuracy.
44 *
45 * @param a Lower limit of integration.
46 * @param b Upper limit of integration.
47 * @param listener listener to evaluate a single dimension function at required points.
48 * @throws WrongSizeException if size notified by provided listener is invalid.
49 */
50 public MidPointQuadratureMatrixIntegrator(
51 final double a, final double b, final MatrixSingleDimensionFunctionEvaluatorListener listener)
52 throws WrongSizeException {
53 this(a, b, listener, EPS);
54 }
55
56 /**
57 * Gets type of quadrature.
58 *
59 * @return type of quadrature.
60 */
61 @Override
62 public QuadratureType getQuadratureType() {
63 return QuadratureType.MID_POINT;
64 }
65 }