計算ルーチン: DGERQFの RQ 分解の結果より : (直交 Q の一部または全てを取り出す)

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

ホーム > LAPACKサンプルプログラム目次 > 計算ルーチン > DGERQFの RQ 分解の結果より

概要

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

入力データ

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

このデータをダウンロード
DORGRQ Example Program Data

  4      6                                :Values of M and N

 -0.57  -1.93   2.30  -1.93   0.15  -0.02
 -1.28   1.08   0.24   0.64   0.30   1.03
 -0.39  -0.31   0.40  -0.66   0.15  -1.43
  0.25  -2.14  -0.35   0.08  -2.13   0.50 :End of matrix A

出力結果

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

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

 The leading    4 rows of Q
          1       2       3       4       5       6
 1  -0.0833  0.2972 -0.6404  0.4461 -0.2938 -0.4575
 2   0.9100 -0.1080 -0.2351 -0.1620  0.2022 -0.1946
 3  -0.2202 -0.2706  0.2220 -0.3866  0.0015 -0.8243
 4  -0.0809  0.6922  0.1132 -0.0259  0.6890 -0.1617

ソースコード

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

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


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

!     DORGRQ Example Program Text

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

!     .. Use Statements ..
      Use lapack_example_aux, Only: nagf_file_print_matrix_real_gen
      Use lapack_interfaces, Only: dgerqf, dorgrq
      Use lapack_precision, Only: dp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter :: nb = 64, nin = 5, nout = 6
!     .. Local Scalars ..
      Integer :: i, ifail, info, lda, lwork, m, n
      Character (26) :: title
!     .. Local Arrays ..
      Real (Kind=dp), Allocatable :: a(:, :), tau(:), work(:)
!     .. Executable Statements ..
      Write (nout, *) 'DORGRQ Example Program Results'
      Write (nout, *)
!     Skip heading in data file
      Read (nin, *)
      Read (nin, *) m, n
      lda = m
      lwork = nb*m
      Allocate (a(lda,n), tau(n), work(lwork))

!     Read A from data file

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

!     Compute the RQ factorization of A
      Call dgerqf(m, n, a, lda, tau, work, lwork, info)

!     Form the leading M rows of Q explicitly
      Call dorgrq(m, n, m, a, lda, tau, work, lwork, info)

!     Form the heading for nAGF_FILE_PRINT_MATRIX_REAL_GEN

      Write (title, 100) m
      Flush (nout)

!     Print the leading M rows of Q

!     ifail: behaviour on error exit
!             =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft
      ifail = 0
      Call nagf_file_print_matrix_real_gen('General', ' ', m, n, a, lda, &
        title, ifail)

100   Format ('The leading ', I4, ' rows of Q')
    End Program


ご案内
関連情報
Privacy Policy  /  Trademarks