From 537fbad0e37a6e5efe18dd0a2c1cb0c0a2425c25 Mon Sep 17 00:00:00 2001 From: Seth Axen Date: Tue, 30 Jun 2020 08:00:40 -0700 Subject: [PATCH 01/12] Add missing complex tests and rules (#216) * Fix indentation * Test \ on complex inputs * Test ^ on complex inputs * Test identity on complex inputs * Test muladd on complex inputs * Test binary functions on complex inputs * Test functions on complex inputs * Release type constraint on exp * Add _realconjtimes * Use _realconjtimes in abs/abs2 rules * Add complex rule for hypot * Add generic rule for adjoint * Add generic rule for real * Add generic rule for imag * Add complex rule for hypot * Add rules/tests for Complex * Test frule for identity * Add missing angle test * Make inline just in case * Unify abs rules * Introduce _imagconjtimes utility function * Unify angle rules * Unify sign rules * Multiply by correct variable * Fix argument order * Bump ChainRulesTestUtils version number * Restrict to Complex * Use muladd * Update src/rulesets/Base/fastmath_able.jl Co-authored-by: willtebbutt Co-authored-by: willtebbutt --- src/utils.jl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/utils.jl diff --git a/src/utils.jl b/src/utils.jl new file mode 100644 index 000000000..d957d555f --- /dev/null +++ b/src/utils.jl @@ -0,0 +1,15 @@ +# real(conj(x) * y) avoiding computing the imaginary part if possible +@inline _realconjtimes(x, y) = real(conj(x) * y) +@inline _realconjtimes(x::Complex, y::Complex) = muladd(real(x), real(y), imag(x) * imag(y)) +@inline _realconjtimes(x::Real, y::Complex) = x * real(y) +@inline _realconjtimes(x::Complex, y::Real) = real(x) * y +@inline _realconjtimes(x::Real, y::Real) = x * y + +# imag(conj(x) * y) avoiding computing the real part if possible +@inline _imagconjtimes(x, y) = imag(conj(x) * y) +@inline function _imagconjtimes(x::Complex, y::Complex) + return muladd(-imag(x), real(y), real(x) * imag(y)) +end +@inline _imagconjtimes(x::Real, y::Complex) = x * imag(y) +@inline _imagconjtimes(x::Complex, y::Real) = -imag(x) * y +@inline _imagconjtimes(x::Real, y::Real) = Zero() From 4b08ee2f1de30c28aa84ab9da08bf0d625ba5438 Mon Sep 17 00:00:00 2001 From: Miha Zgubic Date: Thu, 27 May 2021 19:32:33 +0100 Subject: [PATCH 02/12] rename differentials (#413) * rename DoesNotExist * rename Composite * bump version and compat * rename Zero * remove typos * reexport deprecated types manually --- src/utils.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils.jl b/src/utils.jl index d957d555f..30bbdd47e 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -12,4 +12,4 @@ end @inline _imagconjtimes(x::Real, y::Complex) = x * imag(y) @inline _imagconjtimes(x::Complex, y::Real) = -imag(x) * y -@inline _imagconjtimes(x::Real, y::Real) = Zero() +@inline _imagconjtimes(x::Real, y::Real) = ZeroTangent() From 0d2269e37e599d024ae9b4e598e740fd732f1c18 Mon Sep 17 00:00:00 2001 From: David Widmann Date: Fri, 1 Oct 2021 16:54:01 +0200 Subject: [PATCH 03/12] Rename to `realconjtimes` and `imagconjtimes` and export them --- src/ChainRulesCore.jl | 3 +++ src/utils.jl | 44 ++++++++++++++++++++++++++++++------------- 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/src/ChainRulesCore.jl b/src/ChainRulesCore.jl index dbc0f057a..8971beab5 100644 --- a/src/ChainRulesCore.jl +++ b/src/ChainRulesCore.jl @@ -16,6 +16,8 @@ export add!! # gradient accumulation operations export ignore_derivatives, @ignore_derivatives # differentials export Tangent, NoTangent, InplaceableThunk, Thunk, ZeroTangent, AbstractZero, AbstractThunk +# helpers for rules with complex numbers +export realconjtimes, imagconjtimes include("compat.jl") include("debug_mode.jl") @@ -34,6 +36,7 @@ include("config.jl") include("rules.jl") include("rule_definition_tools.jl") include("ignore_derivatives.jl") +include("utils.jl") include("deprecated.jl") diff --git a/src/utils.jl b/src/utils.jl index 30bbdd47e..06d6a4ac3 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -1,15 +1,33 @@ -# real(conj(x) * y) avoiding computing the imaginary part if possible -@inline _realconjtimes(x, y) = real(conj(x) * y) -@inline _realconjtimes(x::Complex, y::Complex) = muladd(real(x), real(y), imag(x) * imag(y)) -@inline _realconjtimes(x::Real, y::Complex) = x * real(y) -@inline _realconjtimes(x::Complex, y::Real) = real(x) * y -@inline _realconjtimes(x::Real, y::Real) = x * y - -# imag(conj(x) * y) avoiding computing the real part if possible -@inline _imagconjtimes(x, y) = imag(conj(x) * y) -@inline function _imagconjtimes(x::Complex, y::Complex) +""" + realconjtimes(x, y) + +Compute `real(conj(x) * y)` while avoiding computing the imaginary part if possible. + +This function can be useful if you implement a `rrule` for a non-holomorphic function +on complex numbers. + +See also: [`imagconjtimes`](@ref) +""" +@inline realconjtimes(x, y) = real(conj(x) * y) +@inline realconjtimes(x::Complex, y::Complex) = muladd(real(x), real(y), imag(x) * imag(y)) +@inline realconjtimes(x::Real, y::Complex) = x * real(y) +@inline realconjtimes(x::Complex, y::Real) = real(x) * y +@inline realconjtimes(x::Real, y::Real) = x * y + +""" + imagconjtimes(x, y) + +Compute `imag(conj(x) * y)` while avoiding computing the real part if possible. + +This function can be useful if you implement a `rrule` for a non-holomorphic function +on complex numbers. + +See also: [`realconjtimes`](@ref) +""" +@inline imagconjtimes(x, y) = imag(conj(x) * y) +@inline function imagconjtimes(x::Complex, y::Complex) return muladd(-imag(x), real(y), real(x) * imag(y)) end -@inline _imagconjtimes(x::Real, y::Complex) = x * imag(y) -@inline _imagconjtimes(x::Complex, y::Real) = -imag(x) * y -@inline _imagconjtimes(x::Real, y::Real) = ZeroTangent() +@inline imagconjtimes(x::Real, y::Complex) = x * imag(y) +@inline imagconjtimes(x::Complex, y::Real) = -imag(x) * y +@inline imagconjtimes(x::Real, y::Real) = ZeroTangent() From b1a89ec752783dcf2294abb240c79b9564ca91de Mon Sep 17 00:00:00 2001 From: David Widmann Date: Fri, 1 Oct 2021 16:54:36 +0200 Subject: [PATCH 04/12] Add tests --- test/runtests.jl | 1 + test/utils.jl | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 test/utils.jl diff --git a/test/runtests.jl b/test/runtests.jl index 6a4684d03..87cd1e609 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -22,6 +22,7 @@ using Test include("rule_definition_tools.jl") include("config.jl") include("ignore_derivatives.jl") + include("utils.jl") include("deprecated.jl") end diff --git a/test/utils.jl b/test/utils.jl new file mode 100644 index 000000000..a3e4f9e73 --- /dev/null +++ b/test/utils.jl @@ -0,0 +1,31 @@ +@testset "utils.jl" begin + @testset "conjtimes" begin + # custom complex number to test fallback definition + struct CustomComplex{T} + re::T + im::T + end + + Base.real(x::CustomComplex) = x.re + Base.imag(x::CustomComplex) = x.im + + Base.conj(x::CustomComplex) = CustomComplex(x.re, -x.im) + + Base.:*(a::CustomComplex, b::Number) = CustomComplex(reim((a.re + a.im * im) * b)...) + Base.:*(a::Number, b::CustomComplex) = b * a + function Base.:*(a::CustomComplex, b::CustomComplex) + return CustomComplex(reim((a.re + a.im * im) * (b.re + b.im * im))...) + end + + inputs = (randn(), randn(ComplexF64), CustomComplex(reim(randn(ComplexF64))...)) + for x in inputs, y in inputs + @test realconjtimes(x, y) == real(conj(x) * y) + + if x isa Real && y isa Real + @test imagconjtimes(x, y) === ZeroTangent() + else + @test imagconjtimes(x, y) == imag(conj(x) * y) + end + end + end +end From 3d0520638f0426ed7708edb67ba66dfaef49e2ef Mon Sep 17 00:00:00 2001 From: David Widmann Date: Fri, 1 Oct 2021 16:54:48 +0200 Subject: [PATCH 05/12] Add documentation --- docs/src/api.md | 5 ++++- docs/src/complex.md | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/src/api.md b/docs/src/api.md index 9b998c0af..e883c7c61 100644 --- a/docs/src/api.md +++ b/docs/src/api.md @@ -10,7 +10,10 @@ Private = false ## Rule Definition Tools ```@autodocs Modules = [ChainRulesCore] -Pages = ["rule_definition_tools.jl"] +Pages = [ + "rule_definition_tools.jl", + "utils.jl", +] Private = false ``` diff --git a/docs/src/complex.md b/docs/src/complex.md index c92d22712..9797fd772 100644 --- a/docs/src/complex.md +++ b/docs/src/complex.md @@ -87,3 +87,6 @@ end There are various notions of complex derivatives (holomorphic and Wirtinger derivatives, Jacobians, gradients, etc.) which differ in subtle but important ways. The goal of ChainRules is to provide the basic differentiation rules upon which these derivatives can be implemented, but it does not implement these derivatives itself. It is recommended that you carefully check how the above definitions of `frule` and `rrule` translate into your specific notion of complex derivative, since getting this wrong will quietly give you wrong results. + +!!! note + If you implement `rrule` for a non-holomorphic function, [`realconjtimes`](@ref) and [`imagconjtimes`](@ref) can be useful. From d6c6c2a2ad52346e0260415427cffa28f32c04d9 Mon Sep 17 00:00:00 2001 From: David Widmann Date: Fri, 1 Oct 2021 16:55:14 +0200 Subject: [PATCH 06/12] Bump version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 37fd40f98..a3b2c3d26 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "ChainRulesCore" uuid = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" -version = "1.7.0" +version = "1.8.0" [deps] Compat = "34da2185-b29b-5c13-b0c7-acf172513d20" From d9d046faeaec71e9922e31d8a3fa9dc7d5cbe510 Mon Sep 17 00:00:00 2001 From: David Widmann Date: Fri, 1 Oct 2021 17:12:26 +0200 Subject: [PATCH 07/12] Fix tests with Julia 1.0 --- test/utils.jl | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/test/utils.jl b/test/utils.jl index a3e4f9e73..55a5dbb61 100644 --- a/test/utils.jl +++ b/test/utils.jl @@ -1,22 +1,23 @@ -@testset "utils.jl" begin - @testset "conjtimes" begin - # custom complex number to test fallback definition - struct CustomComplex{T} - re::T - im::T - end +# struct need to be defined outside of tests for julia 1.0 compat +# custom complex number to test fallback definition +struct CustomComplex{T} + re::T + im::T +end - Base.real(x::CustomComplex) = x.re - Base.imag(x::CustomComplex) = x.im +Base.real(x::CustomComplex) = x.re +Base.imag(x::CustomComplex) = x.im - Base.conj(x::CustomComplex) = CustomComplex(x.re, -x.im) +Base.conj(x::CustomComplex) = CustomComplex(x.re, -x.im) - Base.:*(a::CustomComplex, b::Number) = CustomComplex(reim((a.re + a.im * im) * b)...) - Base.:*(a::Number, b::CustomComplex) = b * a - function Base.:*(a::CustomComplex, b::CustomComplex) - return CustomComplex(reim((a.re + a.im * im) * (b.re + b.im * im))...) - end +Base.:*(a::CustomComplex, b::Number) = CustomComplex(reim((a.re + a.im * im) * b)...) +Base.:*(a::Number, b::CustomComplex) = b * a +function Base.:*(a::CustomComplex, b::CustomComplex) + return CustomComplex(reim((a.re + a.im * im) * (b.re + b.im * im))...) +end +@testset "utils.jl" begin + @testset "conjtimes" begin inputs = (randn(), randn(ComplexF64), CustomComplex(reim(randn(ComplexF64))...)) for x in inputs, y in inputs @test realconjtimes(x, y) == real(conj(x) * y) From 1747c42e2074c64b7e2b63a4a37bef46f7ac07f8 Mon Sep 17 00:00:00 2001 From: David Widmann Date: Fri, 1 Oct 2021 23:23:41 +0200 Subject: [PATCH 08/12] Rename to `realdot` and `imagdot` --- docs/src/complex.md | 2 +- src/ChainRulesCore.jl | 2 +- src/utils.jl | 33 +++++++++++++++++---------------- test/utils.jl | 33 +++++++++++++++++++-------------- 4 files changed, 38 insertions(+), 32 deletions(-) diff --git a/docs/src/complex.md b/docs/src/complex.md index 9797fd772..132d36996 100644 --- a/docs/src/complex.md +++ b/docs/src/complex.md @@ -89,4 +89,4 @@ end It is recommended that you carefully check how the above definitions of `frule` and `rrule` translate into your specific notion of complex derivative, since getting this wrong will quietly give you wrong results. !!! note - If you implement `rrule` for a non-holomorphic function, [`realconjtimes`](@ref) and [`imagconjtimes`](@ref) can be useful. + If you implement `rrule` for a non-holomorphic function, [`realdot`](@ref) and [`imagdot`](@ref) can be useful. diff --git a/src/ChainRulesCore.jl b/src/ChainRulesCore.jl index 8971beab5..48d1822bd 100644 --- a/src/ChainRulesCore.jl +++ b/src/ChainRulesCore.jl @@ -17,7 +17,7 @@ export ignore_derivatives, @ignore_derivatives # differentials export Tangent, NoTangent, InplaceableThunk, Thunk, ZeroTangent, AbstractZero, AbstractThunk # helpers for rules with complex numbers -export realconjtimes, imagconjtimes +export realdot, imagdot include("compat.jl") include("debug_mode.jl") diff --git a/src/utils.jl b/src/utils.jl index 06d6a4ac3..d97eaaf86 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -1,33 +1,34 @@ """ - realconjtimes(x, y) + realdot(x, y) -Compute `real(conj(x) * y)` while avoiding computing the imaginary part if possible. +Compute `real(dot(x, y))` while avoiding computing the imaginary part if possible. This function can be useful if you implement a `rrule` for a non-holomorphic function on complex numbers. -See also: [`imagconjtimes`](@ref) +See also: [`imagdot`](@ref) """ -@inline realconjtimes(x, y) = real(conj(x) * y) -@inline realconjtimes(x::Complex, y::Complex) = muladd(real(x), real(y), imag(x) * imag(y)) -@inline realconjtimes(x::Real, y::Complex) = x * real(y) -@inline realconjtimes(x::Complex, y::Real) = real(x) * y -@inline realconjtimes(x::Real, y::Real) = x * y +@inline realdot(x, y) = real(dot(x, y)) +@inline realdot(x::Complex, y::Complex) = muladd(real(x), real(y), imag(x) * imag(y)) +@inline realdot(x::Real, y::Complex) = x * real(y) +@inline realdot(x::Complex, y::Real) = real(x) * y +@inline realdot(x::Real, y::Real) = x * y """ - imagconjtimes(x, y) + imagdot(x, y) -Compute `imag(conj(x) * y)` while avoiding computing the real part if possible. +Compute `imag(dot(x, y))` while avoiding computing the real part if possible. This function can be useful if you implement a `rrule` for a non-holomorphic function on complex numbers. -See also: [`realconjtimes`](@ref) +See also: [`realdot`](@ref) """ -@inline imagconjtimes(x, y) = imag(conj(x) * y) -@inline function imagconjtimes(x::Complex, y::Complex) +@inline imagdot(x, y) = imag(dot(x, y)) +@inline function imagdot(x::Complex, y::Complex) return muladd(-imag(x), real(y), real(x) * imag(y)) end -@inline imagconjtimes(x::Real, y::Complex) = x * imag(y) -@inline imagconjtimes(x::Complex, y::Real) = -imag(x) * y -@inline imagconjtimes(x::Real, y::Real) = ZeroTangent() +@inline imagdot(x::Real, y::Complex) = x * imag(y) +@inline imagdot(x::Complex, y::Real) = -imag(x) * y +@inline imagdot(x::Real, y::Real) = ZeroTangent() +@inline imagdot(x::AbstractArray{<:Real}, y::AbstractArray{<:Real}) = ZeroTangent() diff --git a/test/utils.jl b/test/utils.jl index 55a5dbb61..0cd1535ff 100644 --- a/test/utils.jl +++ b/test/utils.jl @@ -8,24 +8,29 @@ end Base.real(x::CustomComplex) = x.re Base.imag(x::CustomComplex) = x.im -Base.conj(x::CustomComplex) = CustomComplex(x.re, -x.im) - -Base.:*(a::CustomComplex, b::Number) = CustomComplex(reim((a.re + a.im * im) * b)...) -Base.:*(a::Number, b::CustomComplex) = b * a -function Base.:*(a::CustomComplex, b::CustomComplex) - return CustomComplex(reim((a.re + a.im * im) * (b.re + b.im * im))...) +function LinearAlgebra.dot(a::CustomComplex, b::Number) + return CustomComplex(reim((a.re - a.im * im) * b)...) +end +function LinearAlgebra.dot(a::Number, b::CustomComplex) + return CustomComplex(reim(conj(a) * (b.re + b.im * im))...) +end +function LinearAlgebra.dot(a::CustomComplex, b::CustomComplex) + return CustomComplex(reim((a.re - a.im * im) * (b.re + b.im * im))...) end @testset "utils.jl" begin - @testset "conjtimes" begin - inputs = (randn(), randn(ComplexF64), CustomComplex(reim(randn(ComplexF64))...)) - for x in inputs, y in inputs - @test realconjtimes(x, y) == real(conj(x) * y) + @testset "dot" begin + scalars = (randn(), randn(ComplexF64), CustomComplex(reim(randn(ComplexF64))...)) + arrays = (randn(10), randn(ComplexF64, 10)) + for inputs in (scalars, arrays) + for x in inputs, y in inputs + @test realdot(x, y) == real(dot(x, y)) - if x isa Real && y isa Real - @test imagconjtimes(x, y) === ZeroTangent() - else - @test imagconjtimes(x, y) == imag(conj(x) * y) + if eltype(x) <: Real && eltype(y) <: Real + @test imagdot(x, y) === ZeroTangent() + else + @test imagdot(x, y) == imag(dot(x, y)) + end end end end From ff5e71e98fc34fab03c8e487c19eb72a64286d29 Mon Sep 17 00:00:00 2001 From: David Widmann Date: Sat, 2 Oct 2021 01:08:16 +0200 Subject: [PATCH 09/12] Add dispatch for real arrays --- src/utils.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/utils.jl b/src/utils.jl index d97eaaf86..601e9d2d4 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -13,6 +13,7 @@ See also: [`imagdot`](@ref) @inline realdot(x::Real, y::Complex) = x * real(y) @inline realdot(x::Complex, y::Real) = real(x) * y @inline realdot(x::Real, y::Real) = x * y +@inline realdot(x::AbstractArray{<:Real}, y::AbstractArray{<:Real}) = dot(x, y) """ imagdot(x, y) From 5155c750772596bf0ea3f957e5fdd37041da811c Mon Sep 17 00:00:00 2001 From: David Widmann Date: Mon, 11 Oct 2021 20:52:52 +0200 Subject: [PATCH 10/12] Update src/utils.jl Co-authored-by: Seth Axen --- src/utils.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/src/utils.jl b/src/utils.jl index 601e9d2d4..d97eaaf86 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -13,7 +13,6 @@ See also: [`imagdot`](@ref) @inline realdot(x::Real, y::Complex) = x * real(y) @inline realdot(x::Complex, y::Real) = real(x) * y @inline realdot(x::Real, y::Real) = x * y -@inline realdot(x::AbstractArray{<:Real}, y::AbstractArray{<:Real}) = dot(x, y) """ imagdot(x, y) From 5fb7ff22853b3b24d5e786432730561e73283159 Mon Sep 17 00:00:00 2001 From: David Widmann Date: Mon, 11 Oct 2021 22:40:06 +0200 Subject: [PATCH 11/12] Generalize `::Complex` to `::Number` --- src/utils.jl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/utils.jl b/src/utils.jl index d97eaaf86..0399120b1 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -9,9 +9,9 @@ on complex numbers. See also: [`imagdot`](@ref) """ @inline realdot(x, y) = real(dot(x, y)) -@inline realdot(x::Complex, y::Complex) = muladd(real(x), real(y), imag(x) * imag(y)) -@inline realdot(x::Real, y::Complex) = x * real(y) -@inline realdot(x::Complex, y::Real) = real(x) * y +@inline realdot(x::Number, y::Number) = muladd(real(x), real(y), imag(x) * imag(y)) +@inline realdot(x::Real, y::Number) = x * real(y) +@inline realdot(x::Number, y::Real) = real(x) * y @inline realdot(x::Real, y::Real) = x * y """ @@ -25,10 +25,10 @@ on complex numbers. See also: [`realdot`](@ref) """ @inline imagdot(x, y) = imag(dot(x, y)) -@inline function imagdot(x::Complex, y::Complex) +@inline function imagdot(x::Number, y::Number) return muladd(-imag(x), real(y), real(x) * imag(y)) end -@inline imagdot(x::Real, y::Complex) = x * imag(y) -@inline imagdot(x::Complex, y::Real) = -imag(x) * y +@inline imagdot(x::Real, y::Number) = x * imag(y) +@inline imagdot(x::Number, y::Real) = -imag(x) * y @inline imagdot(x::Real, y::Real) = ZeroTangent() @inline imagdot(x::AbstractArray{<:Real}, y::AbstractArray{<:Real}) = ZeroTangent() From a042dd0926d2037f8839d3146a94ed1d12fd2fde Mon Sep 17 00:00:00 2001 From: David Widmann Date: Mon, 11 Oct 2021 22:41:56 +0200 Subject: [PATCH 12/12] Rename `utils.jl` to `complex_math.jl` --- src/ChainRulesCore.jl | 2 +- src/{utils.jl => complex_math.jl} | 0 test/{utils.jl => complex_math.jl} | 2 +- test/runtests.jl | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) rename src/{utils.jl => complex_math.jl} (100%) rename test/{utils.jl => complex_math.jl} (97%) diff --git a/src/ChainRulesCore.jl b/src/ChainRulesCore.jl index 48d1822bd..00d4a111a 100644 --- a/src/ChainRulesCore.jl +++ b/src/ChainRulesCore.jl @@ -36,7 +36,7 @@ include("config.jl") include("rules.jl") include("rule_definition_tools.jl") include("ignore_derivatives.jl") -include("utils.jl") +include("complex_math.jl") include("deprecated.jl") diff --git a/src/utils.jl b/src/complex_math.jl similarity index 100% rename from src/utils.jl rename to src/complex_math.jl diff --git a/test/utils.jl b/test/complex_math.jl similarity index 97% rename from test/utils.jl rename to test/complex_math.jl index 0cd1535ff..6963c0eb1 100644 --- a/test/utils.jl +++ b/test/complex_math.jl @@ -18,7 +18,7 @@ function LinearAlgebra.dot(a::CustomComplex, b::CustomComplex) return CustomComplex(reim((a.re - a.im * im) * (b.re + b.im * im))...) end -@testset "utils.jl" begin +@testset "complex_math.jl" begin @testset "dot" begin scalars = (randn(), randn(ComplexF64), CustomComplex(reim(randn(ComplexF64))...)) arrays = (randn(10), randn(ComplexF64, 10)) diff --git a/test/runtests.jl b/test/runtests.jl index 87cd1e609..6a49a093b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -22,7 +22,7 @@ using Test include("rule_definition_tools.jl") include("config.jl") include("ignore_derivatives.jl") - include("utils.jl") + include("complex_math.jl") include("deprecated.jl") end