001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.commons.math4.legacy.linear;
018
019import org.apache.commons.math4.legacy.exception.MathIllegalArgumentException;
020import org.apache.commons.math4.legacy.exception.util.LocalizedFormats;
021
022/**
023 * Exception to be thrown when a symmetric matrix is expected.
024 *
025 * @since 3.0
026 */
027public class NonSymmetricMatrixException extends MathIllegalArgumentException {
028    /** Serializable version Id. */
029    private static final long serialVersionUID = -7518495577824189882L;
030    /** Row. */
031    private final int row;
032    /** Column. */
033    private final int column;
034    /** Threshold. */
035    private final double threshold;
036
037    /**
038     * Construct an exception.
039     *
040     * @param row Row index.
041     * @param column Column index.
042     * @param threshold Relative symmetry threshold.
043     */
044    public NonSymmetricMatrixException(int row,
045                                       int column,
046                                       double threshold) {
047        super(LocalizedFormats.NON_SYMMETRIC_MATRIX, row, column, threshold);
048        this.row = row;
049        this.column = column;
050        this.threshold = threshold;
051    }
052
053    /**
054     * @return the row index of the entry.
055     */
056    public int getRow() {
057        return row;
058    }
059    /**
060     * @return the column index of the entry.
061     */
062    public int getColumn() {
063        return column;
064    }
065    /**
066     * @return the relative symmetry threshold.
067     */
068    public double getThreshold() {
069        return threshold;
070    }
071}