View Javadoc
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.Matrix;
19  import com.irurueta.numerical.EvaluationException;
20  
21  /**
22   * Abstract base class for elementary matrix quadrature algorithms used for matrix (multivariate)
23   * single dimension function integration.
24   */
25  public abstract class MatrixQuadrature {
26      /**
27       * Current level of refinement.
28       */
29      protected int n;
30  
31      /**
32       * Gets current level of refinement.
33       *
34       * @return current level of refinement.
35       */
36      public int getN() {
37          return n;
38      }
39  
40      /**
41       * Returns the value of the integral at the nth stage of refinement.
42       *
43       * @param result instance where the value of the integral at the nth stage of refinement will
44       *               be stored.
45       * @throws EvaluationException Raised if something failed during the evaluation.
46       */
47      public abstract void next(final Matrix result) throws EvaluationException;
48  
49      /**
50       * Gets type of quadrature.
51       *
52       * @return type of quadrature.
53       */
54      public abstract QuadratureType getType();
55  
56      /**
57       * Gets number of rows of quadrature result.
58       *
59       * @return number of rows of quadrature result.
60       */
61      protected abstract int getRows();
62  
63      /**
64       * Gets number of columns of quadrature result.
65       *
66       * @return number of columns of quadrature result.
67       */
68      protected abstract int getColumns();
69  }