Skip to content

Commit

Permalink
Remove constructors from vector (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
sethaxen authored Jan 22, 2023
1 parent 1679b7f commit b2373ef
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 11 deletions.
3 changes: 0 additions & 3 deletions src/octonion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ Octonion{T}(o::Octonion) where {T<:Real} =
Octonion(s::Real, v1::Real, v2::Real, v3::Real, v4::Real, v5::Real, v6::Real, v7::Real) =
Octonion(promote(s, v1, v2, v3, v4, v5, v6, v7)...)
Octonion(x::Real) = Octonion(x, zero(x), zero(x), zero(x), zero(x), zero(x), zero(x), zero(x))
Octonion(s::Real, a::Vector) = Octonion(s, a[1], a[2], a[3], a[4], a[5], a[6], a[7])
Octonion(a::Vector) = Octonion(0, a[1], a[2], a[3], a[4], a[5], a[6], a[7])

const OctonionF16 = Octonion{Float16}
const OctonionF32 = Octonion{Float32}
Expand All @@ -28,7 +26,6 @@ promote_rule(::Type{Octonion{T}}, ::Type{Octonion{S}}) where {T <: Real, S <: Re

octo(p, v1, v2, v3, v4, v5, v6, v7) = Octonion(p, v1, v2, v3, v4, v5, v6, v7)
octo(x) = Octonion(x)
octo(s, a) = Octonion(s, a)

real(o::Octonion) = o.s
imag_part(o::Octonion) = (o.v1, o.v2, o.v3, o.v4, o.v5, o.v6, o.v7)
Expand Down
8 changes: 0 additions & 8 deletions test/octonion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@ end
@test @inferred(Octonion(o)) === o
end
end
@testset "from vector" begin
s = randn()
v = randn(7)
@test @inferred(Octonion(s, v)) === Octonion(s, v...)
@test @inferred(Octonion(v)) === Octonion(0, v)
end
end

@testset "==" begin
Expand Down Expand Up @@ -83,8 +77,6 @@ end
@test octo(1) === Octonion(1)
@test octo(1, 2, 3, 4, 5, 6, 7, 8) === Octonion(1, 2, 3, 4, 5, 6, 7, 8)
@test octo(Octonion(1, 2, 3, 4, 5, 6, 7, 8)) === Octonion(1, 2, 3, 4, 5, 6, 7, 8)
@test octo(1, collect(2:8)) === Octonion(1:8...)
@test octo(collect(2:8)) === Octonion(0, 2:8...)
end

@testset "random generation" begin
Expand Down

0 comments on commit b2373ef

Please sign in to comment.