Resolvent.java

/*
 * $Id: Resolvent.java,v 1.16 2008/03/23 23:41:55 koga Exp $
 *
 * Copyright (C) 2004 Koga Laboratory. All rights reserved.
 */
package org.mklab.tool.control;

import org.mklab.nfc.matrix.DoubleMatrix;
import org.mklab.nfc.matrix.DoublePolynomialMatrix;
import org.mklab.nfc.scalar.DoublePolynomial;


/**
 * リゾルベント行列を求めるクラスです。
 * 
 * <p>Resolvent matrix (s*I - A)^(-1) of A
 * 
 * @author koga
 * @version $Revision: 1.16 $
 * @see org.mklab.tool.control.Faddeev
 * @see org.mklab.tool.matrix.Makepoly
 */
public class Resolvent {

  /**
   * 行列<code>A</code>のリゾルベント行列
   * 
   * <pre><code> N(s) -1 ----- = (s*I - A) ch(s) </code></pre>
   * 
   * の分子<code>N</code>と分母<code>ch</code>(特性多項式)を返します。
   * 
   * @param A A行列
   * @return {N, ch} (リゾルベント行列の分子, 分母) resolvent matrix
   */
  public static ResolventSolution resolvent(DoubleMatrix A) {
    int n = A.getRowSize();
    DoubleMatrix AA = A;
    FaddeevSolution tmp = Faddeev.faddeev(A);
    DoubleMatrix Gamma = tmp.getNN();
    DoublePolynomial ch = tmp.getDd();

    DoublePolynomial s = new DoublePolynomial("s"); //$NON-NLS-1$
    DoublePolynomialMatrix N = new DoublePolynomialMatrix(n, n);

    for (int i = 0; i < n; i++) {
      N = N.add(new DoublePolynomialMatrix(Gamma.getSubMatrix(1, i + 1, AA)).multiply(s.power(i)));
    }

    return new ResolventSolution(N, ch);
  }
}