計算ルーチン: m × n 複素帯行列の LU 分解

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

ホーム > LAPACKサンプルプログラム目次 > 計算ルーチン > m × n 複素帯行列の LU 分解

概要

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

入力データ

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

このデータをダウンロード
ZGBTRF Example Program Data
  4  4  1  2                                          :Values of M, N, KL and KU
 (-1.65, 2.26) (-2.05,-0.85) ( 0.97,-2.84)
 ( 0.00, 6.30) (-1.48,-1.75) (-3.99, 4.01) ( 0.59,-0.48)
               (-0.77, 2.83) (-1.06, 1.94) ( 3.33,-1.04)
                             ( 4.48,-1.09) (-0.46,-1.72)  :End of matrix A

出力結果

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

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

 Details of factorization
                    1                 2                 3                 4
 1  ( 0.0000, 6.3000) (-1.4800,-1.7500) (-3.9900, 4.0100) ( 0.5900,-0.4800)
 2  ( 0.3587, 0.2619) (-0.7700, 2.8300) (-1.0600, 1.9400) ( 3.3300,-1.0400)
 3                    ( 0.2314, 0.6358) ( 4.9303,-3.0086) (-1.7692,-1.8587)
 4                                      ( 0.7604, 0.2429) ( 0.4338, 0.1233)

 IPIV
            2                 3                 3                 4

ソースコード

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

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


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

!     ZGBTRF 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_band_comp
      Use lapack_interfaces, Only: zgbtrf
      Use lapack_precision, Only: dp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter :: nin = 5, nout = 6
!     .. Local Scalars ..
      Integer :: i, ifail, info, j, k, kl, ku, ldab, m, n
!     .. Local Arrays ..
      Complex (Kind=dp), Allocatable :: ab(:, :)
      Integer, Allocatable :: ipiv(:)
      Character (1) :: clabs(1), rlabs(1)
!     .. Intrinsic Procedures ..
      Intrinsic :: max, min
!     .. Executable Statements ..
      Write (nout, *) 'ZGBTRF Example Program Results'
!     Skip heading in data file
      Read (nin, *)
      Read (nin, *) m, n, kl, ku
      ldab = 2*kl + ku + 1
      Allocate (ab(ldab,n), ipiv(n))

!     Read A from data file

      k = kl + ku + 1
      Read (nin, *)((ab(k+i-j,j),j=max(i-kl,1),min(i+ku,n)), i=1, m)

!     Factorize A
      Call zgbtrf(m, n, kl, ku, ab, ldab, ipiv, info)

!     Print details of factorization

      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_band_comp(m, n, kl, kl+ku, ab, ldab, &
        'Bracketed', 'F7.4', 'Details of factorization', 'Integer', rlabs, &
        'Integer', clabs, 80, 0, ifail)

!     Print pivot indices

      Write (nout, *)
      Write (nout, *) 'IPIV'
      Write (nout, 100) ipiv(1:min(m,n))

      If (info/=0) Then
        Write (nout, *) 'The factor U is singular'
      End If

100   Format ((1X,I12,3I18))
    End Program


ご案内
関連情報
Privacy Policy  /  Trademarks