@@ -254,24 +254,35 @@ Ac_mul_B!(α::Number, A::DMatrix, B::AbstractMatrix, β::Number, C::DMatrix) = _
254
254
At_mul_B! (α:: Number , A:: DMatrix , B:: AbstractMatrix , β:: Number , C:: DMatrix ) = _matmatmul! (α, A, B, β, C, ' T' )
255
255
At_mul_B! (C:: DMatrix , A:: DMatrix , B:: AbstractMatrix ) = At_mul_B! (one (eltype (C)), A, B, zero (eltype (C)), C)
256
256
257
+ _matmul_op = (t,s) -> t* s + t* s
258
+
257
259
function (* )(A:: DMatrix , x:: AbstractVector )
258
- T = promote_type ( Base. LinAlg . arithtype ( eltype (A)), Base . LinAlg . arithtype ( eltype (x) ))
260
+ T = Base. promote_op (_matmul_op, eltype (A), eltype (x))
259
261
y = DArray (I -> Array (T, map (length, I)), (size (A, 1 ),), procs (A)[:,1 ], (size (procs (A), 1 ),))
260
262
return A_mul_B! (one (T), A, x, zero (T), y)
261
263
end
262
264
function (* )(A:: DMatrix , B:: AbstractMatrix )
263
- T = promote_type (Base. LinAlg. arithtype (eltype (A)), Base. LinAlg. arithtype (eltype (B)))
264
- C = DArray (I -> Array (T, map (length, I)), (size (A, 1 ), size (B, 2 )), procs (A)[:,1 : min (size (procs (A), 2 ), size (procs (B), 2 ))], (size (procs (A), 1 ), min (size (procs (A), 2 ), size (procs (B), 2 ))))
265
+ T = Base. promote_op (_matmul_op, eltype (A), eltype (B))
266
+ C = DArray (I -> Array (T, map (length, I)),
267
+ (size (A, 1 ), size (B, 2 )),
268
+ procs (A)[:,1 : min (size (procs (A), 2 ), size (procs (B), 2 ))],
269
+ (size (procs (A), 1 ), min (size (procs (A), 2 ), size (procs (B), 2 ))))
265
270
return A_mul_B! (one (T), A, B, zero (T), C)
266
271
end
267
272
268
273
function Ac_mul_B (A:: DMatrix , x:: AbstractVector )
269
- T = promote_type (Base. LinAlg. arithtype (eltype (A)), Base. LinAlg. arithtype (eltype (x)))
270
- y = DArray (I -> Array (T, map (length, I)), (size (A, 2 ),), procs (A)[1 ,:], (size (procs (A), 2 ),))
274
+ T = Base. promote_op (_matmul_op, eltype (A), eltype (x))
275
+ y = DArray (I -> Array (T, map (length, I)),
276
+ (size (A, 2 ),),
277
+ procs (A)[1 ,:],
278
+ (size (procs (A), 2 ),))
271
279
return Ac_mul_B! (one (T), A, x, zero (T), y)
272
280
end
273
281
function Ac_mul_B (A:: DMatrix , B:: AbstractMatrix )
274
- T = promote_type (Base. LinAlg. arithtype (eltype (A)), Base. LinAlg. arithtype (eltype (B)))
275
- C = DArray (I -> Array (T, map (length, I)), (size (A, 2 ), size (B, 2 )), procs (A)[1 : min (size (procs (A), 1 ), size (procs (B), 2 )),:], (size (procs (A), 2 ), min (size (procs (A), 1 ), size (procs (B), 2 ))))
282
+ T = Base. promote_op (_matmul_op, eltype (A), eltype (B))
283
+ C = DArray (I -> Array (T, map (length, I)), (size (A, 2 ),
284
+ size (B, 2 )),
285
+ procs (A)[1 : min (size (procs (A), 1 ), size (procs (B), 2 )),:],
286
+ (size (procs (A), 2 ), min (size (procs (A), 1 ), size (procs (B), 2 ))))
276
287
return Ac_mul_B! (one (T), A, B, zero (T), C)
277
288
end
0 commit comments