zhess.java

来自「JAVA 数学程序库 提供常规的数值计算程序包」· Java 代码 · 共 55 行

JAVA
55
字号
package jmathlib.toolbox.jmathlib.matrix._private.Jampack;

/**
   Zhess implements the unitary reduction to Hessenberg form
   by a unitary similarity transformation.  Specifically, given
   a square matrix A, there is a unitary matrix U such that
<pre>
*      H = U^H AU
</pre>
   is upper Hessenberg.
   Zhess represents U and H as Zmats.

   @version Pre-alpha
   @author G. W. Stewart
*/

public class Zhess{

/** The upper Hessenberg matrix */
     public Zmat H;

/** The unitary matrix */
    public Zmat U;

/** Creates a Zhess from a square Zmat. Throws a 
    JampackException for nonsquare matrx.

    @param     A A Zmat
    @return    The Hessenberg form of A
    @exception JampackException
               Thrown if A is not square.
*/

   public Zhess(Zmat A)
   throws JampackException{

      if (A.nr != A.nc){
         throw new JampackException
            ("Matrix not square");
      }

      H = new Zmat(A);
      U = Eye.o(H.nr);

      Z1 work = new Z1(H.nr);

      for (int k=H.bx; k<=H.cx-2; k++){
         Z1 u = House.genc(H, k+1, H.rx, k);
         House.ua(u, H, k+1, H.rx, k+1, H.cx, work);
         House.au(H, u, H.bx, H.rx, k+1, H.cx, work);
         House.au(U, u, U.bx, U.rx, k+1, U.cx, work);
      }
   }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?