計算ルーチン: 複素エルミート正定値三重対角行列の L×D×L′分解

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

ホーム > LAPACKサンプルプログラム目次 > 計算ルーチン > 複素エルミート正定値三重対角行列の L×D×L′分解

概要

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

入力データ

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

このデータをダウンロード
ZPTTRF Example Program Data
    4                                                    :Value of N
   16.0          41.0          46.0          21.0        :End of diagonal D
 ( 16.0, 16.0) ( 18.0, -9.0) (  1.0, -4.0)               :End of sub-diagonal E

出力結果

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

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

 Details of factorization

  The diagonal elements of D
   16.0000   9.0000   1.0000   4.0000

  Subdiagonal elements of the Cholesky factor L
    1.0000   1.0000   2.0000  -1.0000   1.0000  -4.0000

ソースコード

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

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


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

!     ZPTTRF Example Program Text

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

!     .. Use Statements ..
      Use lapack_interfaces, Only: zpttrf
      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 :: e(:)
      Real (Kind=dp), Allocatable :: d(:)
!     .. Executable Statements ..
      Write (nout, *) 'ZPTTRF Example Program Results'
      Write (nout, *)
!     Skip heading in data file
      Read (nin, *)
      Read (nin, *) n

      Allocate (e(n-1), d(n))

!     Read the lower bidiagonal part of the tridiagonal matrix A from
!     data file

      Read (nin, *) d(1:n)
      Read (nin, *) e(1:n-1)

!     Factorize the tridiagonal matrix A
      Call zpttrf(n, d, e, info)

      If (info>0) Then
        Write (nout, 100) 'The leading minor of order ', info, &
          ' is not positive definite'
      End If

!     Print details of the factorization

      Write (nout, *) 'Details of factorization'
      Write (nout, *)
      Write (nout, *) ' The diagonal elements of D'
      Write (nout, 110) d(1:n)
      Write (nout, *)
      Write (nout, *) ' Subdiagonal elements of the Cholesky factor L'
      Write (nout, 110) e(1:n-1)

100   Format (1X, A, I3, A)
110   Format (1X, 8F9.4)
    End Program


ご案内
関連情報
Privacy Policy  /  Trademarks