計算ルーチン: 実対称三重対角行列の全ての固有値の計算 : (QL または QR の root-freevariant 法)

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

ホーム > LAPACKサンプルプログラム目次 > 計算ルーチン > 実対称三重対角行列の全ての固有値の計算

概要

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

入力データ

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

このデータをダウンロード
DSTERF Example Program Data
  4                           :Value of N
 -6.99   7.92   2.34   0.32
 -0.44  -2.63  -1.18          :End of matrix T

出力結果

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

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

 Eigenvalues
    -7.0037 -0.4059  2.0028  8.9968

ソースコード

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

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


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

!     DSTERF Example Program Text

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

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

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

!     Read T from data file

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

!     Calculate the eigenvalues of T
      Call dsterf(n, d, e, info)

      Write (nout, *)
      If (info>0) Then
        Write (nout, *) 'Failure to converge.'
      Else
        Write (nout, *) 'Eigenvalues'
        Write (nout, 100) d(1:n)
      End If

100   Format (3X, (9F8.4))
    End Program


ご案内
関連情報
Privacy Policy  /  Trademarks