計算ルーチン: 複素一般行列のヘッセンベルグ形へのユニタリ縮約

LAPACKサンプルソースコード : 使用ルーチン名:ZGEHRD

ホーム > LAPACKサンプルプログラム目次 > 計算ルーチン > 複素一般行列のヘッセンベルグ形へのユニタリ縮約

概要

本サンプルはFortran言語によりLAPACKルーチンZGEHRDを利用するサンプルプログラムです。

入力データ

(本ルーチンの詳細はZGEHRD のマニュアルページを参照)

このデータをダウンロード
ZGEHRD Example Program Data
  4                                                        :Value of N
 (-3.97,-5.04) (-4.11, 3.70) (-0.34, 1.01) ( 1.29,-0.86)
 ( 0.34,-1.50) ( 1.52,-0.43) ( 1.88,-5.38) ( 3.36, 0.65)
 ( 3.31,-3.85) ( 2.50, 3.45) ( 0.88,-1.08) ( 0.64,-1.48)
 (-1.10, 0.82) ( 1.81,-1.59) ( 3.25, 1.33) ( 1.57,-3.44)   :End of matrix A

出力結果

(本ルーチンの詳細はZGEHRD のマニュアルページを参照)

この出力例をダウンロード
 ZGEHRD Example Program Results

 Upper Hessenberg form
                    1                 2                 3                 4
 1  (-3.9700,-5.0400) (-1.1318,-2.5693) (-4.6027,-0.1426) (-1.4249, 1.7330)
 2  (-5.4797, 0.0000) ( 1.8585,-1.5502) ( 4.4145,-0.7638) (-0.4805,-1.1976)
 3  ( 0.0000, 0.0000) ( 6.2673, 0.0000) (-0.4504,-0.0290) (-1.3467, 1.6579)
 4  ( 0.0000, 0.0000) ( 0.0000, 0.0000) (-3.5000, 0.0000) ( 2.5619,-3.3708)

ソースコード

(本ルーチンの詳細はZGEHRD のマニュアルページを参照)

※本サンプルソースコードのご利用手順は「サンプルのコンパイル及び実行方法」をご参照下さい。


このソースコードをダウンロード
    Program zgehrd_example

!     ZGEHRD Example Program Text

!     Copyright 2017, Numerical Algorithms Group Ltd. http://www.nag.com

!     .. Use Statements ..
      Use lapack_example_aux, Only: nagf_file_print_matrix_complex_gen_comp
      Use lapack_interfaces, Only: zgehrd
      Use lapack_precision, Only: dp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Complex (Kind=dp), Parameter :: zero = (0.0E0_dp, 0.0E0_dp)
      Integer, Parameter :: nin = 5, nout = 6
!     .. Local Scalars ..
      Integer :: i, ifail, info, lda, lwork, n
!     .. Local Arrays ..
      Complex (Kind=dp), Allocatable :: a(:, :), tau(:), work(:)
      Character (1) :: clabs(1), rlabs(1)
!     .. Executable Statements ..
      Write (nout, *) 'ZGEHRD Example Program Results'
!     Skip heading in data file
      Read (nin, *)
      Read (nin, *) n
      lda = n
      lwork = 64*n
      Allocate (a(lda,n), tau(n-1), work(lwork))

!     Read A from data file

      Read (nin, *)(a(i,1:n), i=1, n)

!     Reduce A to upper Hessenberg form

      Call zgehrd(n, 1, n, a, lda, tau, work, lwork, info)

!     Set the elements below the first subdiagonal to zero

      Do i = 1, n - 2
        a(i+2:n, i) = zero
      End Do

!     Print upper Hessenberg form

      Write (nout, *)
      Flush (nout)

!     ifail: behaviour on error exit
!             =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft
      ifail = 0
      Call nagf_file_print_matrix_complex_gen_comp('General', ' ', n, n, a, &
        lda, 'Bracketed', 'F7.4', 'Upper Hessenberg form', 'Integer', rlabs, &
        'Integer', clabs, 80, 0, ifail)

    End Program


ご案内
関連情報
Privacy Policy  /  Trademarks