Skip to content

Taking transpose deprecation messages seriously #25491

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 23, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 6 additions & 34 deletions src/julia-syntax.scm
Original file line number Diff line number Diff line change
Expand Up @@ -2343,40 +2343,12 @@
`(call (top typed_vcat) ,t ,@a)))))

'|'| (lambda (e) (expand-forms `(call (top adjoint) ,(cadr e))))
'|.'| (lambda (e) (begin (deprecation-message (string "The syntax `.'` for transposition is deprecated, "
"and the special lowering of `.'` in multiplication "
"(`*`), left-division (`\\`), and right-division (`/`) "
"operations, for example `A.'*B` lowering to `At_mul_B(A, B)`, "
"`A\\B.'` lowering to `A_ldiv_Bt(A, B)`, and `A.'/B.'` "
"lowering to `At_rdiv_Bt(A, B)`, has been removed "
"in favor of lazy transposition via `transpose`, "
"a corresponding lazy `Transpose` wrapper type, and "
"dispatch on that type. Two rewrites for `A.'` for "
"matrix `A` exist: "
"`transpose(A)`, which yields a lazily transposed "
"version of `A` (often by wrapping in the `Transpose` type), "
"and `copy(transpose(A))` which lazily transposes "
"`A` as above and then materializes that lazily "
"transposed `A` into a freshly allocated matrix "
"of `A`'s type. Which rewrite is appropriate depends on "
"context: If `A.'` appears in a multiplication, "
"left-division, or right-division operation that "
"was formerly specially lowered to an `A_mul_B`-like "
"call, then the lazy `transpose(A)` is the correct "
"replacement and will result in dispatch to a method "
"equivalent to the former `A_mul_B`-like call. For "
"example, `A.'*B`, formerly yielding `At_mul_B(A, B)`, "
"should be rewritten `transpose(A)*B`, which will "
"dispatch to a method equivalent to the former "
"`At_mul_B(A, B)` method. If `A.'` appears outside "
"such an operation, then `copy(transpose(A))` is the "
"functionally equivalent rewrite. For vector `A`, `A.'` already "
"transposed lazily to a `RowVector`, so `transpose(A)`, "
"which now yields a `Transpose`-wrapped vector "
"behaviorally equivalent to the former `RowVector`, "
"is always the correct rewrite for vectors. For "
"more information, see issue #5332 on Julia's "
"issue tracker on GitHub." #\newline) #f)
'|.'| (lambda (e) (begin (deprecation-message (string "The postfix .' syntax is deprecated. "
"For vector v in v.', use transpose(v) "
"instead. For matrix A in A.', use "
"copy(transpose(A)) instead, unless A.' "
"appears as an argument of *, / or \\. In "
"those cases, use transpose(A) instead. " #\newline) #f)
(return (expand-forms `(call transpose ,(cadr e))))))

'generator
Expand Down