File tree Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 101101
102102LinearAlgebra. adjoint (v:: AbstractVariable ) = v
103103LinearAlgebra. adjoint (m:: AbstractMonomial ) = m
104- LinearAlgebra. adjoint (t:: T ) where {T <: AbstractTerm } = LinearAlgebra. adjoint (coefficient (t)) * monomial (t)
104+ LinearAlgebra. adjoint (t:: AbstractTerm ) = LinearAlgebra. adjoint (coefficient (t)) * monomial (t)
105105LinearAlgebra. adjoint (p:: AbstractPolynomialLike ) = polynomial (map (LinearAlgebra. adjoint, terms (p)))
106106
107+ LinearAlgebra. transpose (v:: AbstractVariable ) = v
108+ LinearAlgebra. transpose (m:: AbstractMonomial ) = m
109+ LinearAlgebra. transpose (t:: AbstractTerm ) = LinearAlgebra. transpose (coefficient (t)) * monomial (t)
110+ LinearAlgebra. transpose (p:: AbstractPolynomialLike ) = polynomial (map (LinearAlgebra. transpose, terms (p)))
111+
107112LinearAlgebra. dot (p1:: AbstractPolynomialLike , p2:: AbstractPolynomialLike ) = p1' * p2
108113LinearAlgebra. dot (x, p:: AbstractPolynomialLike ) = x' * p
109114LinearAlgebra. dot (p:: AbstractPolynomialLike , x) = p' * x
Original file line number Diff line number Diff line change @@ -46,4 +46,9 @@ const MP = MultivariatePolynomials
4646 @test monic (x^ 2 ) == x^ 2
4747
4848 @test MP. _div (2 x^ 2 * y[1 ]^ 3 , x* y[1 ]^ 2 ) == 2 x* y[1 ]
49+
50+ @test transpose (x) == x
51+ @test adjoint (x) == x
52+ @test transpose (x^ 2 ) == x^ 2
53+ @test adjoint (x^ 2 ) == x^ 2
4954end
Original file line number Diff line number Diff line change @@ -104,6 +104,8 @@ const MP = MultivariatePolynomials
104104 end
105105
106106 @test (x + y)' == x + y
107+ @test transpose (x + y) == x + y
108+ @test transpose ([1 2 ; 3 4 ] * x) == [1 3 ; 2 4 ] * x
107109
108110 @test removemonomials (4 x^ 2 * y + x* y + 2 x, [x* y]) == 4 x^ 2 * y + 2 x
109111
You can’t perform that action at this time.
0 commit comments