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 matrix function integration by using double exponential quadrature.
22 * Double exponential quadrature allows improper integrands containing singularities to be
23 * integrated.
24 *
25 * @see DoubleExponentialRuleMatrixQuadrature
26 */
27 public class DoubleExponentialRuleQuadratureMatrixIntegrator
28 extends QuadratureMatrixIntegrator<DoubleExponentialRuleMatrixQuadrature> {
29
30 /**
31 * Constructor.
32 *
33 * @param a Lower limit of integration.
34 * @param b Upper limit of integration.
35 * @param hmax Maximum step size. This quadrature transforms the range of integration to
36 * [-hmax, hmax].
37 * @param listener listener to evaluate a single dimension matrix (multivariate) function at
38 * required points.
39 * @param eps required accuracy.
40 * @throws WrongSizeException if size notified by provided listener is invalid.
41 */
42 public DoubleExponentialRuleQuadratureMatrixIntegrator(
43 final double a, final double b, final double hmax,
44 final MatrixSingleDimensionFunctionEvaluatorListener listener, final double eps) throws WrongSizeException {
45 super(new DoubleExponentialRuleMatrixQuadrature(listener, a, b, hmax), eps);
46 }
47
48 /**
49 * Constructor.
50 *
51 * @param a Lower limit of integration.
52 * @param b Upper limit of integration.
53 * @param listener listener to evaluate a single dimension matrix (multivariate) function at
54 * required points.
55 * @param eps required accuracy.
56 * @throws WrongSizeException if size notified by provided listener is invalid.
57 */
58 public DoubleExponentialRuleQuadratureMatrixIntegrator(
59 final double a, final double b, final MatrixSingleDimensionFunctionEvaluatorListener listener,
60 final double eps) throws WrongSizeException {
61 super(new DoubleExponentialRuleMatrixQuadrature(listener, a, b), eps);
62 }
63
64 /**
65 * Constructor with default accuracy.
66 *
67 * @param a Lower limit of integration.
68 * @param b Upper limit of integration.
69 * @param hmax Maximum step size. This quadrature transforms the range of integration to
70 * [-hmax, hmax].
71 * @param listener listener to evaluate a single dimension matrix (multivariate) function at
72 * required points.
73 * @throws WrongSizeException if size notified by provided listener is invalid.
74 */
75 public DoubleExponentialRuleQuadratureMatrixIntegrator(
76 final double a, final double b, final double hmax,
77 final MatrixSingleDimensionFunctionEvaluatorListener listener) throws WrongSizeException {
78 this(a, b, hmax, listener, EPS);
79 }
80
81 /**
82 * Constructor with default accuracy and default maximum step size.
83 *
84 * @param a Lower limit of integration.
85 * @param b Upper limit of integration.
86 * @param listener listener to evaluate a single dimension matrix (multivariate) function at
87 * required points.
88 * @throws WrongSizeException if size notified by provided listener is invalid.
89 */
90 public DoubleExponentialRuleQuadratureMatrixIntegrator(
91 final double a, final double b, final MatrixSingleDimensionFunctionEvaluatorListener listener)
92 throws WrongSizeException {
93 this(a, b, listener, EPS);
94 }
95
96 /**
97 * Constructor.
98 *
99 * @param a Lower limit of integration.
100 * @param b Upper limit of integration.
101 * @param hmax Maximum step size. This quadrature transforms the range of integration to
102 * [-hmax, hmax].
103 * @param listener listener to evaluate a single dimension function at required points for
104 * double exponential quadrature to take into account any non-mild
105 * singularities.
106 * @param eps required accuracy.
107 * @throws WrongSizeException if size notified by provided listener is invalid.
108 */
109 public DoubleExponentialRuleQuadratureMatrixIntegrator(
110 final double a, final double b, final double hmax,
111 final DoubleExponentialMatrixSingleDimensionFunctionEvaluatorListener listener, final double eps)
112 throws WrongSizeException {
113 super(new DoubleExponentialRuleMatrixQuadrature(listener, a, b, hmax), eps);
114 }
115
116 /**
117 * Constructor with default maximum step size.
118 *
119 * @param a Lower limit of integration.
120 * @param b Upper limit of integration.
121 * @param listener listener to evaluate a single dimension function at required points for
122 * double exponential quadrature to take into account any non-mild
123 * singularities.
124 * @param eps required accuracy.
125 * @throws WrongSizeException if size notified by provided listener is invalid.
126 */
127 public DoubleExponentialRuleQuadratureMatrixIntegrator(
128 final double a, final double b,
129 final DoubleExponentialMatrixSingleDimensionFunctionEvaluatorListener listener, final double eps)
130 throws WrongSizeException {
131 super(new DoubleExponentialRuleMatrixQuadrature(listener, a, b), eps);
132 }
133
134 /**
135 * Constructor with default accuracy.
136 *
137 * @param a Lower limit of integration.
138 * @param b Upper limit of integration.
139 * @param hmax Maximum step size. This quadrature transforms the range of integration to
140 * [-hmax, hmax].
141 * @param listener listener to evaluate a single dimension function at required points for
142 * double exponential quadrature to take into account any non-mild
143 * singularities.
144 * @throws WrongSizeException if size notified by provided listener is invalid.
145 */
146 public DoubleExponentialRuleQuadratureMatrixIntegrator(
147 final double a, final double b, final double hmax,
148 final DoubleExponentialMatrixSingleDimensionFunctionEvaluatorListener listener) throws WrongSizeException {
149 this(a, b, hmax, listener, EPS);
150 }
151
152 /**
153 * Constructor with default accuracy and default maximum step size.
154 *
155 * @param a Lower limit of integration.
156 * @param b Upper limit of integration.
157 * @param listener listener to evaluate a single dimension function at required points for
158 * double exponential quadrature to take into account any non-mild
159 * singularities.
160 * @throws WrongSizeException if size notified by provided listener is invalid.
161 */
162 public DoubleExponentialRuleQuadratureMatrixIntegrator(
163 final double a, final double b,
164 final DoubleExponentialMatrixSingleDimensionFunctionEvaluatorListener listener) throws WrongSizeException {
165 this(a, b, listener, EPS);
166 }
167
168 /**
169 * Gets type of quadrature.
170 *
171 * @return type of quadrature.
172 */
173 @Override
174 public QuadratureType getQuadratureType() {
175 return QuadratureType.DOUBLE_EXPONENTIAL_RULE;
176 }
177 }