OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
cfac_determinant.F
Go to the documentation of this file.
1C
2C This file is part of MUMPS 5.5.1, released
3C on Tue Jul 12 13:17:24 UTC 2022
4C
5C
6C Copyright 1991-2022 CERFACS, CNRS, ENS Lyon, INP Toulouse, Inria,
7C Mumps Technologies, University of Bordeaux.
8C
9C This version of MUMPS is provided to you free of charge. It is
10C released under the CeCILL-C license
11C (see doc/CeCILL-C_V1-en.txt, doc/CeCILL-C_V1-fr.txt, and
12C https://cecill.info/licences/Licence_CeCILL-C_V1-en.html)
13C
14 SUBROUTINE cmumps_updatedeter(PIV, DETER, NEXP)
15 IMPLICIT NONE
16 COMPLEX, intent(in) :: PIV
17 COMPLEX, intent(inout) :: DETER
18 INTEGER, intent(inout) :: NEXP
19 REAL R_PART, C_PART
20 INTEGER NEXP_LOC
21 deter=deter*piv
22 r_part=real(deter)
23 c_part=aimag(deter)
24 nexp_loc = exponent(abs(r_part)+abs(c_part))
25 nexp = nexp + nexp_loc
26 r_part=scale(r_part, -nexp_loc)
27 c_part=scale(c_part, -nexp_loc)
28 deter=cmplx(r_part,c_part,kind=kind(deter))
29 RETURN
30 END SUBROUTINE cmumps_updatedeter
31 SUBROUTINE cmumps_updatedeter_scaling(PIV, DETER, NEXP)
32 IMPLICIT NONE
33 REAL, intent(in) :: PIV
34 REAL, intent(inout) :: DETER
35 INTEGER, intent(inout) :: NEXP
36 deter=deter*fraction(piv)
37 nexp=nexp+exponent(piv)+exponent(deter)
38 deter=fraction(deter)
39 RETURN
40 END SUBROUTINE cmumps_updatedeter_scaling
41 SUBROUTINE cmumps_getdeter2d(BLOCK_SIZE,IPIV,
42 & MYROW, MYCOL, NPROW, NPCOL,
43 & A, LOCAL_M, LOCAL_N, N, MYID,
44 & DETER,NEXP,SYM)
45 IMPLICIT NONE
46 INTEGER, intent (in) :: SYM
47 INTEGER, intent (inout) :: NEXP
48 COMPLEX, intent (inout) :: DETER
49 INTEGER, intent (in) :: BLOCK_SIZE, NPROW, NPCOL,
50 & local_m, local_n, n
51 INTEGER, intent (in) :: MYROW, MYCOL, MYID, IPIV(LOCAL_M)
52 COMPLEX, intent(in) :: A(*)
53 INTEGER I,IMX,DI,NBLOCK,IBLOCK,ILOC,JLOC,
54 & row_proc,col_proc, k
55 di = local_m + 1
56 nblock = ( n - 1 ) / block_size
57 DO iblock = 0, nblock
58 row_proc = mod( iblock, nprow )
59 IF ( myrow.EQ.row_proc ) THEN
60 col_proc = mod( iblock, npcol )
61 IF ( mycol.EQ.col_proc ) THEN
62 iloc = ( iblock / nprow ) * block_size
63 jloc = ( iblock / npcol ) * block_size
64 i = iloc + jloc * local_m + 1
65 imx = min(iloc+block_size,local_m)
66 & + (min(jloc+block_size,local_n)-1)*local_m
67 & + 1
68 k=1
69 DO WHILE ( i .LT. imx )
70 CALL cmumps_updatedeter(a(i),deter,nexp)
71 IF (sym.EQ.1) THEN
72 CALL cmumps_updatedeter(a(i),deter,nexp)
73 ENDIF
74 IF (sym.NE.1) THEN
75 IF (ipiv(iloc+k) .NE. iblock*block_size+k) THEN
76 deter = -deter
77 ENDIF
78 ENDIF
79 k = k + 1
80 i = i + di
81 END DO
82 END IF
83 END IF
84 END DO
85 RETURN
86 END SUBROUTINE cmumps_getdeter2d
88 & COMM, DETER_IN, NEXP_IN,
89 & DETER_OUT, NEXP_OUT, NPROCS)
90 IMPLICIT NONE
91 INTEGER, intent(in) :: COMM, NPROCS
92 COMPLEX, intent(in) :: DETER_IN
93 INTEGER,intent(in) :: NEXP_IN
94 COMPLEX,intent(out):: DETER_OUT
95 INTEGER,intent(out):: NEXP_OUT
96 INTEGER :: IERR_MPI
98 INTEGER TWO_SCALARS_TYPE, DETERREDUCE_OP
99 COMPLEX :: INV(2)
100 COMPLEX :: OUTV(2)
101 include 'mpif.h'
102 IF (nprocs .EQ. 1) THEN
103 deter_out = deter_in
104 nexp_out = nexp_in
105 RETURN
106 ENDIF
107 CALL mpi_type_contiguous(2, mpi_complex,
108 & two_scalars_type,
109 & ierr_mpi)
110 CALL mpi_type_commit(two_scalars_type, ierr_mpi)
112 & .true.,
113 & deterreduce_op,
114 & ierr_mpi)
115 inv(1)=deter_in
116 inv(2)=cmplx(nexp_in,kind=kind(inv))
117 CALL mpi_allreduce( inv, outv, 1, two_scalars_type,
118 & deterreduce_op, comm, ierr_mpi)
119 CALL mpi_op_free(deterreduce_op, ierr_mpi)
120 CALL mpi_type_free(two_scalars_type, ierr_mpi)
121 deter_out = outv(1)
122 nexp_out = int(outv(2))
123 RETURN
124 END SUBROUTINE cmumps_deter_reduction
125 SUBROUTINE cmumps_deterreduce_func(INV, INOUTV, NEL, DATATYPE)
126 IMPLICIT NONE
127#if defined(WORKAROUNDINTELILP64MPI2INTEGER) || defined(WORKAROUNDILP64MPICUSTOMREDUCE)
128 INTEGER(4), INTENT(IN) :: NEL, DATATYPE
129#else
130 INTEGER, INTENT(IN) :: NEL, DATATYPE
131#endif
132 COMPLEX, INTENT(IN) :: INV ( 2 * NEL )
133 COMPLEX, INTENT(INOUT) :: INOUTV ( 2 * NEL )
134 INTEGER I, TMPEXPIN, TMPEXPINOUT
135 DO i = 1, nel
136 tmpexpin = int(inv(i*2))
137 tmpexpinout = int(inoutv(i*2))
138 CALL cmumps_updatedeter(inv(i*2-1),
139 & inoutv(i*2-1),
140 & tmpexpinout)
141 tmpexpinout = tmpexpinout + tmpexpin
142 inoutv(i*2) = cmplx(tmpexpinout,kind=kind(inoutv))
143 ENDDO
144 RETURN
145 END SUBROUTINE cmumps_deterreduce_func
146 SUBROUTINE cmumps_deter_square(DETER, NEXP)
147 IMPLICIT NONE
148 INTEGER, intent (inout) :: NEXP
149 COMPLEX, intent (inout) :: DETER
150 deter=deter*deter
151 nexp=nexp+nexp
152 RETURN
153 END SUBROUTINE cmumps_deter_square
154 SUBROUTINE cmumps_deter_scaling_inverse(DETER, NEXP)
155 IMPLICIT NONE
156 INTEGER, intent (inout) :: NEXP
157 REAL, intent (inout) :: DETER
158 deter=1.0e0/deter
159 nexp=-nexp
160 RETURN
161 END SUBROUTINE cmumps_deter_scaling_inverse
162 SUBROUTINE cmumps_deter_sign_perm(DETER, N, VISITED, PERM)
163 IMPLICIT NONE
164 COMPLEX, intent(inout) :: DETER
165 INTEGER, intent(in) :: N
166 INTEGER, intent(inout) :: VISITED(N)
167 INTEGER, intent(in) :: PERM(N)
168 INTEGER I, J, K
169 k = 0
170 DO i = 1, n
171 IF (visited(i) .GT. n) THEN
172 visited(i)=visited(i)-n-n-1
173 cycle
174 ENDIF
175 j = perm(i)
176 DO WHILE (j.NE.i)
177 visited(j) = visited(j) + n + n + 1
178 k = k + 1
179 j = perm(j)
180 ENDDO
181 ENDDO
182 IF (mod(k,2).EQ.1) THEN
183 deter = -deter
184 ENDIF
185 RETURN
186 END SUBROUTINE cmumps_deter_sign_perm
188 & BLOCK_SIZE,IPIV,
189 & MYROW, MYCOL, NPROW, NPCOL,
190 & A, LOCAL_M, LOCAL_N, N, MYID,
191 & DKEEP, KEEP, SYM)
194 IMPLICIT NONE
195 INTEGER, intent (in) :: BLOCK_SIZE, NPROW, NPCOL,
196 & local_m, local_n, n, sym
197 INTEGER, intent (in) :: MYROW, MYCOL, MYID, IPIV(LOCAL_M)
198 COMPLEX, intent(in) :: A(*)
199 REAL, INTENT(INOUT) :: DKEEP(230)
200 INTEGER, INTENT(IN) :: KEEP(500)
201 INTEGER I,IMX,DI,NBLOCK,IBLOCK,ILOC,JLOC,
202 & ROW_PROC,COL_PROC, K
203 REAL :: ABSPIVOT
204 di = local_m + 1
205 nblock = ( n - 1 ) / block_size
206 DO iblock = 0, nblock
207 row_proc = mod( iblock, nprow )
208 IF ( myrow.EQ.row_proc ) THEN
209 col_proc = mod( iblock, npcol )
210 IF ( mycol.EQ.col_proc ) THEN
211 iloc = ( iblock / nprow ) * block_size
212 jloc = ( iblock / npcol ) * block_size
213 i = iloc + jloc * local_m + 1
214 imx = min(iloc+block_size,local_m)
215 & + (min(jloc+block_size,local_n)-1)*local_m
216 & + 1
217 k=1
218 DO WHILE ( i .LT. imx )
219 IF (sym.NE.1) THEN
220 abspivot = abs(a(i))
221 ELSE
222 abspivot = abs(a(i)*a(i))
223 ENDIF
225 & ( abspivot,
226 & dkeep, keep, .false.)
227 k = k + 1
228 i = i + di
229 END DO
230 END IF
231 END IF
232 END DO
233 RETURN
234 END SUBROUTINE cmumps_par_root_minmax_piv_upd
float cmplx[2]
Definition pblas.h:136
subroutine cmumps_deter_square(deter, nexp)
subroutine cmumps_par_root_minmax_piv_upd(block_size, ipiv, myrow, mycol, nprow, npcol, a, local_m, local_n, n, myid, dkeep, keep, sym)
subroutine cmumps_deter_reduction(comm, deter_in, nexp_in, deter_out, nexp_out, nprocs)
subroutine cmumps_updatedeter_scaling(piv, deter, nexp)
subroutine cmumps_deter_sign_perm(deter, n, visited, perm)
subroutine cmumps_getdeter2d(block_size, ipiv, myrow, mycol, nprow, npcol, a, local_m, local_n, n, myid, deter, nexp, sym)
subroutine cmumps_deter_scaling_inverse(deter, nexp)
subroutine cmumps_deterreduce_func(inv, inoutv, nel, datatype)
subroutine cmumps_updatedeter(piv, deter, nexp)
#define min(a, b)
Definition macros.h:20
subroutine mpi_type_free(newtyp, ierr_mpi)
Definition mpi.f:399
subroutine mpi_type_contiguous(length, datatype, newtype, ierr_mpi)
Definition mpi.f:406
subroutine mpi_allreduce(sendbuf, recvbuf, cnt, datatype, operation, comm, ierr)
Definition mpi.f:103
subroutine mpi_type_commit(newtyp, ierr_mpi)
Definition mpi.f:393
subroutine mpi_op_create(func, commute, op, ierr)
Definition mpi.f:412
subroutine mpi_op_free(op, ierr)
Definition mpi.f:421
subroutine cmumps_update_minmax_pivot(diag, dkeep, keep, nullpivot)