Skip to content

Commit d83dca9

Browse files
committed
Deprecate A[ct]_(mul|ldiv|rdiv)_B[ct][!] in favor f *, /, \, mul!, ldiv!, and rdiv!.
1 parent ebc2493 commit d83dca9

File tree

6 files changed

+591
-789
lines changed

6 files changed

+591
-789
lines changed

base/deprecated.jl

+553-661
Large diffs are not rendered by default.

base/exports.jl

-28
Original file line numberDiff line numberDiff line change
@@ -220,34 +220,6 @@ export
220220
:,
221221
=>,
222222
,
223-
A_ldiv_B!,
224-
A_ldiv_Bc,
225-
A_ldiv_Bt,
226-
A_mul_B!,
227-
A_mul_Bc,
228-
A_mul_Bc!,
229-
A_mul_Bt,
230-
A_mul_Bt!,
231-
A_rdiv_Bc,
232-
A_rdiv_Bt,
233-
Ac_ldiv_B,
234-
Ac_ldiv_B!,
235-
Ac_ldiv_Bc,
236-
Ac_mul_B,
237-
Ac_mul_B!,
238-
Ac_mul_Bc,
239-
Ac_mul_Bc!,
240-
Ac_rdiv_B,
241-
Ac_rdiv_Bc,
242-
At_ldiv_B,
243-
At_ldiv_B!,
244-
At_ldiv_Bt,
245-
At_mul_B,
246-
At_mul_B!,
247-
At_mul_Bt,
248-
At_mul_Bt!,
249-
At_rdiv_B,
250-
At_rdiv_Bt,
251223

252224
# scalar math
253225
@evalpoly,

base/linalg/linalg.jl

+31-61
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,5 @@
11
# This file is a part of Julia. License is MIT: https://julialang.org/license
22

