Skip to content

Commit f7f7234

Browse files
committed
Deprecate .'.
1 parent d94999f commit f7f7234

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

src/julia-syntax.scm

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2395,7 +2395,38 @@
23952395
`(call (top typed_vcat) ,t ,@a)))))
23962396

23972397
'|'| (lambda (e) (expand-forms `(call adjoint ,(cadr e))))
2398-
'|.'| (lambda (e) (expand-forms `(call transpose ,(cadr e))))
2398+
'|.'| (lambda (e) (begin (deprecation-message (string "The syntax `.'` for transposition is deprecated, "
2399+
"and the special lowering of `.'` in multiplication "
2400+
"(`*`), left-division (`\\`), and right-division (`/`) "
2401+
"operations, for example `A.'*B` lowering to `At_mul_B(A, B)`, "
2402+
"`A\\B.'` lowering to `A_ldiv_Bt(A, B)`, and `A.'/B.'` "
2403+
"lowering to `At_rdiv_Bt(A, B)`, has been removed "
2404+
"in favor of a lazy `Transpose` wrapper type and "
2405+
"dispatch on that type. Two rewrites for `A.'` for "
2406+
"matrix `A` exist: eager or materializing `transpose(A)`, "
2407+
"which constructs a freshly allocated matrix of `A`'s type "
2408+
"and containing the transpose of `A`, and lazy "
2409+
"`Transpose(A)`, which wraps `A` in a `Transpose` "
2410+
"view type. Which rewrite is appropriate depends on "
2411+
"context: If `A.'` appears in a multiplication, "
2412+
"left-division, or right-division operation that "
2413+
"was formerly specially lowered to an `A_mul_B`-like "
2414+
"call, then the lazy `Tranpose(A)` is the correct "
2415+
"replacement and will result in dispatch to a method "
2416+
"equivalent to the former `A_mul_B`-like call. For "
2417+
"example, `A.'*B`, formerly yielding `At_mul_B(A, B)`, "
2418+
"should be rewritten `Transpose(A)*B`, which will "
2419+
"dispatch to a method equivalent to the former "
2420+
"`At_mul_B(A, B)` method. If `A.'` appears outside "
2421+
"such an operation, then `transpose(A)` is the "
2422+
"correct rewrite. For vector `A`, `A.'` already "
2423+
"transposed lazily to a `RowVector`, so `Transpose(A)`. "
2424+
"which now yields a `Transpose`-wrapped vector "
2425+
"behaviorally equivalent to the former `RowVector` "
2426+
"is always the correct rewrite for vectors. For "
2427+
"more information, see issue #5332 on Julia's "
2428+
"issue tracker on GitHub." #\newline))
2429+
(return (expand-forms `(call transpose ,(cadr e))))))
23992430

24002431
'generator
24012432
(lambda (e)

0 commit comments

Comments
 (0)