計算ルーチン: 複素三重対角行列の LU 分解

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

ホーム > LAPACKサンプルプログラム目次 > 計算ルーチン > 複素三重対角行列の LU 分解

概要

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

入力データ

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

このデータをダウンロード
ZGTTRF Example Program Data
   5                                             :Value of N
 ( 2.0,-1.0) ( 2.0, 1.0) (-1.0, 1.0) ( 1.0,-1.0) :End of DU
 (-1.3, 1.3) (-1.3, 1.3) (-1.3, 3.3) (-0.3, 4.3)
 (-3.3, 1.3)                                     :End of D
 ( 1.0,-2.0) ( 1.0, 1.0) ( 2.0,-3.0) ( 1.0, 1.0) :End of DL

出力結果

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

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

 Details of factorization

  Second superdiagonal of U
 (  2.0000,  1.0000) ( -1.0000,  1.0000) (  1.0000, -1.0000)

  First superdiagonal of U
 ( -1.3000,  1.3000) ( -1.3000,  3.3000) ( -0.3000,  4.3000) ( -3.3000,  1.3000)

  Main diagonal of U
 (  1.0000, -2.0000) (  1.0000,  1.0000) (  2.0000, -3.0000) (  1.0000,  1.0000)
 ( -1.3399,  0.2875)

  Multipliers
 ( -0.7800, -0.2600) (  0.1620, -0.4860) ( -0.0452, -0.0010) ( -0.3979, -0.0562)

  Vector of interchanges
       2      3      4      5      5

ソースコード

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

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


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

!     ZGTTRF Example Program Text

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

!     .. Use Statements ..
      Use lapack_interfaces, Only: zgttrf
      Use lapack_precision, Only: dp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter :: nin = 5, nout = 6
!     .. Local Scalars ..
      Integer :: info, n
!     .. Local Arrays ..
      Complex (Kind=dp), Allocatable :: d(:), dl(:), du(:), du2(:)
      Integer, Allocatable :: ipiv(:)
!     .. Executable Statements ..
      Write (nout, *) 'ZGTTRF Example Program Results'
      Write (nout, *)
!     Skip heading in data file
      Read (nin, *)
      Read (nin, *) n

      Allocate (d(n), dl(n-1), du(n-1), du2(n-2), ipiv(n))

!     Read the tridiagonal matrix A from data file

      Read (nin, *) du(1:n-1)
      Read (nin, *) d(1:n)
      Read (nin, *) dl(1:n-1)

!     Factorize the tridiagonal matrix A
      Call zgttrf(n, dl, d, du, du2, ipiv, info)

      If (info>0) Then
        Write (nout, 100) 'The (', info, ',', info, ')', &
          ' element of the factor U is zero'
      End If

!     Print details of the factorization

      Write (nout, *) 'Details of factorization'
      Write (nout, *)
      Write (nout, *) ' Second superdiagonal of U'
      Write (nout, 110) du2(1:n-2)
      Write (nout, *)
      Write (nout, *) ' First superdiagonal of U'
      Write (nout, 110) du(1:n-1)
      Write (nout, *)
      Write (nout, *) ' Main diagonal of U'
      Write (nout, 110) d(1:n)
      Write (nout, *)
      Write (nout, *) ' Multipliers'
      Write (nout, 110) dl(1:n-1)
      Write (nout, *)
      Write (nout, *) ' Vector of interchanges'
      Write (nout, 120) ipiv(1:n)

100   Format (1X, A, I3, A, I3, A, A)
110   Format (4(' (',F8.4,',',F8.4,')',:))
120   Format (1X, 5I7)
    End Program


ご案内
関連情報
Privacy Policy  /  Trademarks