3-
# shims to maintain existence of names in Base module in A_mul_B deprecation process
4-
function Ac_ldiv_Bt end
5-
function At_ldiv_Bt end
6-
function A_ldiv_Bt end
7-
function At_ldiv_B end
8-
function Ac_ldiv_Bc end
9-
function A_ldiv_Bc end
10-
function Ac_ldiv_B end
11-
function At_rdiv_Bt end
12-
function A_rdiv_Bt end
13-
function At_rdiv_B end
14-
function Ac_rdiv_Bc end
15-
function A_rdiv_Bc end
16-
function Ac_rdiv_B end
17-
function At_mul_Bt end
18-
function A_mul_Bt end
19-
function At_mul_B end
20-
function Ac_mul_Bc end
21-
function A_mul_Bc end
22-
function Ac_mul_B end
23-
243
"""
254
Linear algebra module. Provides array arithmetic,
265
matrix factorizations and other linear algebra related
@@ -29,8 +8,6 @@ functionality.
298
module LinAlg
309

3110
import Base: \, /, *, ^, +, -, ==
32-
import Base: A_mul_Bt, At_ldiv_Bt, A_rdiv_Bc, At_ldiv_B, Ac_mul_Bc, A_mul_Bc, Ac_mul_B,
33-
Ac_ldiv_B, Ac_ldiv_Bc, At_mul_Bt, A_rdiv_Bt, At_mul_B
3411
import Base: USE_BLAS64, abs, acos, acosh, acot, acoth, acsc, acsch, adjoint, asec, asech,
3512
asin, asinh, atan, atanh, axes, big, broadcast, ceil, conj, convert, copy, copyto!, cos,
3613
cosh, cot, coth, csc, csch, eltype, exp, findmax, findmin, fill!, floor, getindex, hcat,
@@ -171,34 +148,6 @@ export
171148
# Operators
172149
\,
173150
/,
174-
A_ldiv_B!,
175-
A_ldiv_Bc,
176-
A_ldiv_Bt,
177-
A_mul_B!,
178-
A_mul_Bc,
179-
A_mul_Bc!,
180-
A_mul_Bt,
181-
A_mul_Bt!,
182-
A_rdiv_Bc,
183-
A_rdiv_Bt,
184-
Ac_ldiv_B,
185-
Ac_ldiv_Bc,
186-
Ac_ldiv_B!,
187-
Ac_mul_B,
188-
Ac_mul_B!,
189-
Ac_mul_Bc,
190-
Ac_mul_Bc!,
191-
Ac_rdiv_B,
192-
Ac_rdiv_Bc,
193-
At_ldiv_B,
194-
At_ldiv_Bt,
195-
At_ldiv_B!,
196-
At_mul_B,
197-
At_mul_B!,
198-
At_mul_Bt,
199-
At_mul_Bt!,
200-
At_rdiv_B,
201-
At_rdiv_Bt,
202151

203152
# Constants
204153
I
@@ -261,16 +210,37 @@ function char_uplo(uplo::Symbol)
261210
end
262211
end
263212

264-
# shims to maintain existence of names in LinAlg module in A_mul_B deprecation process
265-
function A_mul_B! end
266-
function Ac_mul_B! end
267-
function Ac_mul_B! end
268-
function At_mul_B! end
269-
function A_ldiv_B! end
270-
function At_ldiv_B! end
271-
function Ac_ldiv_B! end
272-
function A_rdiv_B! end
273-
function A_rdiv_Bc! end
213+
"""
214+
ldiv!([Y,] A, B) -> Y
215+
216+
Compute `A \\ B` in-place and store the result in `Y`, returning the result.
217+
If only two arguments are passed, then `ldiv!(A, B)` overwrites `B` with
218+
the result.
219+
220+
The argument `A` should *not* be a matrix. Rather, instead of matrices it should be a
221+
factorization object (e.g. produced by [`factorize`](@ref) or [`cholfact`](@ref)).
222+
The reason for this is that factorization itself is both expensive and typically allocates memory
223+
(although it can also be done in-place via, e.g., [`lufact!`](@ref)),
224+
and performance-critical situations requiring `ldiv!` usually also require fine-grained
225+
control over the factorization of `A`.
226+
"""
227+
ldiv!(Y, A, B)
228+
229+
"""
230+
rdiv!([Y,] A, B) -> Y
231+
232+
Compute `A / B` in-place and store the result in `Y`, returning the result.
233+
If only two arguments are passed, then `rdiv!(A, B)` overwrites `A` with
234+
the result.
235+
236+
The argument `B` should *not* be a matrix. Rather, instead of matrices it should be a
237+
factorization object (e.g. produced by [`factorize`](@ref) or [`cholfact`](@ref)).
238+
The reason for this is that factorization itself is both expensive and typically allocates memory
239+
(although it can also be done in-place via, e.g., [`lufact!`](@ref)),
240+
and performance-critical situations requiring `rdiv!` usually also require fine-grained
241+
control over the factorization of `B`.
242+
"""
243+
rdiv!(Y, A, B)
274244

275245
copy_oftype(A::AbstractArray{T}, ::Type{T}) where {T} = copy(A)
276246
copy_oftype(A::AbstractArray{T,N}, ::Type{S}) where {T,N,S} = convert(AbstractArray{S,N}, A)

base/sparse/sparse.jl

+1-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ using Base.Sort: Forward
1010
using Base.LinAlg: AbstractTriangular, PosDefException, fillstored!
1111

1212
import Base: +, -, *, \, /, &, |, xor, ==
13-
import Base: A_mul_B!, Ac_mul_B, Ac_mul_B!, At_mul_B, At_mul_B!
14-
import Base: A_mul_Bc, A_mul_Bt, Ac_mul_Bc, At_mul_Bt
15-
import Base: At_ldiv_B, Ac_ldiv_B, A_ldiv_B!
16-
import Base.LinAlg: At_ldiv_B!, Ac_ldiv_B!, A_rdiv_B!, A_rdiv_Bc!, mul!, ldiv!, rdiv!
13+
import Base.LinAlg: mul!, ldiv!, rdiv!
1714

1815
import Base: @get!, acos, acosd, acot, acotd, acsch, asech, asin, asind, asinh,
1916
atan, atand, atanh, broadcast!, chol, conj!, cos, cosc, cosd, cosh, cospi, cot,

doc/src/manual/linear-algebra.md

+1-7
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,7 @@ julia> sB\x
138138
-1.1086956521739126
139139
-1.4565217391304346
140140
```
141-
The `\` operation here performs the linear solution. Julia's parser provides convenient dispatch
142-
to specialized methods for the *transpose* of a matrix left-divided by a vector, or for the various combinations
143-
of transpose operations in matrix-matrix solutions. Many of these are further specialized for certain special
144-
matrix types. For example, `A\B` will end up calling [`Base.LinAlg.A_ldiv_B!`](@ref) while `A'\B` will end up calling
145-
[`Base.LinAlg.Ac_ldiv_B`](@ref), even though we used the same left-division operator. This works for matrices too: `A.'\B.'`
146-
would call [`Base.LinAlg.At_ldiv_Bt`](@ref). The left-division operator is pretty powerful and it's easy to write compact,
147-
readable code that is flexible enough to solve all sorts of systems of linear equations.
141+
The `\` operation here performs the linear solution. The left-division operator is pretty powerful and it's easy to write compact, readable code that is flexible enough to solve all sorts of systems of linear equations.
148142

149143
## Special matrices
150144

doc/src/stdlib/linalg.md

+5-28
Original file line numberDiff line numberDiff line change
@@ -143,38 +143,15 @@ Base.LinAlg.stride1
143143

144144
## Low-level matrix operations
145145

146-
Matrix operations involving transpositions operations like `A' \ B` are converted by the Julia
147-
parser into calls to specially named functions like [`Ac_ldiv_B`](@ref). If you want to overload these
148-
operations for your own types, then it is useful to know the names of these functions.
149-
150-
Also, in many cases there are in-place versions of matrix operations that allow you to supply
146+
In many cases there are in-place versions of matrix operations that allow you to supply
151147
a pre-allocated output vector or matrix. This is useful when optimizing critical code in order
152148
to avoid the overhead of repeated allocations. These in-place operations are suffixed with `!`
153-
below (e.g. [`A_mul_B!`](@ref)) according to the usual Julia convention.
149+
below (e.g. `mul!`) according to the usual Julia convention.
154150

155151
```@docs
156-
Base.LinAlg.A_ldiv_B!
157-
Base.A_ldiv_Bc
158-
Base.A_ldiv_Bt
159-
Base.LinAlg.A_mul_B!
160-
Base.A_mul_Bc
161-
Base.A_mul_Bt
162-
Base.A_rdiv_Bc
163-
Base.A_rdiv_Bt
164-
Base.Ac_ldiv_B
165-
Base.LinAlg.Ac_ldiv_B!
166-
Base.Ac_ldiv_Bc
167-
Base.Ac_mul_B
168-
Base.Ac_mul_Bc
169-
Base.Ac_rdiv_B
170-
Base.Ac_rdiv_Bc
171-
Base.At_ldiv_B
172-
Base.LinAlg.At_ldiv_B!
173-
Base.At_ldiv_Bt
174-
Base.At_mul_B
175-
Base.At_mul_Bt
176-
Base.At_rdiv_B
177-
Base.At_rdiv_Bt
152+
Base.LinAlg.mul!
153+
Base.LinAlg.ldiv!
154+
Base.LinAlg.rdiv!
178155
```
179156

180157
## BLAS Functions

0 commit comments

Comments
 (0)