@@ -107,48 +107,48 @@ end
107107
108108# # copy upper triangle to lower and vice versa
109109
110- function LinearAlgebra. copytri! (A:: AbstractGPUMatrix , uplo:: AbstractChar , conjugate:: Bool = false )
111- n = LinearAlgebra. checksquare (A)
112- if uplo == ' U' && conjugate
113- @kernel function U_conj! (_A)
114- I = @index (Global, Cartesian)
115- i, j = Tuple (I)
116- if j > i
117- @inbounds _A[j,i] = conj (_A[i,j])
110+ function LinearAlgebra. copytri! (A:: AbstractGPUMatrix , uplo:: AbstractChar , conjugate:: Bool = false , diag:: Bool = false )
111+ n = LinearAlgebra. checksquare (A)
112+ if uplo == ' U' && conjugate
113+ @kernel function U_conj! (_A)
114+ I = @index (Global, Cartesian)
115+ i, j = Tuple (I)
116+ if j + diag > i
117+ @inbounds _A[j,i] = conj (_A[i,j])
118+ end
118119 end
119- end
120- U_conj! ( get_backend (A))(A; ndrange = size (A))
121- elseif uplo == ' U ' && ! conjugate
122- @kernel function U_noconj! (_A )
123- I = @index (Global, Cartesian )
124- i, j = Tuple (I)
125- if j > i
126- @inbounds _A[j,i] = _A[i,j]
120+ U_conj! ( get_backend (A))(A; ndrange = size (A))
121+ elseif uplo == ' U ' && ! conjugate
122+ @kernel function U_noconj! (_A)
123+ I = @index (Global, Cartesian )
124+ i, j = Tuple (I )
125+ if j + diag > i
126+ @inbounds _A[j,i] = _A[i,j]
127+ end
127128 end
128- end
129- U_noconj! ( get_backend (A))(A; ndrange = size (A))
130- elseif uplo == ' L ' && conjugate
131- @kernel function L_conj! (_A )
132- I = @index (Global, Cartesian )
133- i, j = Tuple (I)
134- if j > i
135- @inbounds _A[i,j] = conj (_A[j,i])
129+ U_noconj! ( get_backend (A))(A; ndrange = size (A))
130+ elseif uplo == ' L ' && conjugate
131+ @kernel function L_conj! (_A)
132+ I = @index (Global, Cartesian )
133+ i, j = Tuple (I )
134+ if j + diag > i
135+ @inbounds _A[i,j] = conj (_A[j,i])
136+ end
136137 end
137- end
138- L_conj! ( get_backend (A))(A; ndrange = size (A))
139- elseif uplo == ' L ' && ! conjugate
140- @kernel function L_noconj! (_A )
141- I = @index (Global, Cartesian )
142- i, j = Tuple (I)
143- if j > i
144- @inbounds _A[i,j] = _A[j,i]
138+ L_conj! ( get_backend (A))(A; ndrange = size (A))
139+ elseif uplo == ' L ' && ! conjugate
140+ @kernel function L_noconj! (_A)
141+ I = @index (Global, Cartesian )
142+ i, j = Tuple (I )
143+ if j + diag > i
144+ @inbounds _A[i,j] = _A[j,i]
145+ end
145146 end
146- end
147- L_noconj! (get_backend (A))(A; ndrange = size (A))
148- else
149- throw (ArgumentError (" uplo argument must be 'U' (upper) or 'L' (lower), got $uplo " ))
150- end
151- A
147+ L_noconj! (get_backend (A))(A; ndrange = size (A))
148+ else
149+ throw (ArgumentError (" uplo argument must be 'U' (upper) or 'L' (lower), got $uplo " ))
150+ end
151+ A
152152end
153153
154154# # copy a triangular part of a matrix to another matrix
0 commit comments