計算ルーチン: ZGELQF により決まる LQ 分解からのユニタリ Q の全てまたは一部の生成

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

ホーム > LAPACKサンプルプログラム目次 > 計算ルーチン > ZGELQF により決まる LQ 分解からのユニタリ Q の全てまたは一部の生成

概要

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

入力データ

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

このデータをダウンロード
ZUNGLQ Example Program Data
  3  4                                                     :Values of M and N
 ( 0.28,-0.36) ( 0.50,-0.86) (-0.77,-0.48) ( 1.58, 0.66)
 (-0.50,-1.10) (-1.21, 0.76) (-0.32,-0.24) (-0.27,-1.15)
 ( 0.36,-0.51) (-0.07, 1.33) (-0.75, 0.47) (-0.08, 1.01)   :End of matrix A

出力結果

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

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

 The leading  3 rows of Q
                    1                 2                 3                 4
 1  (-0.1258, 0.1618) (-0.2247, 0.3864) ( 0.3460, 0.2157) (-0.7099,-0.2966)
 2  (-0.1163,-0.6380) (-0.3240, 0.4272) (-0.1995,-0.5009) (-0.0323,-0.0162)
 3  (-0.4607, 0.1090) ( 0.2171,-0.4062) ( 0.2733,-0.6106) (-0.0994,-0.3261)

ソースコード

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

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


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

!     ZUNGLQ 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_gen_comp
      Use lapack_interfaces, Only: zgelqf, zunglq
      Use lapack_precision, Only: dp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter :: nin = 5, nout = 6
!     .. Local Scalars ..
      Integer :: i, ifail, info, lda, lwork, m, n
      Character (30) :: title
!     .. Local Arrays ..
      Complex (Kind=dp), Allocatable :: a(:, :), tau(:), work(:)
      Character (1) :: clabs(1), rlabs(1)
!     .. Executable Statements ..
      Write (nout, *) 'ZUNGLQ Example Program Results'
!     Skip heading in data file
      Read (nin, *)
      Read (nin, *) m, n
      lda = m
      lwork = 64*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 LQ factorization of A
      Call zgelqf(m, n, a, lda, tau, work, lwork, info)

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

!     Print the leading M rows of Q only

      Write (nout, *)
      Write (title, 100) m
      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_gen_comp('General', ' ', m, n, a, &
        lda, 'Bracketed', 'F7.4', title, 'Integer', rlabs, 'Integer', clabs, &
        80, 0, ifail)

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


ご案内
関連情報
Privacy Policy  /  Trademarks