@@ -558,39 +558,6 @@ subroutine do_dense_to_col_sparse_0_based_qp( &
558
558
end subroutine do_dense_to_col_sparse_0_based_qp
559
559
560
560
561
- subroutine do_quad_dense_to_col_sparse_0_based ( &
562
- n ,ndim ,a ,nzmax ,nz ,colptr ,rowind ,values ,diags ,ierr )
563
- integer , intent (in ) :: n,ndim,nzmax
564
- real (qp), intent (in ) :: a(:,:) ! (ndim,n)
565
- integer , intent (inout ) :: colptr(:) ! (n+1)
566
- integer , intent (inout ) :: rowind(:) ! (nzmax)
567
- real (qp), intent (out ) :: values(:) ! (nzmax)
568
- logical , intent (in ) :: diags
569
- integer , intent (out ) :: nz,ierr
570
- integer :: i,j
571
- ierr = 0
572
- nz = 0
573
- do j= 1 ,n
574
- colptr(j) = nz ! index in values of first entry in this column
575
- do i= 1 ,n
576
- if (a(i,j) == 0 ) then
577
- if (i /= j) cycle ! not a diagonal
578
- if (.not. diags) cycle
579
- ! else include diagonals even if are == 0
580
- end if
581
- nz = nz+1
582
- if (nz > nzmax) then
583
- ierr = j
584
- return
585
- end if
586
- values(nz) = a(i,j)
587
- rowind(nz) = i-1
588
- end do
589
- end do
590
- colptr(n+1 ) = nz
591
- end subroutine do_quad_dense_to_col_sparse_0_based
592
-
593
-
594
561
subroutine do_column_sparse_to_dense (n ,ndim ,a ,nz ,colptr ,rowind ,values ,ierr )
595
562
integer , intent (in ) :: n,ndim,nz
596
563
real (dp), intent (inout ) :: a(ndim,n)
@@ -617,28 +584,6 @@ subroutine do_column_sparse_to_dense(n,ndim,a,nz,colptr,rowind,values,ierr)
617
584
end subroutine do_column_sparse_to_dense
618
585
619
586
620
- subroutine do_quad_column_sparse_to_dense (n ,ndim ,a ,nz ,colptr ,rowind ,values ,ierr )
621
- integer , intent (in ) :: n,ndim,nz
622
- real (qp), intent (out ) :: a(ndim,n)
623
- integer , intent (in ) :: colptr(n+1 ),rowind(nz)
624
- real (qp), intent (in ) :: values(nz)
625
- integer , intent (out ) :: ierr
626
- integer :: i,j,k
627
- ierr = 0
628
- a = 0
629
- do j= 1 ,n
630
- do k= colptr(j),colptr(j+1 )- 1
631
- i = rowind(k)
632
- if (i > n) then
633
- ierr = j
634
- return
635
- endif
636
- a(i,j) = values(k)
637
- end do
638
- end do
639
- end subroutine do_quad_column_sparse_to_dense
640
-
641
-
642
587
subroutine do_col_sparse_0_based_to_dense (n ,ndim ,a ,nz ,colptr ,rowind ,values ,ierr )
643
588
integer , intent (in ) :: n,ndim,nz
644
589
real (dp), intent (inout ) :: a(ndim,n)
@@ -685,56 +630,6 @@ subroutine do_block_dble_mv(nvar, nz, lblk, dblk, ublk, b, prod)
685
630
end subroutine do_block_dble_mv
686
631
687
632
688
- subroutine do_block_mv_quad (lblk , dblk , ublk , b , prod )
689
- real (qp), pointer , dimension (:,:,:), intent (in ) :: lblk, dblk, ublk ! (nvar,nvar,nz)
690
- real (qp), pointer , dimension (:,:), intent (in ) :: b ! (nvar,nz)
691
- real (qp), pointer , dimension (:,:), intent (inout ) :: prod ! (nvar,nz)
692
- integer :: nvar, nz, k
693
- include ' formats'
694
- nvar = size (b,dim= 1 )
695
- nz = size (b,dim= 2 )
696
- ! $OMP PARALLEL DO PRIVATE(k)
697
- do k = 1 , nz
698
- prod(:,k) = 0
699
- call qdgemv(nvar,nvar,dblk(:,:,k),nvar,b(:,k),prod(:,k))
700
- if (k > 1 ) then
701
- call qdgemv(nvar,nvar,lblk(:,:,k),nvar,b(:,k-1 ),prod(:,k))
702
- end if
703
- if (k < nz) then
704
- call qdgemv(nvar,nvar,ublk(:,:,k),nvar,b(:,k+1 ),prod(:,k))
705
- end if
706
- end do
707
- ! $OMP END PARALLEL DO
708
-
709
- contains
710
-
711
- subroutine qdgemv (m ,n ,a ,lda ,x ,y )
712
- ! y := alpha*a*x + beta*y
713
- use const_def, only: dp
714
-
715
- integer lda,m,n
716
- real (qp) a(lda,* ),x(* ),y(* )
717
- real (qp) :: tmp
718
- ! trans = 'n'
719
- ! alpha = 1
720
- ! beta = 1
721
- ! incx = 1
722
- ! incy = 1
723
- integer :: j, i
724
- do j = 1 ,n
725
- tmp = x(j)
726
- if (tmp.ne. 0d0 ) then
727
- do i = 1 ,m
728
- y(i) = y(i) + tmp* a(i,j)
729
- end do
730
- end if
731
- end do
732
- end subroutine qdgemv
733
-
734
-
735
- end subroutine do_block_mv_quad
736
-
737
-
738
633
subroutine do_LU_factored_block_dble_mv (lblk , dblk , ublk , b , ipiv , prod )
739
634
real (dp), pointer , dimension (:,:,:), intent (in ) :: lblk, dblk, ublk ! (nvar,nvar,nz)
740
635
real (dp), pointer , dimension (:,:), intent (in ) :: b ! (nvar,nz)
@@ -836,21 +731,6 @@ subroutine do_multiply_xa(n, A1, x, b)
836
731
end subroutine do_multiply_xa
837
732
838
733
839
- subroutine do_quad_multiply_xa (n , A1 , x , b )
840
- ! calculates b = x*A
841
- integer , intent (in ) :: n
842
- real (qp), pointer , intent (in ) :: A1(:) ! =(n, n)
843
- real (qp), pointer , intent (in ) :: x(:) ! (n)
844
- real (qp), pointer , intent (inout ) :: b(:) ! (n)
845
- integer :: j
846
- real (qp), pointer :: A(:,:) ! (n, n)
847
- A(1 :n,1 :n) = > A1(1 :n* n)
848
- do j = 1 , n
849
- b(j) = dot_product (x(1 :n),A(1 :n,j))
850
- end do
851
- end subroutine do_quad_multiply_xa
852
-
853
-
854
734
subroutine do_multiply_xa_plus_c (n , A1 , x , c , b )
855
735
! calculates b = x*A + c
856
736
integer , intent (in ) :: n
@@ -867,22 +747,6 @@ subroutine do_multiply_xa_plus_c(n, A1, x, c, b)
867
747
end subroutine do_multiply_xa_plus_c
868
748
869
749
870
- subroutine do_quad_multiply_xa_plus_c (n , A1 , x , c , b )
871
- ! calculates b = x*A + c
872
- integer , intent (in ) :: n
873
- real (qp), pointer , intent (in ) :: A1(:) ! =(n, n)
874
- real (qp), pointer , intent (in ) :: x(:) ! (n)
875
- real (qp), pointer , intent (in ) :: c(:) ! (n)
876
- real (qp), pointer , intent (inout ) :: b(:) ! (n)
877
- integer :: j
878
- real (qp), pointer :: A(:,:) ! (n, n)
879
- A(1 :n,1 :n) = > A1(1 :n* n)
880
- do j = 1 , n
881
- b(j) = dot_product (x(1 :n),A(1 :n,j)) + c(j)
882
- end do
883
- end subroutine do_quad_multiply_xa_plus_c
884
-
885
-
886
750
subroutine do_block_multiply_xa (nvar , nz , lblk1 , dblk1 , ublk1 , x1 , b1 )
887
751
! calculates b = x*A
888
752
integer , intent (in ) :: nvar, nz
@@ -919,42 +783,6 @@ subroutine do_block_multiply_xa(nvar, nz, lblk1, dblk1, ublk1, x1, b1)
919
783
end subroutine do_block_multiply_xa
920
784
921
785
922
- subroutine do_quad_block_multiply_xa (nvar , nz , lblk1 , dblk1 , ublk1 , x1 , b1 )
923
- ! calculates b = x*A
924
- integer , intent (in ) :: nvar, nz
925
- real (qp), dimension (:), intent (in ), pointer :: lblk1, dblk1, ublk1 ! =(nvar,nvar,nz)
926
- real (qp), intent (in ), pointer :: x1(:) ! =(nvar,nz)
927
- real (qp), intent (inout ), pointer :: b1(:) ! =(nvar,nz)
928
- integer :: k, shift, shift2, nvar2
929
- real (qp), pointer , dimension (:) :: p1, p2, p3, p4
930
- nvar2 = nvar* nvar
931
- ! $OMP PARALLEL DO PRIVATE(k,shift,shift2,p1,p2,p3,p4)
932
- do k = 1 , nz
933
- shift = nvar* (k-1 )
934
- shift2 = nvar2* (k-1 )
935
- p1(1 :nvar2) = > dblk1(shift2+1 :shift2+ nvar2)
936
- p2(1 :nvar) = > x1(shift+1 :shift+ nvar)
937
- p3(1 :nvar) = > b1(shift+1 :shift+ nvar)
938
- call do_quad_multiply_xa(nvar,p1,p2,p3)
939
- if (k > 1 ) then
940
- p1(1 :nvar2) = > ublk1(shift2+1 :shift2+ nvar2)
941
- p2(1 :nvar) = > x1(shift+1 :shift+ nvar)
942
- p3(1 :nvar) = > b1(shift+1 :shift+ nvar)
943
- p4(1 :nvar) = > b1(shift+1 :shift+ nvar)
944
- call do_quad_multiply_xa_plus_c(nvar,p1,p2,p3,p4)
945
- end if
946
- if (k < nz) then
947
- p1(1 :nvar2) = > lblk1(shift2+1 :shift2+ nvar2)
948
- p2(1 :nvar) = > x1(shift+1 + nvar:shift+2 * nvar)
949
- p3(1 :nvar) = > b1(shift+1 :shift+ nvar)
950
- p4(1 :nvar) = > b1(shift+1 :shift+ nvar)
951
- call do_quad_multiply_xa_plus_c(nvar,p1,p2,p3,p4)
952
- end if
953
- end do
954
- ! $OMP END PARALLEL DO
955
- end subroutine do_quad_block_multiply_xa
956
-
957
-
958
786
subroutine do_band_multiply_xa (n , kl , ku , ab1 , ldab , x , b )
959
787
! calculates b = x*a = transpose(a)*x
960
788
integer , intent (in ) :: n
@@ -988,38 +816,6 @@ subroutine do_band_multiply_xa(n, kl, ku, ab1, ldab, x, b)
988
816
end subroutine do_band_multiply_xa
989
817
990
818
991
- subroutine do_quad_band_multiply_xa (n , kl , ku , ab , ldab , x , b )
992
- ! calculates b = x*a = transpose(a)*x
993
- integer , intent (in ) :: n
994
- ! the number of linear equations, i.e., the order of the
995
- ! matrix a. n >= 0.
996
- integer , intent (in ) :: kl
997
- ! the number of subdiagonals within the band of a. kl >= 0.
998
- integer , intent (in ) :: ku
999
- ! the number of superdiagonals within the band of a. ku >= 0.
1000
- integer , intent (in ) :: ldab
1001
- ! the leading dimension of the array ab. ldab >= kl+ku+1.
1002
- real (qp), intent (in ) :: ab(:,:) ! (ldab, n)
1003
- ! the matrix a in band storage, in rows 1 to kl+ku+1;
1004
- ! the j-th column of a is stored in the j-th column of the
1005
- ! array ab as follows:
1006
- ! ab(ku+1+i-j, j) = a(i, j) for max(1, j-ku)<=i<=min(n, j+kl)
1007
- real (qp), intent (in ) :: x(:) ! (n)
1008
- ! the input vector to be multiplied by the matrix.
1009
- real (qp), intent (inout ) :: b(:) ! (n)
1010
- ! on exit, set to matrix product of x*a = b
1011
- integer :: i, j, k
1012
- do j = 1 , n
1013
- k = ku+1 - j
1014
- b(j) = 0
1015
- do i = max (1 , j- ku), min (n, j+ kl)
1016
- b(j) = b(j) + x(i)* ab(k+ i, j)
1017
- end do
1018
- end do
1019
- end subroutine do_quad_band_multiply_xa
1020
-
1021
-
1022
-
1023
819
subroutine do_clip_blocks ( &
1024
820
mblk , clip_limit , lmat , dmat , umat , dmat_nnz , total_nnz )
1025
821
integer , intent (in ) :: mblk
@@ -1106,52 +902,6 @@ subroutine read_hbcode1(iounit, nrow, ncol, nnzero, values, rowind, colptr, ierr
1106
902
end subroutine read_hbcode1
1107
903
1108
904
1109
- subroutine read_hbcode1_quad (iounit , nrow , ncol , nnzero , values , rowind , colptr , ierr )
1110
-
1111
- CHARACTER TITLE* 72 , KEY* 8 , MXTYPE* 3 , &
1112
- PTRFMT* 16 , INDFMT* 16 , VALFMT* 20 , RHSFMT* 20
1113
-
1114
- INTEGER TOTCRD, PTRCRD, INDCRD, VALCRD, RHSCRD, &
1115
- iounit, NROW , NCOL , NNZERO, NELTVL
1116
-
1117
- INTEGER , pointer :: COLPTR (:), ROWIND (:)
1118
-
1119
- REAL (qp), pointer :: VALUES (:)
1120
- integer , intent (out ) :: ierr
1121
-
1122
- integer :: i
1123
- ierr = 0
1124
- READ (iounit, 1000 , iostat= ierr ) TITLE , KEY , &
1125
- TOTCRD, PTRCRD, INDCRD, VALCRD, RHSCRD, &
1126
- MXTYPE, NROW , NCOL , NNZERO, NELTVL, &
1127
- PTRFMT, INDFMT, VALFMT, RHSFMT
1128
- if (ierr /= 0 ) return
1129
- 1000 FORMAT ( A72, A8 / 5I14 / A3, 11X , 4I14 / 2A16 , 2A20 )
1130
-
1131
- allocate (VALUES(NNZERO), ROWIND(NNZERO), COLPTR(NCOL+1 ), stat= ierr)
1132
- if (ierr /= 0 ) return
1133
-
1134
- READ (iounit, PTRFMT, iostat= ierr ) ( COLPTR (I), I = 1 , NCOL+1 )
1135
- if (ierr /= 0 ) return
1136
-
1137
- READ (iounit, INDFMT, iostat= ierr ) ( ROWIND (I), I = 1 , NNZERO )
1138
- if (ierr /= 0 ) return
1139
-
1140
- IF ( VALCRD .GT. 0 ) THEN
1141
-
1142
- ! ----------------------
1143
- ! ... READ MATRIX VALUES
1144
- ! ----------------------
1145
-
1146
- READ (iounit, VALFMT, iostat= ierr ) ( VALUES (I), I = 1 , NNZERO )
1147
- if (ierr /= 0 ) return
1148
-
1149
- ENDIF
1150
-
1151
-
1152
- end subroutine read_hbcode1_quad
1153
-
1154
-
1155
905
subroutine write_hbcode1 (iounit , nrow , ncol , nnzero , values , rowind , colptr , ierr )
1156
906
1157
907
CHARACTER TITLE* 72 , KEY* 8 , MXTYPE* 3 , &
@@ -1304,37 +1054,6 @@ subroutine read_block_tridiagonal(iounit,nvar,nblk,lblk1,dblk1,ublk1,ierr)
1304
1054
end subroutine read_block_tridiagonal
1305
1055
1306
1056
1307
- subroutine read_quad_block_tridiagonal (iounit ,nvar ,nblk ,lblk1 ,dblk1 ,ublk1 ,ierr )
1308
- integer , intent (in ) :: iounit
1309
- integer , intent (out ) :: nvar, nblk
1310
- real (qp), pointer , dimension (:) :: lblk1,dblk1,ublk1 ! will be allocated
1311
- integer , intent (out ) :: ierr
1312
- integer :: k
1313
- real (qp), pointer , dimension (:,:,:) :: lblk,dblk,ublk
1314
- ierr = 0
1315
- read (iounit,* ,iostat= ierr) nvar, nblk
1316
- if (ierr /= 0 ) return
1317
- allocate (lblk1(nvar* nvar* nblk), dblk1(nvar* nvar* nblk), ublk1(nvar* nvar* nblk), stat= ierr)
1318
- if (ierr /= 0 ) return
1319
- lblk(1 :nvar,1 :nvar,1 :nblk) = > lblk1(1 :nvar* nvar* nblk)
1320
- dblk(1 :nvar,1 :nvar,1 :nblk) = > dblk1(1 :nvar* nvar* nblk)
1321
- ublk(1 :nvar,1 :nvar,1 :nblk) = > ublk1(1 :nvar* nvar* nblk)
1322
- do k= 1 ,nblk
1323
- if (k > 1 ) then
1324
- call read1_sparse_block_quad(iounit, nvar, lblk(:,:,k), ierr)
1325
- if (ierr /= 0 ) return
1326
- end if
1327
- call read1_sparse_block_quad(iounit, nvar, dblk(:,:,k), ierr)
1328
- if (ierr /= 0 ) return
1329
- if (k < nblk) then
1330
- call read1_sparse_block_quad(iounit, nvar, ublk(:,:,k), ierr)
1331
- if (ierr /= 0 ) return
1332
- end if
1333
- end do
1334
-
1335
- end subroutine read_quad_block_tridiagonal
1336
-
1337
-
1338
1057
subroutine read1_sparse_block (iounit , nvar , blk , ierr )
1339
1058
integer , intent (in ) :: iounit, nvar
1340
1059
real (dp) :: blk(:,:) ! (nvar,nvar)
@@ -1350,21 +1069,6 @@ subroutine read1_sparse_block(iounit, nvar, blk, ierr)
1350
1069
end subroutine read1_sparse_block
1351
1070
1352
1071
1353
- subroutine read1_sparse_block_quad (iounit , nvar , blk , ierr )
1354
- integer , intent (in ) :: iounit, nvar
1355
- real (qp) :: blk(:,:) ! (nvar,nvar)
1356
- integer , intent (out ) :: ierr
1357
- integer :: nnz, nrow, ncol
1358
- integer , pointer :: rowind(:), colptr(:)
1359
- real (qp), pointer :: values(:)
1360
- ierr = 0
1361
- call read_hbcode1_quad(iounit, nrow, ncol, nnz, values, rowind, colptr,ierr)
1362
- if (ierr /= 0 .or. nrow /= nvar .or. nrow /= ncol) return
1363
- call do_quad_column_sparse_to_dense(nrow,ncol,blk,nnz,colptr,rowind,values,ierr)
1364
- deallocate (colptr,rowind,values)
1365
- end subroutine read1_sparse_block_quad
1366
-
1367
-
1368
1072
subroutine write_block_tridiagonal (iounit ,nvar ,nblk ,lblk ,dblk ,ublk ,ierr )
1369
1073
integer , intent (in ) :: iounit, nvar, nblk
1370
1074
real (dp), intent (in ), dimension (:,:,:) :: lblk,dblk,ublk
0 commit comments