DoubleIntervalMatrix.java

/*
 * Created on 2003/07/29
 *
 * Copyright (C) 2004 Koga Laboratory. All rights reserved.
 */
package org.mklab.cga.interval.matrix;

import java.io.Writer;

import org.mklab.cga.interval.scalar.DoubleComplexIntervalNumber;
import org.mklab.cga.interval.scalar.DoubleIntervalNumber;
import org.mklab.cga.util.IntervalUtil;
import org.mklab.nfc.eig.BalancedDecomposition;
import org.mklab.nfc.eig.EigenSolution;
import org.mklab.nfc.eig.HessenbergDecomposition;
import org.mklab.nfc.eig.QRDecomposition;
import org.mklab.nfc.eig.RealQZDecomposition;
import org.mklab.nfc.eig.SchurDecomposition;
import org.mklab.nfc.leq.LUDecomposition;
import org.mklab.nfc.matrix.BooleanMatrix;
import org.mklab.nfc.matrix.DoubleComplexMatrix;
import org.mklab.nfc.matrix.DoubleMatrix;
import org.mklab.nfc.matrix.ElementHolder;
import org.mklab.nfc.matrix.Grid;
import org.mklab.nfc.matrix.IndexedMatrix;
import org.mklab.nfc.matrix.IntMatrix;
import org.mklab.nfc.matrix.NormType;
import org.mklab.nfc.scalar.DoubleComplexNumber;
import org.mklab.nfc.scalar.DoubleNumber;
import org.mklab.nfc.svd.SingularValueDecomposition;
import org.mklab.nfc.util.RoundMode;
import org.mklab.nfc.util.RoundModeManager;


/**
 * 実区間行列を表すクラスです。
 * 
 * @author Hiroki
 * @version $Revision: 1.72 $. 2004/07/01
 * 
 */
/**
 * @author koga
 * @version $Revision$, 2021/09/12
 */
