Skip to content

Commit

Permalink
Remove special lowering of ' in *, /, and \ expressions to A[c]_(mul|…
Browse files Browse the repository at this point in the history
…ldiv|rdiv)_B[c].
  • Loading branch information
Sacha0 committed Dec 17, 2017
1 parent 0bd2c83 commit a1a0801
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 31 deletions.
31 changes: 1 addition & 30 deletions src/julia-syntax.scm
Original file line number Diff line number Diff line change
Expand Up @@ -1515,22 +1515,6 @@
(kwcall-unless-empty f pa kw-container kw-container)
`(call (call (core kwfunc) ,f) ,kw-container ,f ,@pa)))))

;; convert e.g. A'*B to Ac_mul_B(A,B)
(define (expand-transposed-op e ops)
(let ((a (caddr e))
(b (cadddr e)))
(cond ((ctrans? a)
(if (ctrans? b)
`(call ,(aref ops 0) #;Ac_mul_Bc ,(expand-forms (cadr a))
,(expand-forms (cadr b)))
`(call ,(aref ops 1) #;Ac_mul_B ,(expand-forms (cadr a))
,(expand-forms b))))
((ctrans? b)
`(call ,(aref ops 2) #;A_mul_Bc ,(expand-forms a)
,(expand-forms (cadr b))))
(else
`(call ,(cadr e) ,(expand-forms a) ,(expand-forms b))))))

;; convert `a+=b` to `a=a+b`
(define (expand-update-operator- op op= lhs rhs declT)
(let ((e (remove-argument-side-effects lhs)))
Expand Down Expand Up @@ -2210,19 +2194,6 @@
((and (eq? f '^) (length= e 4) (integer? (cadddr e)))
(expand-forms
`(call (top literal_pow) ^ ,(caddr e) (call (call (core apply_type) (top Val) ,(cadddr e))))))

((and (eq? f '*) (length= e 4))
(expand-transposed-op
e
#(Ac_mul_Bc Ac_mul_B A_mul_Bc)))
((and (eq? f '/) (length= e 4))
(expand-transposed-op
e
#(Ac_rdiv_Bc Ac_rdiv_B A_rdiv_Bc)))
((and (eq? f '\\) (length= e 4))
(expand-transposed-op
e
#(Ac_ldiv_Bc Ac_ldiv_B A_ldiv_Bc)))
(else
(map expand-forms e))))
(map expand-forms e)))
Expand Down Expand Up @@ -2394,7 +2365,7 @@
,.(apply append rows)))
`(call (top typed_vcat) ,t ,@a)))))

'|'| (lambda (e) (expand-forms `(call adjoint ,(cadr e))))
'|'| (lambda (e) (expand-forms `(call postfixapostrophize ,(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 (`/`) "
Expand Down
2 changes: 1 addition & 1 deletion test/linalg/dense.jl
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ end
@testset "/ and \\ consistency with pinv for vectors" begin
@testset "Tests for type $elty" for elty in (Float32, Float64, ComplexF32, ComplexF64)
c = rand(elty, 5)
r = rand(elty, 5)'
r = (elty <: Complex ? Adjoint : Transpose)(rand(elty, 5))
cm = rand(elty, 5, 1)
rm = rand(elty, 1, 5)
@testset "inner prodcuts" begin
Expand Down

0 comments on commit a1a0801

Please sign in to comment.