View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.commons.math3.linear;
18  
19  import org.apache.commons.math3.exception.MathIllegalArgumentException;
20  import org.apache.commons.math3.exception.util.LocalizedFormats;
21  
22  /**
23   * Exception to be thrown when a symmetric matrix is expected.
24   *
25   * @since 3.0
26   * @version $Id: NonSymmetricMatrixException.java 1416643 2012-12-03 19:37:14Z tn $
27   */
28  public class NonSymmetricMatrixException extends MathIllegalArgumentException {
29      /** Serializable version Id. */
30      private static final long serialVersionUID = -7518495577824189882L;
31      /** Row. */
32      private final int row;
33      /** Column. */
34      private final int column;
35      /** Threshold. */
36      private final double threshold;
37  
38      /**
39       * Construct an exception.
40       *
41       * @param row Row index.
42       * @param column Column index.
43       * @param threshold Relative symmetry threshold.
44       */
45      public NonSymmetricMatrixException(int row,
46                                         int column,
47                                         double threshold) {
48          super(LocalizedFormats.NON_SYMMETRIC_MATRIX, row, column, threshold);
49          this.row = row;
50          this.column = column;
51          this.threshold = threshold;
52      }
53  
54      /**
55       * @return the row index of the entry.
56       */
57      public int getRow() {
58          return row;
59      }
60      /**
61       * @return the column index of the entry.
62       */
63      public int getColumn() {
64          return column;
65      }
66      /**
67       * @return the relative symmetry threshold.
68       */
69      public double getThreshold() {
70          return threshold;
71      }
72  }