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.math4.legacy.linear; 18 19 import org.apache.commons.math4.legacy.exception.MathIllegalArgumentException; 20 import org.apache.commons.math4.legacy.exception.util.LocalizedFormats; 21 22 /** 23 * Exception to be thrown when a symmetric matrix is expected. 24 * 25 * @since 3.0 26 */ 27 public class NonSymmetricMatrixException extends MathIllegalArgumentException { 28 /** Serializable version Id. */ 29 private static final long serialVersionUID = -7518495577824189882L; 30 /** Row. */ 31 private final int row; 32 /** Column. */ 33 private final int column; 34 /** Threshold. */ 35 private final double threshold; 36 37 /** 38 * Construct an exception. 39 * 40 * @param row Row index. 41 * @param column Column index. 42 * @param threshold Relative symmetry threshold. 43 */ 44 public NonSymmetricMatrixException(int row, 45 int column, 46 double threshold) { 47 super(LocalizedFormats.NON_SYMMETRIC_MATRIX, row, column, threshold); 48 this.row = row; 49 this.column = column; 50 this.threshold = threshold; 51 } 52 53 /** 54 * @return the row index of the entry. 55 */ 56 public int getRow() { 57 return row; 58 } 59 /** 60 * @return the column index of the entry. 61 */ 62 public int getColumn() { 63 return column; 64 } 65 /** 66 * @return the relative symmetry threshold. 67 */ 68 public double getThreshold() { 69 return threshold; 70 } 71 }