public class DoubleIntervalMatrix extends
    AbstractIntervalRealNumericalMatrix<DoubleIntervalNumber, DoubleIntervalMatrix, DoubleComplexIntervalNumber, DoubleComplexIntervalMatrix, DoubleNumber, DoubleMatrix, DoubleComplexNumber, DoubleComplexMatrix> {

  /** シリアル番号 */
  public static final long serialVersionUID = 2639523584526372986L;

  /**
   * 区間の配列から区間行列を作成します。
   * 
   * @param intervals 行列の要素(区間)
   */
  public DoubleIntervalMatrix(DoubleIntervalNumber[][] intervals) {
    super(intervals);
  }

  //  /**
  //   * 区間の配列から区間行列を作成します。
  //   * 
  //   * @param intervals 行列の要素(区間)
  //   */
  //  public DoubleIntervalMatrix(int rowSize, int columnSize, DoubleIntervalNumber[][] intervals) {
  //    super(rowSize, columnSize, intervals);
  //
  //    int rowSize = intervals.length;
  //    int columnSize = intervals[0].length;
  //
  //    E unit = intervals[0][0].getMiddle();
  //    E[][] infElements = unit.createArray(rowSize, columnSize);
  //    E[][] supElements = unit.createArray(rowSize, columnSize);
  //
  //    for (int i = 0; i < rowSize; i++) {
  //      for (int j = 0; j < columnSize; j++) {
  //        final DoubleIntervalNumber interval = intervals[i][j];
  //        if (interval.isReal() == false) {
  //          throw new IllegalArgumentException(Messages.getString("RealIntervalMatrix.0")); //$NON-NLS-1$
  //        }
  //
  //        infElements[i][j] = interval.getInfimum();
  //        supElements[i][j] = interval.getSupremum();
  //      }
  //    }
  //
  //    DoubleMatrix inf = infElements[0][0].createGrid(rowSize, columnSize, infElements);
  //    DoubleMatrix sup = supElements[0][0].createGrid(rowSize, columnSize, supElements);
  //
  //    this.infimum = inf;
  //    this.supremum = sup;
  //    this.middle = mid(inf, sup);
  //    this.radius = rad(this.middle, inf);
  //  }

  /**
   * 区間の配列から区間行列を作成します
   * 
   * @param intervals 行列の要素(区間)
   */
  public DoubleIntervalMatrix(DoubleIntervalNumber[] intervals) {
    super(intervals);

    //    final int size = intervals.length;
    //
    //    E unit = intervals[0].getMiddle();
    //    E[][] infElements = unit.createArray(size, 1);
    //    E[][] supElements = unit.createArray(size, 1);
    //
    //    for (int i = 0; i < size; i++) {
    //      final DoubleIntervalNumber interval = intervals[i];
    //      if (interval.isReal() == false) {
    //        throw new IllegalArgumentException(Messages.getString("RealIntervalMatrix.1")); //$NON-NLS-1$
    //      }
    //
    //      infElements[i][0] = interval.getInfimum();
    //      supElements[i][0] = interval.getSupremum();
    //    }
    //
    //    DoubleMatrix inf = infElements[0][0].createGrid(size, 1, infElements);
    //    DoubleMatrix sup = supElements[0][0].createGrid(size, 1, supElements);
    //
    //    this.infimum = inf;
    //    this.supremum = sup;
    //    this.middle = mid(inf, sup);
    //    this.radius = rad(this.middle, inf);
  }

  /**
   * 指定された上限と下限をもつ実区間行列を生成します。
   * 
   * @param infimum 下限
   * @param supremum 上限
   */
  public DoubleIntervalMatrix(final DoubleMatrix infimum, final DoubleMatrix supremum) {
    super(infimum, supremum);

    //    this.infimum = infimum;
    //    this.supremum = supremum;
    //    this.middle = mid(infimum, supremum);
    //    this.radius = rad(this.middle, infimum);
  }

  /**
   * 指定された行列を上限と下限とする実区間行列を生成します。
   * 
   * @param x 行列
   */
  public DoubleIntervalMatrix(final DoubleMatrix x) {
    super(x);

    //    this.middle = x;
    //    this.radius = x.createZero();
    //    this.infimum = x.clone();
    //    this.supremum = x.clone();
  }

  //  /**
  //   * 指定された中心と半径をもつ実区間行列を生成します。
  //   * 
  //   * @param <T> 成分の型
  //   * 
  //   * @param middle 中心
  //   * @param radius 半径
  //   * @return 実区間行列
  //   */
  //  public static <IS extends IntervalScalar<IS,IM,S,M>, IM extends DoubleIntervalMatrix<IS,IM,S,M>, S extends NumericalScalar<S,M>, M extends NumericalMatrix<S,M> > IM createWithMiddleRadius(M middle, M radius) {
  //    if (middle.isReal() == false || radius.isReal() == false) {
  //      throw new IllegalArgumentException("Not a real matrix"); //$NON-NLS-1$
  //    }
  //
  //    final DoubleIntervalMatrix ans = new DoubleIntervalMatrix();
  //    ans.middle = middle;
  //    ans.radius = radius;
  //    ans.infimum = ans.inf(middle, radius);
  //    ans.supremum = ans.sup(middle, radius);
  //    return ans;
  //  }

  //  /**
  //   * 指定された下限と上限をもつ実区間行列を生成します。
  //   * 
  //   * @param infimum 下限
  //   * @param supremum 上限
  //   * @return 実区間行列
  //   */
  //  public static RealIntervalMatrix createWithInfimumSupremum(NumericalMatrixOperator<?> infimum, NumericalMatrixOperator<?> supremum) {
  //    if (infimum.isReal() == false || supremum.isReal() == false) {
  //      throw new IllegalArgumentException("Not a real matrix"); //$NON-NLS-1$
  //    }
  //
  //    final RealIntervalMatrix ans = new RealIntervalMatrix();
  //    
  //    ans.infimum = infimum;
  //    ans.supremum = supremum;
  //    ans.middle = ans.mid(infimum, supremum);
  //    ans.radius = ans.rad(ans.middle, infimum);
  //    return ans;
  //  }

  /**
   * Creates double interval matrix with middle and radius.
   * 
   * @param mid middle
   * @param rad radius
   * @return double interval matrix
   */
  public static DoubleIntervalMatrix createMiddleRadius(DoubleMatrix mid, DoubleMatrix rad) {
    DoubleMatrix inf = infimum(mid, rad);
    DoubleMatrix sup = supremum(mid, rad);
    return new DoubleIntervalMatrix(inf, sup);
  }

  /**
   * Creates double interval matrix with infimum and supremum
   * 
   * @param inf infimum
   * @param sup supremum
   * @return double interval matrix
   */
  public static DoubleIntervalMatrix createInfimumSupremum(DoubleMatrix inf, DoubleMatrix sup) {
    return new DoubleIntervalMatrix(inf, sup);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix createInfSup(DoubleMatrix infimum, DoubleMatrix supremum) {
    return new DoubleIntervalMatrix(infimum, supremum);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix create(DoubleMatrix value) {
    return new DoubleIntervalMatrix(value);
  }
  
  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix createMidRad(DoubleMatrix middle, DoubleMatrix radius) {
    return DoubleIntervalMatrix.createMiddleRadius(middle, radius);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleComplexIntervalMatrix createMidRad(DoubleComplexMatrix middle, DoubleMatrix radius) {
    return new DoubleComplexIntervalMatrix(middle, radius);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleComplexIntervalMatrix createInfSup(DoubleComplexMatrix infimum, DoubleComplexMatrix supremum) {
    return DoubleComplexIntervalMatrix.createInfimumSupremum(infimum, supremum);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleMatrix getRadius() {
    return this.radius;
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix createZero(final int rowSize, final int columnSize) {
    return new DoubleIntervalMatrix(this.radius.createZero(rowSize, columnSize));
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix createOnes(final int rowSize, final int columnSize) {
    return new DoubleIntervalMatrix(this.middle.createOnes(rowSize, columnSize));
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix createUnit(final int rowSize, final int columnSize) {
    return new DoubleIntervalMatrix(this.middle.createUnit(rowSize, columnSize));
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix add(final DoubleIntervalMatrix y) {
    RoundModeManager manager = RoundModeManager.getManager();
    RoundMode oldRoundMode = manager.getRoundMode();

    manager.setRoundMode(RoundMode.ROUND_DOWN);
    DoubleMatrix inf = this.infimum.add(y.getInfimum());

    manager.setRoundMode(RoundMode.ROUND_UP);
    DoubleMatrix sup = this.supremum.add(y.getSupremum());

    manager.setRoundMode(oldRoundMode);
    return new DoubleIntervalMatrix(inf, sup);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix addElementWise(final DoubleIntervalNumber y) {// IRM+IR, IRM+IC
    RoundModeManager manager = RoundModeManager.getManager();
    RoundMode oldRoundMode = manager.getRoundMode();

    manager.setRoundMode(RoundMode.ROUND_DOWN);
    DoubleMatrix inf = this.infimum.addElementWise((y).getInfimum().doubleValue());

    manager.setRoundMode(RoundMode.ROUND_UP);
    DoubleMatrix sup = this.supremum.addElementWise((y).getSupremum().doubleValue());

    manager.setRoundMode(oldRoundMode);
    return new DoubleIntervalMatrix(inf, sup);
  }

  //  /**
  //   * @see org.mklab.cga.interval.matrix.IntervalMatrix#add(org.mklab.nfc.matrix.Matrix)
  //   */
  //  @Override
  //  public DoubleIntervalMatrix add(final Matrix y) {
  //    if (y instanceof DoubleIntervalMatrix) {
  //      return add((IntervalMatrix<?>)y);
  //    }
  //
  //    RoundModeManager manager = RoundModeManager.getManager();
  //    RoundMode oldRoundMode = manager.getRoundMode();
  //
  //    if (y.isReal()) {
  //      manager.setRoundMode(RoundMode.ROUND_DOWN);
  //      DoubleMatrix inf = this.infimum.add(y);
  //
  //      manager.setRoundMode(RoundMode.ROUND_UP);
  //      DoubleMatrix sup = this.supremum.add(y);
  //
  //      manager.setRoundMode(oldRoundMode);
  //      return new DoubleIntervalMatrix(inf, sup);
  //    }
  //
  //    manager.setRoundMode(RoundMode.ROUND_DOWN);
  //    DoubleMatrix c1 = this.middle.add(y);
  //
  //    manager.setRoundMode(RoundMode.ROUND_UP);
  //    DoubleMatrix mid = this.middle.add(y);
  //    DoubleMatrix rad = (mid.subtract(c1)).absElementWise().add(this.radius);
  //
  //    manager.setRoundMode(oldRoundMode);
  //    return new AbstractIntervalComplexNumericalMatrix(mid, rad);
  //  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix addElementWise(final int y) {
    RoundModeManager manager = RoundModeManager.getManager();
    RoundMode oldRoundMode = manager.getRoundMode();

    manager.setRoundMode(RoundMode.ROUND_DOWN);
    DoubleMatrix inf = this.infimum.addElementWise(y);

    manager.setRoundMode(RoundMode.ROUND_UP);
    DoubleMatrix sup = this.supremum.addElementWise(y);

    manager.setRoundMode(oldRoundMode);
    return createInfSup(inf, sup);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix addElementWise(final double y) {
    RoundModeManager manager = RoundModeManager.getManager();
    RoundMode oldRoundMode = manager.getRoundMode();

    manager.setRoundMode(RoundMode.ROUND_DOWN);
    DoubleMatrix inf = this.infimum.addElementWise(y);

    manager.setRoundMode(RoundMode.ROUND_UP);
    DoubleMatrix sup = this.supremum.addElementWise(y);

    manager.setRoundMode(oldRoundMode);
    return createInfSup(inf, sup);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix addElementWise(final DoubleNumber y) {
    RoundModeManager manager = RoundModeManager.getManager();
    RoundMode oldRoundMode = manager.getRoundMode();

    manager.setRoundMode(RoundMode.ROUND_DOWN);
    DoubleMatrix inf = this.infimum.addElementWise(y);

    manager.setRoundMode(RoundMode.ROUND_UP);
    DoubleMatrix sup = this.supremum.addElementWise(y);

    manager.setRoundMode(oldRoundMode);
    return new DoubleIntervalMatrix(inf, sup);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix subtract(final DoubleIntervalMatrix y) {
    RoundModeManager manager = RoundModeManager.getManager();
    RoundMode oldRoundMode = manager.getRoundMode();

    manager.setRoundMode(RoundMode.ROUND_DOWN);
    DoubleMatrix inf = this.infimum.subtract(y.getSupremum());

    manager.setRoundMode(RoundMode.ROUND_UP);
    DoubleMatrix sup = this.supremum.subtract(y.getInfimum());

    manager.setRoundMode(oldRoundMode);
    return new DoubleIntervalMatrix(inf, sup);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix subtractElementWise(final DoubleIntervalNumber y) {
    RoundModeManager manager = RoundModeManager.getManager();
    RoundMode oldRoundMode = manager.getRoundMode();

    manager.setRoundMode(RoundMode.ROUND_DOWN);
    DoubleMatrix inf = this.infimum.subtractElementWise(y.getSupremum());

    manager.setRoundMode(RoundMode.ROUND_UP);
    DoubleMatrix sup = this.supremum.subtractElementWise(y.getInfimum());

    manager.setRoundMode(oldRoundMode);
    return new DoubleIntervalMatrix(inf, sup);
  }

  //  /**
  //   * @see org.mklab.cga.interval.matrix.IntervalMatrix#subtract(org.mklab.nfc.matrix.Matrix)
  //   */
  //  @Override
  //  public DoubleIntervalMatrix subtract(final Matrix y) {
  //    if (y instanceof DoubleIntervalMatrix) {
  //      return subtract((IntervalMatrix<?>)y);
  //    }
  //
  //    RoundModeManager manager = RoundModeManager.getManager();
  //    RoundMode oldRoundMode = manager.getRoundMode();
  //
  //    if (y.isReal()) {
  //      manager.setRoundMode(RoundMode.ROUND_DOWN);
  //      DoubleMatrix inf = this.infimum.subtract(y);
  //
  //      manager.setRoundMode(RoundMode.ROUND_UP);
  //      DoubleMatrix sup = this.supremum.subtract(y);
  //
  //      manager.setRoundMode(oldRoundMode);
  //      return new DoubleIntervalMatrix(inf, sup);
  //    }
  //
  //    manager.setRoundMode(RoundMode.ROUND_DOWN);
  //    DoubleMatrix c1 = this.middle.subtract(y);
  //
  //    manager.setRoundMode(RoundMode.ROUND_UP);
  //    DoubleMatrix mid = this.middle.subtract(y);
  //    DoubleMatrix rad = (mid.subtract(c1)).absElementWise().add(this.radius);
  //
  //    manager.setRoundMode(oldRoundMode);
  //    return new AbstractIntervalComplexNumericalMatrix(mid, rad);
  //  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix subtractElementWise(final int y) {
    RoundModeManager manager = RoundModeManager.getManager();
    RoundMode oldRoundMode = manager.getRoundMode();

    manager.setRoundMode(RoundMode.ROUND_DOWN);
    DoubleMatrix inf = this.infimum.subtractElementWise(y);

    manager.setRoundMode(RoundMode.ROUND_UP);
    DoubleMatrix sup = this.supremum.subtractElementWise(y);

    manager.setRoundMode(oldRoundMode);
    return createInfSup(inf, sup);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix subtractElementWise(final double y) {
    RoundModeManager manager = RoundModeManager.getManager();
    RoundMode oldRoundMode = manager.getRoundMode();

    manager.setRoundMode(RoundMode.ROUND_DOWN);
    DoubleMatrix inf = this.infimum.subtractElementWise(y);

    manager.setRoundMode(RoundMode.ROUND_UP);
    DoubleMatrix sup = this.supremum.subtractElementWise(y);

    manager.setRoundMode(oldRoundMode);
    return createInfSup(inf, sup);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix subtractElementWise(final DoubleNumber y) {
    RoundModeManager manager = RoundModeManager.getManager();
    RoundMode oldRoundMode = manager.getRoundMode();

    manager.setRoundMode(RoundMode.ROUND_DOWN);
    DoubleMatrix inf = this.infimum.subtractElementWise(y);

    manager.setRoundMode(RoundMode.ROUND_UP);
    DoubleMatrix sup = this.supremum.subtractElementWise(y);

    manager.setRoundMode(oldRoundMode);
    return new DoubleIntervalMatrix(inf, sup);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix multiply(final DoubleIntervalMatrix y) {
    RoundModeManager manager = RoundModeManager.getManager();
    RoundMode oldRoundMode = manager.getRoundMode();

    manager.setRoundMode(RoundMode.ROUND_UP);
    DoubleMatrix xc = this.supremum.add(this.infimum).divide(2);
    DoubleMatrix xr = xc.subtract(this.infimum);
    DoubleMatrix yc = y.getSupremum().add(y.getInfimum()).divide(2);
    DoubleMatrix yr = yc.subtract(y.getInfimum());
    DoubleMatrix sup = (xc.multiply(yc)).add((xc).absElementWise().multiply(yr)).add(xr.multiply((yc).absElementWise())).add(xr.multiply(yr));

    manager.setRoundMode(RoundMode.ROUND_DOWN);
    DoubleMatrix inf = (xc.multiply(yc)).add((xc).absElementWise().unaryMinus().multiply(yr).add(xr.multiply((yc).absElementWise().unaryMinus()).add(xr.unaryMinus().multiply(yr))));

    manager.setRoundMode(oldRoundMode);
    return new DoubleIntervalMatrix(inf, sup);
  }

  //  /**
  //   * @see org.mklab.cga.interval.matrix.IntervalMatrix#multiply(org.mklab.nfc.matrix.Matrix)
  //   */
  //  @Override
  //  @SuppressWarnings("unchecked")
  //  public DoubleIntervalMatrix multiply(final Matrix y) {
  //    if (y instanceof DoubleIntervalMatrix) {
  //      return multiply((IntervalMatrix<?>)y);
  //    }
  //
  //    RoundModeManager manager = RoundModeManager.getManager();
  //    RoundMode oldRoundMode = manager.getRoundMode();
  //
  //    if (y.isReal()) {
  //      manager.setRoundMode(RoundMode.ROUND_UP);
  //      DoubleMatrix rad = this.radius.multiply((y).absElementWise());
  //      DoubleMatrix sup = this.middle.multiply(y).add(rad);
  //
  //      manager.setRoundMode(RoundMode.ROUND_DOWN);
  //      DoubleMatrix inf = this.middle.multiply(y).subtract(rad);
  //
  //      manager.setRoundMode(oldRoundMode);
  //      return new DoubleIntervalMatrix(inf, sup);
  //    }
  //
  //    manager.setRoundMode(RoundMode.ROUND_DOWN);
  //    DoubleMatrix c1 = this.middle.multiply(y);
  //
  //    manager.setRoundMode(RoundMode.ROUND_UP);
  //    DoubleMatrix c2 = this.middle.multiply(y);
  //    DoubleMatrix mid = (c1.add(c2.subtract(c1))).absElementWise();
  //    DoubleMatrix rad = (mid.subtract(c1).add(this.radius.multiply(y))).absElementWise();
  //
  //    manager.setRoundMode(oldRoundMode);
  //    return new AbstractIntervalComplexNumericalMatrix((NumericalMatrix)mid.toComplex(), rad);
  //  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix multiplyElementWise(final DoubleIntervalMatrix b) {
    RoundModeManager manager = RoundModeManager.getManager();
    RoundMode oldRoundMode = manager.getRoundMode();

    manager.setRoundMode(RoundMode.ROUND_DOWN);
    DoubleMatrix inf = (this.infimum.multiplyElementWise(b.getInfimum())).minElementWise(this.infimum.multiplyElementWise(b.getSupremum()));
    inf = (inf).minElementWise(this.supremum.multiplyElementWise(b.getInfimum()));
    inf = (inf).minElementWise(this.supremum.multiplyElementWise(b.getSupremum()));

    manager.setRoundMode(RoundMode.ROUND_UP);
    DoubleMatrix sup = (this.infimum.multiplyElementWise(b.getInfimum())).maxElementWise(this.infimum.multiplyElementWise(b.getSupremum()));
    sup = (sup).maxElementWise(this.supremum.multiplyElementWise(b.getInfimum()));
    sup = (sup).maxElementWise(this.supremum.multiplyElementWise(b.getSupremum()));

    manager.setRoundMode(oldRoundMode);
    return new DoubleIntervalMatrix(inf, sup);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix multiply(final DoubleIntervalNumber b) {
    RoundModeManager manager = RoundModeManager.getManager();
    RoundMode oldRoundMode = manager.getRoundMode();

    manager.setRoundMode(RoundMode.ROUND_DOWN);
    DoubleMatrix inf = (this.infimum.multiply(b.getInfimum())).minElementWise(this.getInfimum().multiply(b.getSupremum()));
    inf = (inf).minElementWise(this.supremum.multiply(b.getInfimum()));
    inf = (inf).minElementWise(this.supremum.multiply(b.getSupremum()));

    manager.setRoundMode(RoundMode.ROUND_UP);
    DoubleMatrix sup = (this.infimum.multiply(b.getInfimum())).maxElementWise(this.infimum.multiply(b.getSupremum()));
    sup = (sup).maxElementWise(this.supremum.multiply(b.getInfimum()));
    sup = (sup).maxElementWise(this.supremum.multiply(b.getSupremum()));

    manager.setRoundMode(oldRoundMode);
    return new DoubleIntervalMatrix(inf, sup);
  }

  //  /**
  //   * @see org.mklab.cga.interval.matrix.IntervalMatrix#multiplyElementWise(org.mklab.nfc.matrix.Matrix)
  //   */
  //  @Override
  //  public DoubleIntervalMatrix multiplyElementWise(final Matrix y) {
  //    if (y instanceof DoubleIntervalMatrix) {
  //      return multiplyElementWise((IntervalMatrix<?>)y);
  //    }
  //
  //    RoundModeManager manager = RoundModeManager.getManager();
  //    RoundMode oldRoundMode = manager.getRoundMode();
  //
  //    if (y.isReal()) {
  //      manager.setRoundMode(RoundMode.ROUND_DOWN);
  //      DoubleMatrix inf = (this.infimum.multiplyElementWise(y)).minElementWise(this.supremum.multiplyElementWise(y));
  //
  //      manager.setRoundMode(RoundMode.ROUND_UP);
  //      DoubleMatrix sup = (this.infimum.multiplyElementWise(y)).maxElementWise(this.supremum.multiplyElementWise(y));
  //
  //      manager.setRoundMode(oldRoundMode);
  //      return new DoubleIntervalMatrix(inf, sup);
  //    }
  //
  //    manager.setRoundMode(RoundMode.ROUND_DOWN);
  //    DoubleMatrix c1 = this.middle.multiplyElementWise(y);
  //
  //    manager.setRoundMode(RoundMode.ROUND_UP);
  //    DoubleMatrix c2 = this.middle.multiplyElementWise(y);
  //    DoubleMatrix mid = c1.add(c2.subtract(c1).divide(2));
  //    DoubleMatrix rad = (mid.subtract(c1)).absElementWise().add(this.radius.multiplyElementWise((y).absElementWise()));
  //
  //    manager.setRoundMode(oldRoundMode);
  //    return new AbstractIntervalComplexNumericalMatrix(mid, rad);
  //  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix multiply(final int y) {// IR*R
    RoundModeManager manager = RoundModeManager.getManager();
    RoundMode oldRoundMode = manager.getRoundMode();

    manager.setRoundMode(RoundMode.ROUND_DOWN);
    DoubleMatrix inf = (this.infimum.multiply(y)).minElementWise(this.supremum.multiply(y));

    manager.setRoundMode(RoundMode.ROUND_UP);
    DoubleMatrix sup = (this.infimum.multiply(y)).maxElementWise(this.supremum.multiply(y));

    manager.setRoundMode(oldRoundMode);
    return createInfSup(inf, sup);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix multiply(final double y) {// IR*R
    RoundModeManager manager = RoundModeManager.getManager();
    RoundMode oldRoundMode = manager.getRoundMode();

    manager.setRoundMode(RoundMode.ROUND_DOWN);
    DoubleMatrix inf = (this.infimum.multiply(y)).minElementWise(this.supremum.multiply(y));

    manager.setRoundMode(RoundMode.ROUND_UP);
    DoubleMatrix sup = (this.infimum.multiply(y)).maxElementWise(this.supremum.multiply(y));

    manager.setRoundMode(oldRoundMode);
    return createInfSup(inf, sup);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix multiply(final DoubleNumber d) {
    RoundModeManager manager = RoundModeManager.getManager();
    RoundMode oldRoundMode = manager.getRoundMode();

    manager.setRoundMode(RoundMode.ROUND_DOWN);
    DoubleMatrix inf = (this.infimum.multiply(d)).minElementWise(this.supremum.multiply(d));

    manager.setRoundMode(RoundMode.ROUND_UP);
    DoubleMatrix sup = (this.infimum.multiply(d)).maxElementWise(this.supremum.multiply(d));

    manager.setRoundMode(oldRoundMode);
    return new DoubleIntervalMatrix(inf, sup);
  }

  //  /**
  //   * @see org.mklab.nfc.matrix.MatrixElementWiseOperator#divideElementWise(org.mklab.nfc.matrix.Matrix)
  //   */
  //  @Override
  //  public DoubleIntervalMatrix divideElementWise(final Matrix b) {
  //    if (b instanceof DoubleIntervalMatrix) {
  //      return divideElementWise((IntervalMatrix<?>)b);
  //    }
  //
  //    throw new RuntimeException("Not implemented."); //$NON-NLS-1$
  //  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix divideElementWise(final DoubleIntervalMatrix b) {
    RoundModeManager manager = RoundModeManager.getManager();
    RoundMode oldRoundMode = manager.getRoundMode();

    DoubleIntervalMatrix bb = b;

    manager.setRoundMode(RoundMode.ROUND_DOWN);
    DoubleMatrix inf = (this.infimum.divideElementWise(bb.getInfimum())).minElementWise(this.infimum.divideElementWise(bb.getSupremum()));
    inf = (inf).minElementWise(this.supremum.divideElementWise(bb.getInfimum()));
    inf = (inf).minElementWise(this.supremum.divideElementWise(bb.getSupremum()));

    manager.setRoundMode(RoundMode.ROUND_UP);
    DoubleMatrix sup = (this.infimum.divideElementWise(bb.getInfimum())).maxElementWise(this.infimum.divideElementWise(bb.getSupremum()));
    sup = (sup).maxElementWise(this.supremum.divideElementWise(bb.getInfimum()));
    sup = (sup).maxElementWise(this.supremum.divideElementWise(bb.getSupremum()));

    DoubleIntervalMatrix c = new DoubleIntervalMatrix(inf, sup);

    manager.setRoundMode(oldRoundMode);
    return c;
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix divide(final int value) {
    RoundModeManager manager = RoundModeManager.getManager();
    RoundMode oldRoundMode = manager.getRoundMode();

    manager.setRoundMode(RoundMode.ROUND_DOWN);
    DoubleMatrix inf = (this.infimum.divide(value)).minElementWise(this.supremum.divide(value));

    manager.setRoundMode(RoundMode.ROUND_UP);
    DoubleMatrix sup = (this.infimum.divide(value)).maxElementWise(this.supremum.divide(value));

    DoubleIntervalMatrix c = createInfSup(inf, sup);
    manager.setRoundMode(oldRoundMode);
    return c;
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix divide(final double value) {
    RoundModeManager manager = RoundModeManager.getManager();
    RoundMode oldRoundMode = manager.getRoundMode();

    manager.setRoundMode(RoundMode.ROUND_DOWN);
    DoubleMatrix inf = (this.infimum.divide(value)).minElementWise(this.supremum.divide(value));

    manager.setRoundMode(RoundMode.ROUND_UP);
    DoubleMatrix sup = (this.infimum.divide(value)).maxElementWise(this.supremum.divide(value));

    DoubleIntervalMatrix c = createInfSup(inf, sup);
    manager.setRoundMode(oldRoundMode);
    return c;
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix divide(final DoubleIntervalNumber b) {
    RoundModeManager manager = RoundModeManager.getManager();
    RoundMode oldRoundMode = manager.getRoundMode();

    manager.setRoundMode(RoundMode.ROUND_DOWN);
    DoubleMatrix inf = (this.infimum.divide(b.getInfimum().doubleValue())).minElementWise(this.infimum.divide(b.getSupremum().doubleValue()));
    inf = (inf).minElementWise(this.supremum.divide(b.getInfimum().doubleValue()));
    inf = (inf).minElementWise(this.supremum.divide(b.getSupremum().doubleValue()));

    manager.setRoundMode(RoundMode.ROUND_UP);
    DoubleMatrix sup = (this.infimum.divide(b.getInfimum().doubleValue())).maxElementWise(this.infimum.divide(b.getSupremum().doubleValue()));
    sup = (sup).maxElementWise(this.supremum.divide(b.getInfimum().doubleValue()));
    sup = (sup).maxElementWise(this.supremum.divide(b.getSupremum().doubleValue()));

    manager.setRoundMode(oldRoundMode);
    return new DoubleIntervalMatrix(inf, sup);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix inverse(double tolerance, boolean stopIfSingular) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix inverseElementWise() {
    DoubleMatrix infInverse = this.infimum.inverseElementWise();
    DoubleMatrix supInverse = this.supremum.inverseElementWise();
    DoubleMatrix inf = infInverse.minElementWise(supInverse);
    DoubleMatrix sup = infInverse.maxElementWise(supInverse);
    return createInfSup(inf, sup);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix diagonalToVector() {
    final DoubleMatrix inf = this.infimum.diagonalToVector();
    final DoubleMatrix sup = this.supremum.diagonalToVector();
    return createInfSup(inf, sup);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix vectorToDiagonal() {
    final DoubleMatrix inf = this.infimum.vectorToDiagonal();
    final DoubleMatrix sup = this.supremum.vectorToDiagonal();
    return createInfSup(inf, sup);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix reshape(int newRowSize, int newColumnSize) {
    final DoubleMatrix inf = this.infimum.reshape(newRowSize, newColumnSize);
    final DoubleMatrix sup = this.supremum.reshape(newRowSize, newColumnSize);
    return createInfSup(inf, sup);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix resize(int newRowSize, int newColumnSize) {
    final DoubleMatrix inf = this.infimum.resize(newRowSize, newColumnSize);
    final DoubleMatrix sup = this.supremum.resize(newRowSize, newColumnSize);
    return createInfSup(inf, sup);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleMatrix migElementWise() {
    BooleanMatrix B = this.infimum.compareElementWise(".<=", this.middle.createZero(this.infimum.getRowSize(), this.infimum.getColumnSize())).andElementWise( //$NON-NLS-1$
        this.supremum.compareElementWise(".>=", this.middle.createZero(this.supremum.getRowSize(), this.supremum.getColumnSize()))).notElementWise(); //$NON-NLS-1$
    IntMatrix zoB = IntervalUtil.toZOMatrix(B);
    DoubleMatrix C = (this.infimum).absElementWise().minElementWise(this.supremum).multiplyElementWise(new DoubleMatrix(zoB));
    return C;
  }

  /**
   * {@inheritDoc}
   */
  public DoubleMatrix comparisonMatrix() {
    return IntervalUtil.comparisonMatrix(this);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleMatrix abssElementWise() {
    RoundModeManager manager = RoundModeManager.getManager();
    RoundMode oldRoundMode = manager.getRoundMode();

    manager.setRoundMode(RoundMode.ROUND_UP);
    DoubleMatrix mid = mid(this.infimum, this.supremum);
    DoubleMatrix abss = mid.absElementWise().add(rad(mid, this.infimum));

    manager.setRoundMode(oldRoundMode);
    return abss;
  }

  /**
   * 下限を返します。
   * 
   * @param mid 中心
   * @param rad 半径
   * @return 下限
   */
  public static DoubleMatrix infimum(DoubleMatrix mid, DoubleMatrix rad) {
    RoundModeManager manager = RoundModeManager.getManager();
    RoundMode oldRoundMode = manager.getRoundMode();

    manager.setRoundMode(RoundMode.ROUND_DOWN);
    DoubleMatrix inf = mid.subtract(rad);

    manager.setRoundMode(oldRoundMode);
    return inf;
  }

  /**
   * 上限を返します。
   * 
   * @param mid 中心
   * @param radus 半径
   * @return 上限
   */
  public static DoubleMatrix supremum(DoubleMatrix mid, DoubleMatrix radus) {
    RoundModeManager manager = RoundModeManager.getManager();
    RoundMode oldRoundMode = manager.getRoundMode();

    manager.setRoundMode(RoundMode.ROUND_UP);
    DoubleMatrix sup = mid.add(radus);

    manager.setRoundMode(oldRoundMode);
    return sup;
  }

  /**
   * 区間の中心を求めます。 区間内のすべての点は、 &lt;中心(mid), 半径rad&gt;にあります。
   * 
   * @param inf 上限
   * @param sup 下限
   * 
   * @return 区間の中心
   */
  public static DoubleMatrix middle(DoubleMatrix inf, DoubleMatrix sup) {
    RoundModeManager manager = RoundModeManager.getManager();
    RoundMode oldRoundMode = manager.getRoundMode();

    manager.setRoundMode(RoundMode.ROUND_UP);
    DoubleMatrix mid = inf.add((sup.subtract(inf)).divide(2));

    manager.setRoundMode(oldRoundMode);
    return mid;
  }

  /**
   * 区間の半径を求めます。 区間内のすべての点は、 &lt;中心(mid), 半径rad&gt;にあります。
   * 
   * @param mid 中心
   * @param inf 下限
   * 
   * @return 区間の半径
   */
  public static DoubleMatrix radius(DoubleMatrix mid, DoubleMatrix inf) {
    RoundModeManager manager = RoundModeManager.getManager();
    RoundMode oldRoundMode = manager.getRoundMode();

    manager.setRoundMode(RoundMode.ROUND_UP);
    DoubleMatrix rad = mid.subtract(inf);

    manager.setRoundMode(oldRoundMode);
    return rad;
  }


  /**
   * {@inheritDoc}
   */
  public DoubleComplexIntervalMatrix toComplex() {
    return DoubleComplexIntervalMatrix.createInfimumSupremum(getInfimum().toComplex(), getSupremum().toComplex());
  }

  
  /**
   * {@inheritDoc}
   */
  public boolean isZero(final double tolerance) {
    return this.infimum.isZero(tolerance) && this.supremum.isZero(tolerance);
  }

  /**
   * {@inheritDoc}
   */
  public boolean isUnit(final double tolerance) {
    return this.infimum.isUnit(tolerance) && this.supremum.isUnit(tolerance);
  }

  /**
   * {@inheritDoc}
   */
  public BooleanMatrix isNanElementWise() {
    return this.infimum.isNanElementWise().orElementWise(this.supremum.isNanElementWise());
  }

  /**
   * {@inheritDoc}
   */
  public BooleanMatrix isInfiniteElementWise() {
    return this.infimum.isInfiniteElementWise().orElementWise(this.supremum.isInfiniteElementWise());
  }

  /**
   * {@inheritDoc}
   */
  public BooleanMatrix isFiniteElementWise() {
    return this.infimum.isFiniteElementWise().andElementWise(this.supremum.isFiniteElementWise());
  }

  /**
   * {@inheritDoc}
   */
  public boolean isReal() {
    return true;
  }

  /**
   * {@inheritDoc}
   */
  public boolean isComplex() {
    return false;
  }

  /**
   * 区間行列の上下限に対してぞれぞれの絶対値をとり、 上下限の絶対値最大の要素を行列として返します。
   * 
   * @return 上下限の各要素の絶対最大をもつ行列。
   */
  public DoubleMatrix absMax() {
    DoubleIntervalMatrix abs = absElementWise();
    return (abs.getInfimum()).maxElementWise(abs.getSupremum());
  }

  /**
   * {@inheritDoc}
   */
  public DoubleMatrix getError() {
    RoundModeManager manager = RoundModeManager.getManager();
    RoundMode oldRoundMode = manager.getRoundMode();

    manager.setRoundMode(RoundMode.ROUND_UP);
    DoubleMatrix error = this.supremum.subtract(this.infimum);

    manager.setRoundMode(oldRoundMode);
    return error;
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix transpose() {
    DoubleMatrix inf = this.infimum.transpose();
    DoubleMatrix sup = this.supremum.transpose();
    return new DoubleIntervalMatrix(inf, sup);
  }

//  /**
//   * @see org.mklab.cga.interval.matrix.IntervalMatrix#equals(org.mklab.nfc.matrix.Matrix, double)
//   */
//  public boolean equals(Matrix opponent, double tolerance) {
//    if (opponent instanceof DoubleIntervalMatrix == false) {
//      return false;
//    }
//    return equals((IntervalMatrix)opponent, tolerance);
//  }


  /**
   * {@inheritDoc}
   */
  public boolean equals(DoubleIntervalMatrix opponent, double tolerance) {
    return this.infimum.equals(opponent.getInfimum(), tolerance) && this.supremum.equals(opponent.getSupremum(), tolerance);
  }

  //  /**
  //   * @see org.mklab.cga.interval.IntervalMatrix#copy(org.mklab.nfc.matrix.Matrix)
  //   */
  //  public void copy(final Matrix source) {
  //    if (isSameSize(source) == false) {
  //      throw new ConflictionException();
  //    }
  //    
  //    if (source instanceof IntMatrix) {
  //      copy((IntMatrix)source);
  //      return;
  //    }
  //    if (source instanceof DoubleMatrix) {
  //      copy(source);
  //      return;
  //    }
  //    if (source instanceof DoubleIntervalMatrix) {
  //      copy((IntervalMatrix)source);
  //      return;
  //    }
  //
  //    throw new RuntimeException("Not Implemented."); //$NON-NLS-1$
  //  }

//  /**
//   * @param source source
//   */
//  public void copy(final DoubleIntervalMatrix source) {
//    this.infimum.copy(source.getInfimum());
//    this.supremum.copy(source.getSupremum());
//    updateMiddleRadius();
//  }
//
//  /**
//   * {@inheritDoc}
//   */
//  public void copy(final IntMatrix source) {
//    this.infimum.copy(source);
//    this.supremum.copy(source);
//    updateMiddleRadius();
//  }
//
//  /**
//   * {@inheritDoc}
//   */
//  public void copy(final DoubleMatrix source) {
//    this.infimum.copy(source);
//    this.supremum.copy(source);
//    updateMiddleRadius();
//  }

  /**
   * {@inheritDoc}
   */
  @Override
  public Object clone() {
    DoubleIntervalMatrix ans = (DoubleIntervalMatrix)super.clone();
    return ans;
  }

  /* Setter */

  /**
   * {@inheritDoc}
   */
  public void setElement(final int index, final int value) {
    this.infimum.setElement(index, value);
    this.supremum.setElement(index, value);
    updateMiddleRadius();
  }

  /**
   * {@inheritDoc}
   */
  public void setElement(final int index, final double value) {
    this.infimum.setElement(index, value);
    this.supremum.setElement(index, value);
    updateMiddleRadius();
  }

  /**
   * {@inheritDoc}
   */
  public void setElement(final int index, final DoubleNumber value) {
    this.infimum.setElement(index, value);
    this.supremum.setElement(index, value);
    updateMiddleRadius();
  }

  /**
   * {@inheritDoc}
   */
  public void setElement(final int index, final DoubleIntervalNumber value) {
    this.infimum.setElement(index, value.getInfimum());
    this.supremum.setElement(index, value.getSupremum());
    updateMiddleRadius();
  }

  /**
   * {@inheritDoc}
   */
  public void setElement(final int row, final int column, final int value) {
    this.infimum.setElement(row, column, value);
    this.supremum.setElement(row, column, value);
    updateMiddleRadius();
  }

  /**
   * {@inheritDoc}
   */
  public void setElement(final int row, final int column, final double value) {
    this.infimum.setElement(row, column, value);
    this.supremum.setElement(row, column, value);
    updateMiddleRadius();
  }

  /**
   * {@inheritDoc}
   */
  public void setElement(final int row, final int column, final DoubleNumber value) {
    this.infimum.setElement(row, column, value);
    this.supremum.setElement(row, column, value);
    updateMiddleRadius();
  }

  /**
   * {@inheritDoc}
   */
  public void setElement(final int row, final int column, final DoubleIntervalNumber value) {
    this.infimum.setElement(row, column, value.getInfimum());
    this.supremum.setElement(row, column, value.getSupremum());
    updateMiddleRadius();
  }

  /**
   * {@inheritDoc}
   */
  public void setSubMatrix(int rowMinimum, int rowMaximum, int columnMinimum, int columnMaximum, DoubleIntervalMatrix source) {
    this.infimum.setSubMatrix(rowMinimum, rowMaximum, columnMinimum, columnMaximum, source.getInfimum());
    this.supremum.setSubMatrix(rowMinimum, rowMaximum, columnMinimum, columnMaximum, source.getSupremum());
    updateMiddleRadius();
  }

  //  /**
  //   * @see org.mklab.cga.interval.matrix.IntervalMatrix#setSubMatrix(int, int, int, int, org.mklab.nfc.matrix.Matrix)
  //   */
  //  public void setSubMatrix(int rowMinimum, int rowMaximum, int columnMinimum, int columnMaximum, Matrix source) {
  //    if (source instanceof DoubleIntervalMatrix) {
  //      setSubMatrix(rowMinimum, rowMaximum, columnMinimum, columnMaximum, (IntervalMatrix)source);
  //      return;
  //    }
  //
  //    if (source.isReal() == false) {
  //      throw new RuntimeException("Not implemented"); //$NON-NLS-1$
  //    }
  //    this.infimum.setSubMatrix(rowMinimum, rowMaximum, columnMinimum, columnMaximum, source);
  //    this.supremum.setSubMatrix(rowMinimum, rowMaximum, columnMinimum, columnMaximum, source);
  //    updateMiddleRadius();
  //  }

  /**
   * {@inheritDoc}
   */
  public void setSubMatrix(IntMatrix rowIndex, int columnMinimum, int columnMaximum, DoubleIntervalMatrix source) {
    this.infimum.setSubMatrix(rowIndex, columnMinimum, columnMaximum, source.getInfimum());
    this.supremum.setSubMatrix(rowIndex, columnMinimum, columnMaximum, source.getSupremum());
    updateMiddleRadius();
  }

  //  /**
  //   * @see org.mklab.cga.interval.matrix.IntervalMatrix#setSubMatrix(org.mklab.nfc.matrix.IntMatrix, int, int, org.mklab.nfc.matrix.Matrix)
  //   */
  //  public void setSubMatrix(IntMatrix rowIndex, int columnMinimum, int columnMaximum, Matrix source) {
  //    if (source instanceof DoubleIntervalMatrix) {
  //      setSubMatrix(rowIndex, columnMinimum, columnMaximum, (IntervalMatrix)source);
  //      return;
  //    }
  //
  //    if (source.isReal() == false) {
  //      throw new RuntimeException("Not implemented"); //$NON-NLS-1$
  //    }
  //    this.infimum.setSubMatrix(rowIndex, columnMinimum, columnMaximum, source);
  //    this.supremum.setSubMatrix(rowIndex, columnMinimum, columnMaximum, source);
  //    updateMiddleRadius();
  //  }

  /**
   * {@inheritDoc}
   */
  public void setSubMatrix(int rowMinimum, int rowMaximum, IntMatrix columnIndex, DoubleIntervalMatrix source) {
    this.infimum.setSubMatrix(rowMinimum, rowMaximum, columnIndex, source.getInfimum());
    this.supremum.setSubMatrix(rowMinimum, rowMaximum, columnIndex, source.getSupremum());
    updateMiddleRadius();
  }

  //  /**
  //   * @see org.mklab.cga.interval.matrix.IntervalMatrix#setSubMatrix(int, int, org.mklab.nfc.matrix.IntMatrix, org.mklab.nfc.matrix.Matrix)
  //   */
  //  public void setSubMatrix(int rowMinimum, int rowMaximum, IntMatrix columnIndex, Matrix source) {
  //    if (source instanceof DoubleIntervalMatrix) {
  //      setSubMatrix(rowMinimum, rowMaximum, columnIndex, (IntervalMatrix)source);
  //      return;
  //    }
  //
  //    if (source.isReal() == false) {
  //      throw new RuntimeException("Not implemented"); //$NON-NLS-1$
  //    }
  //    this.infimum.setSubMatrix(rowMinimum, rowMaximum, columnIndex, source);
  //    this.supremum.setSubMatrix(rowMinimum, rowMaximum, columnIndex, source);
  //    updateMiddleRadius();
  //  }

  /**
   * {@inheritDoc}
   */
  public void setSubMatrix(IntMatrix rowIndex, IntMatrix columnIndex, DoubleIntervalMatrix source) {
    this.infimum.setSubMatrix(rowIndex, columnIndex, source.getInfimum());
    this.supremum.setSubMatrix(rowIndex, columnIndex, source.getSupremum());
    updateMiddleRadius();
  }

  //  /**
  //   * @see org.mklab.cga.interval.matrix.IntervalMatrix#setSubMatrix(org.mklab.nfc.matrix.IntMatrix, org.mklab.nfc.matrix.IntMatrix, org.mklab.nfc.matrix.Matrix)
  //   */
  //  public void setSubMatrix(IntMatrix rowIndex, IntMatrix columnIndex, Matrix source) {
  //    if (source instanceof DoubleIntervalMatrix) {
  //      setSubMatrix(rowIndex, columnIndex, (IntervalMatrix)source);
  //      return;
  //    }
  //
  //    if (source.isReal() == false) {
  //      throw new RuntimeException("Not implemented"); //$NON-NLS-1$
  //    }
  //    this.infimum.setSubMatrix(rowIndex, columnIndex, source);
  //    this.supremum.setSubMatrix(rowIndex, columnIndex, source);
  //    updateMiddleRadius();
  //  }

  //  /**
  //   * @see org.mklab.cga.interval.matrix.IntervalMatrix#setSubVector(int, int, org.mklab.nfc.matrix.Matrix)
  //   */
  //  public void setSubVector(int min, int max, Matrix source) {
  //    if (source instanceof DoubleIntervalMatrix) {
  //      setSubVector(min, max, (IntervalMatrix)source);
  //      return;
  //    }
  //
  //    if (source.isReal() == false) {
  //      throw new RuntimeException("Not implemented"); //$NON-NLS-1$
  //    }
  //    this.infimum.setSubVector(min, max, source);
  //    this.supremum.setSubVector(min, max, source);
  //    updateMiddleRadius();
  //  }

  /**
   * {@inheritDoc}
   */
  public void setSubVector(int minimum, int maximum, DoubleIntervalMatrix source) {
    this.infimum.setSubVector(minimum, maximum, source.getInfimum());
    this.supremum.setSubVector(minimum, maximum, source.getSupremum());
    updateMiddleRadius();
  }

  /**
   * {@inheritDoc}
   */
  public void setSubVector(IntMatrix index, DoubleIntervalMatrix source) {
    this.infimum.setSubVector(index, source.getInfimum());
    this.supremum.setSubVector(index, source.getSupremum());
    updateMiddleRadius();
  }

  //  /**
  //   * @see org.mklab.cga.interval.matrix.IntervalMatrix#setSubVector(org.mklab.nfc.matrix.IntMatrix, org.mklab.nfc.matrix.Matrix)
  //   */
  //  public void setSubVector(IntMatrix index, Matrix source) {
  //    if (source instanceof DoubleIntervalMatrix) {
  //      setSubVector(index, (IntervalMatrix)source);
  //      return;
  //    }
  //
  //    if (source.isReal() == false) {
  //      throw new RuntimeException("Not implemented"); //$NON-NLS-1$
  //    }
  //    this.infimum.setSubVector(index, source);
  //    this.supremum.setSubVector(index, source);
  //    updateMiddleRadius();
  //  }

  //  /**
  //   * @see org.mklab.cga.interval.matrix.IntervalMatrix#compareElementWise(java.lang.String, org.mklab.nfc.matrix.Matrix)
  //   */
  //  public BooleanMatrix compareElementWise(String operator, Matrix opponent) {
  //    if (opponent instanceof BaseMatrix<?, ?>) {
  //      return compareElementWise(operator, (BaseMatrix<?, ?>)opponent);
  //    }
  //
  //    if (opponent instanceof DoubleMatrix) {
  //      return compareElementWise(operator, opponent);
  //    }
  //
  //    if (opponent instanceof IntMatrix) {
  //      return compareElementWise(operator, (IntMatrix)opponent);
  //    }
  //
  //    throw new UnsupportedOperationException();
  //  }

  /**
   * {@inheritDoc}
   */
  public BooleanMatrix compareElementWise(String operator, DoubleIntervalMatrix opponent) {
    if (operator.equals(".==")) { //$NON-NLS-1$
      return this.infimum.compareElementWise(operator, opponent.getInfimum()).andElementWise(this.supremum.compareElementWise(operator, opponent.getSupremum()));
    }

    if (operator.equals(".!=")) { //$NON-NLS-1$
      return this.infimum.compareElementWise(operator, opponent.getInfimum()).andElementWise(this.supremum.compareElementWise(operator, opponent.getSupremum()));
    }

    if (operator.equals(".<")) { //$NON-NLS-1$
      return this.supremum.compareElementWise(operator, opponent.getInfimum());
    }

    if (operator.equals(".<=")) { //$NON-NLS-1$
      return this.supremum.compareElementWise(operator, opponent.getInfimum());
    }

    if (operator.equals(".>")) { //$NON-NLS-1$
      return this.infimum.compareElementWise(operator, opponent.getSupremum());
    }

    if (operator.equals(".>=")) { //$NON-NLS-1$
      return this.infimum.compareElementWise(operator, opponent.getSupremum());
    }

    throw new UnsupportedOperationException();
  }

  /**
   * 行列<code>opponent</code>の各成分と成分毎に<code>operator</code>で指定された演算子で比較し, それぞれの結果を成分とする{@link BooleanMatrix}を生成します。
   * 
   * @param operator 比較演算子(". &lt;", ". &lt;=", ".&gt;", ".&gt;=", ".==", ".!=")
   * @param opponent 比較対象
   * 
   * @return 比較結果を成分とする{@link BooleanMatrix}
   */
  public BooleanMatrix compareElementWise(String operator, IntMatrix opponent) {
    if (operator.equals(".==")) { //$NON-NLS-1$
      return this.infimum.compareElementWise(operator, opponent).andElementWise(this.supremum.compareElementWise(operator, opponent));
    }

    if (operator.equals(".!=")) { //$NON-NLS-1$
      return this.infimum.compareElementWise(operator, opponent).andElementWise(this.supremum.compareElementWise(operator, opponent));
    }

    if (operator.equals(".<")) { //$NON-NLS-1$
      return this.supremum.compareElementWise(operator, opponent);
    }

    if (operator.equals(".<=")) { //$NON-NLS-1$
      return this.supremum.compareElementWise(operator, opponent);
    }

    if (operator.equals(".>")) { //$NON-NLS-1$
      return this.infimum.compareElementWise(operator, opponent);
    }

    if (operator.equals(".>=")) { //$NON-NLS-1$
      return this.infimum.compareElementWise(operator, opponent);
    }

    throw new UnsupportedOperationException();
  }

  /**
   * 行列<code>opponent</code>の各成分と成分毎に<code>operator</code>で指定された演算子で比較し, それぞれの結果を成分とする{@link BooleanMatrix}を生成します。
   * 
   * @param operator 比較演算子(". &lt;", ". &lt;=", ".&gt;", ".&gt;=", ".==", ".!=")
   * @param opponent 比較対象
   * 
   * @return 比較結果を成分とする{@link BooleanMatrix}
   */
  public BooleanMatrix compareElementWise(String operator, DoubleMatrix opponent) {
    if (operator.equals(".==")) { //$NON-NLS-1$
      return this.infimum.compareElementWise(operator, opponent).andElementWise(this.supremum.compareElementWise(operator, opponent));
    }

    if (operator.equals(".!=")) { //$NON-NLS-1$
      return this.infimum.compareElementWise(operator, opponent).andElementWise(this.supremum.compareElementWise(operator, opponent));
    }

    if (operator.equals(".<")) { //$NON-NLS-1$
      return this.supremum.compareElementWise(operator, opponent);
    }

    if (operator.equals(".<=")) { //$NON-NLS-1$
      return this.supremum.compareElementWise(operator, opponent);
    }

    if (operator.equals(".>")) { //$NON-NLS-1$
      return this.infimum.compareElementWise(operator, opponent);
    }

    if (operator.equals(".>=")) { //$NON-NLS-1$
      return this.infimum.compareElementWise(operator, opponent);
    }

    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix getSubVector(final IntMatrix index) {
    final DoubleMatrix inf = this.infimum.getSubVector(index);
    final DoubleMatrix sup = this.supremum.getSubVector(index);
    return new DoubleIntervalMatrix(inf, sup);
  }
  
  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix getSubMatrix(final int rowMinimum, final int rowMaximum, final int columnMinimum, final int columnMaximum) {
    final DoubleMatrix inf = this.infimum.getSubMatrix(rowMinimum, rowMaximum, columnMinimum, columnMaximum);
    final DoubleMatrix sup = this.supremum.getSubMatrix(rowMinimum, rowMaximum, columnMinimum, columnMaximum);
    return new DoubleIntervalMatrix(inf, sup);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix getSubMatrix(int rowMinimum, int rowMaximum, IntMatrix columnIndex) {
    final DoubleMatrix inf = this.infimum.getSubMatrix(rowMinimum, rowMaximum, columnIndex);
    final DoubleMatrix sup = this.supremum.getSubMatrix(rowMinimum, rowMaximum, columnIndex);
    return new DoubleIntervalMatrix(inf, sup);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix getSubMatrix(IntMatrix rowIndex, int columnMinimum, int columnMaximum) {
    final DoubleMatrix inf = this.infimum.getSubMatrix(rowIndex, columnMinimum, columnMaximum);
    final DoubleMatrix sup = this.supremum.getSubMatrix(rowIndex, columnMinimum, columnMaximum);
    return new DoubleIntervalMatrix(inf, sup);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix getSubMatrix(IntMatrix rowIndex, IntMatrix columnIndex) {
    final DoubleMatrix inf = this.infimum.getSubMatrix(rowIndex, columnIndex);
    final DoubleMatrix sup = this.supremum.getSubMatrix(rowIndex, columnIndex);
    return new DoubleIntervalMatrix(inf, sup);
  }

  //  /**
  //   * @see org.mklab.nfc.matrix.FundamentalMatrix#appendRight(org.mklab.nfc.matrix.Matrix)
  //   */
  //  @Override
  //  public DoubleIntervalMatrix appendRight(Matrix b) {
  //    if (b instanceof DoubleIntervalMatrix) {
  //      return appendRight((IntervalMatrix<?>)b);
  //    }
  //
  //    if (b.isReal()) {
  //      return appendRight(new DoubleIntervalMatrix(b));
  //    }
  //
  //    return appendRight(new AbstractIntervalComplexNumericalMatrix(b));
  //  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix appendRight(DoubleIntervalMatrix b) {
    DoubleMatrix inf = this.infimum.appendRight(b.getInfimum());
    DoubleMatrix sup = this.supremum.appendRight(b.getSupremum());
    return new DoubleIntervalMatrix(inf, sup);
  }

  //  /**
  //   * @see org.mklab.nfc.matrix.FundamentalMatrix#appendDown(org.mklab.nfc.matrix.Matrix)
  //   */
  //  @Override
  //  public DoubleIntervalMatrix appendDown(Matrix b) {
  //    if (b instanceof DoubleIntervalMatrix) {
  //      return appendDown((IntervalMatrix)b);
  //    }
  //
  //    if (b.isReal()) {
  //      return appendDown(new DoubleIntervalMatrix(b));
  //    }
  //
  //    return appendDown(new AbstractIntervalComplexNumericalMatrix(b));
  //  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix appendDown(DoubleIntervalMatrix b) {
    DoubleMatrix inf = this.infimum.appendDown(b.getInfimum());
    DoubleMatrix sup = this.supremum.appendDown(b.getSupremum());
    return new DoubleIntervalMatrix(inf, sup);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix conjugate() {
    DoubleMatrix inf = this.infimum.conjugate();
    DoubleMatrix sup = this.supremum.conjugate();
    return new DoubleIntervalMatrix(inf, sup);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix conjugateTranspose() {
    DoubleMatrix inf = this.infimum.conjugateTranspose();
    DoubleMatrix sup = this.supremum.conjugateTranspose();
    return new DoubleIntervalMatrix(inf, sup);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix sqrtElementWise() {
    RoundModeManager manager = RoundModeManager.getManager();
    RoundMode oldRoundMode = manager.getRoundMode();

    manager.setRoundMode(RoundMode.ROUND_DOWN);
    DoubleMatrix inf = (this.infimum).sqrtElementWise();

    manager.setRoundMode(RoundMode.ROUND_UP);
    DoubleMatrix sup = (this.supremum).sqrtElementWise();

    manager.setRoundMode(oldRoundMode);
    return new DoubleIntervalMatrix(inf, sup);
  }

  /**
   * 中心と半径を更新します。
   */
  public void updateMiddleRadius() {
    this.middle = mid(this.infimum, this.supremum);
    this.radius = rad(this.middle, this.infimum);
  }

  /**
   * {@inheritDoc}
   */
  public long[][] getPointsNumber() {
    long[][] count = new long[getRowSize()][getColumnSize()];

    for (int row = 0; row < getRowSize(); row++) {
      for (int column = 0; column < getColumnSize(); column++) {
        count[row][column] = (getElement((row + 1) * (column + 1))).getPointsNumber();
      }
    }
    // TODO nfcのMatrixで返したい
    // return new IntegerMatrix(count);
    return count;
  }
  
  /**
   * index番目の要素の区間の下限からcount番目の浮動小数点数を返します。
   * 
   * @param index 要素の番号
   * @param count 区間の下限から数えた番号
   * @return index番目の要素の区間の下限からcount番目の浮動小数点数
   */
  public double getPoint(int index, long count) {
    return getElement(index).getPoint(count);
  }

  /**
   * {@inheritDoc}
   */
  public long getPointOfValue(int index, double value) {
    return (getElement(index)).getPointOfValue(value);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalNumber getElement(int index) {
    return new DoubleIntervalNumber((this.infimum).getDoubleElement(index), (this.supremum).getDoubleElement(index));
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalNumber getElement(int row, int column) {
    return new DoubleIntervalNumber((this.infimum).getDoubleElement(row, column), (this.supremum).getDoubleElement(row, column));
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalNumber infNorm() {
    RoundModeManager manager = RoundModeManager.getManager();
    RoundMode oldMode = manager.getRoundMode();

    DoubleMatrix absMatrix = this.absMax();
    manager.setRoundMode(RoundMode.ROUND_UP);
    DoubleNumber norm = absMatrix.norm(NormType.INFINITY);

    manager.setRoundMode(oldMode);
    return DoubleIntervalNumber.createMiddleRadius(norm, norm.createZero());
  }

  /**
   * {@inheritDoc}
   */
  public DoubleMatrix getNumberOfSignifcantFigures() {
    DoubleMatrix elements = this.middle.absElementWise().log10ElementWise().subtract(this.radius.absElementWise().log10ElementWise());
    int rowSize = elements.getRowSize();
    int columnSize = elements.getColumnSize();
    double[][] numberElements = new double[rowSize][columnSize];
    for (int i = 0; i < rowSize; i++) {
      for (int j = 0; j < columnSize; j++) {
        numberElements[i][j] = elements.getElement(i + 1, j + 1).doubleValue();
      }
    }
    return new DoubleMatrix(numberElements);

  }

  /**
   * {@inheritDoc}
   */
  public void printElements(Writer output) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public void printElements(Writer output, int maxColumnSize) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix sumRowWise() {
    RoundModeManager manager = RoundModeManager.getManager();
    RoundMode oldRoundMode = manager.getRoundMode();

    manager.setRoundMode(RoundMode.ROUND_DOWN);
    DoubleMatrix inf = this.infimum.sumRowWise();

    manager.setRoundMode(RoundMode.ROUND_UP);
    DoubleMatrix sup = this.supremum.sumRowWise();

    manager.setRoundMode(oldRoundMode);

    return new DoubleIntervalMatrix(inf, sup);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix sumColumnWise() {
    RoundModeManager manager = RoundModeManager.getManager();
    RoundMode oldRoundMode = manager.getRoundMode();

    manager.setRoundMode(RoundMode.ROUND_DOWN);
    DoubleMatrix inf = this.infimum.sumColumnWise();

    manager.setRoundMode(RoundMode.ROUND_UP);
    DoubleMatrix sup = this.supremum.sumColumnWise();

    manager.setRoundMode(oldRoundMode);

    return new DoubleIntervalMatrix(inf, sup);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix cumulativeSumRowWise() {
    RoundModeManager manager = RoundModeManager.getManager();
    RoundMode oldRoundMode = manager.getRoundMode();

    manager.setRoundMode(RoundMode.ROUND_DOWN);
    DoubleMatrix inf = this.infimum.cumulativeSumRowWise();

    manager.setRoundMode(RoundMode.ROUND_UP);
    DoubleMatrix sup = this.supremum.cumulativeSumRowWise();

    manager.setRoundMode(oldRoundMode);

    return new DoubleIntervalMatrix(inf, sup);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix cumulativeSumColumnWise() {
    RoundModeManager manager = RoundModeManager.getManager();
    RoundMode oldRoundMode = manager.getRoundMode();

    manager.setRoundMode(RoundMode.ROUND_DOWN);
    DoubleMatrix inf = this.infimum.cumulativeSumColumnWise();

    manager.setRoundMode(RoundMode.ROUND_UP);
    DoubleMatrix sup = this.supremum.cumulativeSumColumnWise();

    manager.setRoundMode(oldRoundMode);

    return new DoubleIntervalMatrix(inf, sup);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix floorElementWise() {
    DoubleMatrix inf = this.infimum.floorElementWise();
    DoubleMatrix sup = this.supremum.floorElementWise();
    return new DoubleIntervalMatrix(inf, sup);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix ceilElementWise() {
    DoubleMatrix inf = this.infimum.ceilElementWise();
    DoubleMatrix sup = this.supremum.ceilElementWise();
    return new DoubleIntervalMatrix(inf, sup);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix fixElementWise() {
    DoubleMatrix inf = this.infimum.fixElementWise();
    DoubleMatrix sup = this.supremum.fixElementWise();
    return new DoubleIntervalMatrix(inf, sup);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix roundElementWise() {
    DoubleMatrix inf = this.infimum.roundElementWise();
    DoubleMatrix sup = this.supremum.roundElementWise();
    return new DoubleIntervalMatrix(inf, sup);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix roundToZeroElementWise(double tolerance) {
    DoubleMatrix inf = this.infimum.roundToZeroElementWise(tolerance);
    DoubleMatrix sup = this.supremum.roundToZeroElementWise(tolerance);
    return new DoubleIntervalMatrix(inf, sup);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix divide(DoubleNumber value) {
    return divide(new DoubleIntervalNumber(value.doubleValue()));
  }

  /**
   * {@inheritDoc}
   */
  public BooleanMatrix compareElementWise(String operator, int value) {
    if (operator.equals(".==")) { //$NON-NLS-1$
      return this.infimum.compareElementWise(operator, value).andElementWise(this.supremum.compareElementWise(operator, value));
    }

    if (operator.equals(".!=")) { //$NON-NLS-1$
      return this.infimum.compareElementWise(operator, value).andElementWise(this.supremum.compareElementWise(operator, value));
    }

    if (operator.equals(".<")) { //$NON-NLS-1$
      return this.supremum.compareElementWise(operator, value);
    }

    if (operator.equals(".<=")) { //$NON-NLS-1$
      return this.supremum.compareElementWise(operator, value);
    }

    if (operator.equals(".>")) { //$NON-NLS-1$
      return this.infimum.compareElementWise(operator, value);
    }

    if (operator.equals(".>=")) { //$NON-NLS-1$
      return this.infimum.compareElementWise(operator, value);
    }

    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public BooleanMatrix compareElementWise(String operator, double value) {
    if (operator.equals(".==")) { //$NON-NLS-1$
      return this.infimum.compareElementWise(operator, value).andElementWise(this.supremum.compareElementWise(operator, value));
    }

    if (operator.equals(".!=")) { //$NON-NLS-1$
      return this.infimum.compareElementWise(operator, value).andElementWise(this.supremum.compareElementWise(operator, value));
    }

    if (operator.equals(".<")) { //$NON-NLS-1$
      return this.supremum.compareElementWise(operator, value);
    }

    if (operator.equals(".<=")) { //$NON-NLS-1$
      return this.supremum.compareElementWise(operator, value);
    }

    if (operator.equals(".>")) { //$NON-NLS-1$
      return this.infimum.compareElementWise(operator, value);
    }

    if (operator.equals(".>=")) { //$NON-NLS-1$
      return this.infimum.compareElementWise(operator, value);
    }

    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public BooleanMatrix compareElementWise(String operator, DoubleNumber value) {
    if (operator.equals(".==")) { //$NON-NLS-1$
      return this.infimum.compareElementWise(operator, value).andElementWise(this.supremum.compareElementWise(operator, value));
    }

    if (operator.equals(".!=")) { //$NON-NLS-1$
      return this.infimum.compareElementWise(operator, value).andElementWise(this.supremum.compareElementWise(operator, value));
    }

    if (operator.equals(".<")) { //$NON-NLS-1$
      return this.supremum.compareElementWise(operator, value);
    }

    if (operator.equals(".<=")) { //$NON-NLS-1$
      return this.supremum.compareElementWise(operator, value);
    }

    if (operator.equals(".>")) { //$NON-NLS-1$
      return this.infimum.compareElementWise(operator, value);
    }

    if (operator.equals(".>=")) { //$NON-NLS-1$
      return this.infimum.compareElementWise(operator, value);
    }

    throw new UnsupportedOperationException();
  }

//  public DoubleMatrix abssElementWise() {
//    throw new UnsupportedOperationException();
//  }

  /**
   * {@inheritDoc}
   */
  public DoubleNumber norms() {
    throw new UnsupportedOperationException();
  }


  /**
   * {@inheritDoc}
   */
  public QRDecomposition<DoubleIntervalNumber, DoubleIntervalMatrix> qrDecompose() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public QRDecomposition<DoubleIntervalNumber, DoubleIntervalMatrix> qrDecomposeWithPermutation() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public SchurDecomposition<DoubleIntervalNumber, DoubleIntervalMatrix> schurDecompose() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix choleskyDecompose() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix choleskyDecompose(double tolerance) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix choleskyDecompose(DoubleIntervalNumber tolerance) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public BalancedDecomposition<DoubleIntervalNumber, DoubleIntervalMatrix> balancedDecompose() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix kernel() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix kernel(double tolerance) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix kernel(DoubleIntervalNumber tolerance) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public HessenbergDecomposition<DoubleIntervalNumber, DoubleIntervalMatrix> hessenbergDecompose() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public LUDecomposition<DoubleIntervalNumber, DoubleIntervalMatrix> luDecompose(double tolerance, boolean stopIfSingular) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public LUDecomposition<DoubleIntervalNumber, DoubleIntervalMatrix> luDecompose(DoubleIntervalNumber tolerance, boolean stopIfSingular) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public LUDecomposition<DoubleIntervalNumber, DoubleIntervalMatrix> luDecompose(boolean stopIfSingular) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public LUDecomposition<DoubleIntervalNumber, DoubleIntervalMatrix> luDecomposeWithPermutation(boolean stopIfSingular) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public LUDecomposition<DoubleIntervalNumber, DoubleIntervalMatrix> luDecomposeWithPermutation(double tolerance, boolean stopIfSingular) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public LUDecomposition<DoubleIntervalNumber, DoubleIntervalMatrix> luDecomposeWithPermutation(DoubleIntervalNumber tolerance, boolean stopIfSingular) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix pseudoInverse(double tolerance) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix pseudoInverse(DoubleIntervalNumber tolerance) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix pseudoInverse() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public int rank(double tolerance) {
    return 0;
  }

  /**
   * {@inheritDoc}
   */
  public int rank(DoubleIntervalNumber tolerance) {
    return 0;
  }

  /**
   * {@inheritDoc}
   */
  public boolean isFullRank() {
    return false;
  }

  /**
   * {@inheritDoc}
   */
  public boolean isFullRank(double tolerance) {
    return false;
  }

//  /**
//   * {@inheritDoc}
//   */
//  public boolean isFullRnank(DoubleIntervalNumber tolerance) {
//    return false;
//  }

  /**
   * {@inheritDoc}
   */
  public boolean isZero(DoubleIntervalNumber tolerance) {
    return false;
  }

  /**
   * {@inheritDoc}
   */
  public boolean isUnit(DoubleIntervalNumber tolerance) {
    return false;
  }

  /**
   * {@inheritDoc}
   */
  public boolean equals(DoubleIntervalMatrix opponent, DoubleIntervalNumber tolerance) {
    return false;
  }

  /**
   * {@inheritDoc}
   */
  public SingularValueDecomposition<DoubleIntervalNumber, DoubleIntervalMatrix> singularValueDecompose() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalNumber maxSingularValue() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalNumber minSingularValue() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalNumber conditionNumber() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix log() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix exp() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix exp(double tolerance) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix exp(DoubleIntervalNumber tolerance) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix sinElementWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix sinhElementWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix asinElementWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix asinhElementWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix cosElementWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix coshElementWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix acosElementWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix acoshElementWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix tanElementWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix tanhElementWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix atanElementWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix atan2ElementWise(DoubleIntervalMatrix matrix) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix atan2ElementWise(DoubleIntervalNumber value) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix atanhElementWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix expElementWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix logElementWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix log10ElementWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix signumElementWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalNumber std() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix stdRowWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix stdColumnWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public IndexedMatrix<DoubleIntervalNumber, DoubleIntervalMatrix> sort() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public IndexedMatrix<DoubleIntervalNumber, DoubleIntervalMatrix> sortRowWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public IndexedMatrix<DoubleIntervalNumber, DoubleIntervalMatrix> sortColumnWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalNumber max() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix maxRowWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix maxColumnWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public ElementHolder<DoubleIntervalNumber> maximum() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public IndexedMatrix<DoubleIntervalNumber, DoubleIntervalMatrix> maximumRowWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalNumber min() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public IndexedMatrix<DoubleIntervalNumber, DoubleIntervalMatrix> maximumColumnWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix minRowWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix minColumnWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public ElementHolder<DoubleIntervalNumber> minimum() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public IndexedMatrix<DoubleIntervalNumber, DoubleIntervalMatrix> minimumRowWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public IndexedMatrix<DoubleIntervalNumber, DoubleIntervalMatrix> minimumColumnWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix maxElementWise(DoubleIntervalMatrix opponent) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix minElementWise(DoubleIntervalMatrix opponent) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalNumber median() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix medianColumnWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix medianRowWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalNumber norm(NormType normType) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalNumber frobNorm() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix frobNormRowWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix frobNormColumnWise() {
    throw new UnsupportedOperationException();
  }

//  public DoubleIntervalNumber infNorm() {
//    throw new UnsupportedOperationException();
//  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix powerElementWise(double scalar) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix powerElementWise(DoubleIntervalNumber scalar) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix roundToZeroElementWise(DoubleIntervalNumber tolerance) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix remainderElementWise(DoubleIntervalMatrix matrix) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix remainderElementWise(DoubleIntervalNumber value) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix modulusElementWise(DoubleIntervalMatrix matrix) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix modulusElementWise(DoubleIntervalNumber value) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix createUniformRandom() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix createUniformRandom(int rowSize, int columnSize) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix createUniformRandom(int rowSize, int columnSize, long seed) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix createUniformRandom(int rowNumber, int columnNumber, Grid block) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix createNormalRandom() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix createNormalRandom(int rowSize, int columnSize) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix createNormalRandom(int rowSize, int columnSize, long seed) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix createNormalRandom(int rowNumber, int columnNumber, Grid block) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix inverse(DoubleIntervalNumber tolerance, boolean stopIfSingular) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleIntervalMatrix roundToZeroElementWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public BooleanMatrix compareElementWise(String operator, DoubleIntervalNumber value) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleComplexIntervalMatrix createComplex(DoubleIntervalMatrix realPart, DoubleIntervalMatrix imagPart) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleComplexIntervalMatrix eigenValue() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleComplexIntervalMatrix eigenValue(DoubleIntervalMatrix B) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleComplexIntervalMatrix eigenVector() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleComplexIntervalMatrix eigenVector(DoubleIntervalMatrix B) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public EigenSolution<DoubleIntervalNumber, DoubleIntervalMatrix, DoubleComplexIntervalNumber, DoubleComplexIntervalMatrix> eigenDecompose() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public EigenSolution<DoubleIntervalNumber, DoubleIntervalMatrix, DoubleComplexIntervalNumber, DoubleComplexIntervalMatrix> eigenDecompose(DoubleIntervalMatrix B) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleComplexIntervalMatrix fft() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleComplexIntervalMatrix fft(int dataSize) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleComplexIntervalMatrix fftRowWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleComplexIntervalMatrix fftRowWise(int dataSize) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleComplexIntervalMatrix fftColumnWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleComplexIntervalMatrix fftColumnWise(int dataSize) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleComplexIntervalMatrix ifft() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleComplexIntervalMatrix ifft(int dataSize) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleComplexIntervalMatrix ifftRowWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleComplexIntervalMatrix ifftRowWise(int dataSize) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleComplexIntervalMatrix ifftColumnWise() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleComplexIntervalMatrix ifftColumnWise(int dataSize) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public RealQZDecomposition<DoubleIntervalNumber, DoubleIntervalMatrix, DoubleComplexIntervalNumber, DoubleComplexIntervalMatrix> qzDecompose(DoubleIntervalMatrix B) {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public DoubleComplexIntervalMatrix sqrt() {
    throw new UnsupportedOperationException();
  }

  /**
   * {@inheritDoc}
   */
  public boolean isFullRank(DoubleIntervalNumber tolerance) {
    return false;
  }

  /**
   * {@inheritDoc}
   */
  public DoubleComplexIntervalMatrix multiply(DoubleComplexIntervalNumber value) {
    return toComplex().multiply(value);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleComplexIntervalMatrix divide(DoubleComplexIntervalNumber value) {
    return toComplex().divide(value);
  }

  /**
   * {@inheritDoc}
   */
  public DoubleComplexIntervalMatrix leftDivide(DoubleComplexIntervalNumber value) {
    return toComplex().leftDivide(value);
  }

}