概要
本サンプルはFortran言語によりLAPACKルーチンZUNGRQを利用するサンプルプログラムです。
入力データ
(本ルーチンの詳細はZUNGRQ のマニュアルページを参照)| このデータをダウンロード |
ZUNGRQ Example Program Data 4 6 :Values of M and N ( 0.96,-0.81) (-0.98, 1.98) ( 0.62,-0.46) (-0.37, 0.38) ( 0.83, 0.51) ( 1.08,-0.28) (-0.03, 0.96) (-1.20, 0.19) ( 1.01, 0.02) ( 0.19,-0.54) ( 0.20, 0.01) ( 0.20,-0.12) (-0.91, 2.06) (-0.66, 0.42) ( 0.63,-0.17) (-0.98,-0.36) (-0.17,-0.46) (-0.07, 1.23) (-0.05, 0.41) (-0.81, 0.56) (-1.11, 0.60) ( 0.22,-0.20) ( 1.47, 1.59) ( 0.26, 0.26) :End of matrix A
出力結果
(本ルーチンの詳細はZUNGRQ のマニュアルページを参照)| この出力例をダウンロード |
ZUNGRQ Example Program Results
The leading 4 rows of Q
1 2 3 4
1 ( 0.2810, 0.5020) ( 0.2707,-0.3296) (-0.2864,-0.0094) ( 0.2262,-0.3854)
2 (-0.2051,-0.1092) ( 0.5711, 0.0432) (-0.5416, 0.0454) (-0.3387, 0.2228)
3 ( 0.3083,-0.6874) ( 0.2251,-0.1313) (-0.2062, 0.0691) ( 0.3259, 0.1178)
4 ( 0.0181,-0.1483) ( 0.2930,-0.2025) ( 0.4015,-0.2170) (-0.0796, 0.0723)
5 6
1 ( 0.0341,-0.0760) (-0.3936,-0.2083)
2 ( 0.0098,-0.0712) (-0.1296, 0.3691)
3 ( 0.0753, 0.1412) ( 0.0264,-0.4134)
4 (-0.5317,-0.5751) (-0.0940,-0.0940)
ソースコード
(本ルーチンの詳細はZUNGRQ のマニュアルページを参照)※本サンプルソースコードのご利用手順は「サンプルのコンパイル及び実行方法」をご参照下さい。
| このソースコードをダウンロード |
Program zungrq_example
! ZUNGRQ 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: zgerqf, zungrq
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 ..
Complex (Kind=dp), Allocatable :: a(:, :), tau(:), work(:)
Character (1) :: clabs(1), rlabs(1)
! .. Executable Statements ..
Write (nout, *) 'ZUNGRQ 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 zgerqf(m, n, a, lda, tau, work, lwork, info)
! Form the leading M rows of Q explicitly
Call zungrq(m, n, m, a, lda, tau, work, lwork, info)
! Form the heading for nAGF_FILE_PRINT_MATRIX_COMPLEX_GEN_COMP
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_complex_gen_comp('General', ' ', m, n, a, &
lda, 'Bracketed', 'F7.4', title, 'Integer', rlabs, 'Integer', clabs, &
80, 0, ifail)
100 Format ('The leading ', I4, ' rows of Q')
End Program
