Skip to content

Commit

Permalink
fix repr
Browse files Browse the repository at this point in the history
  • Loading branch information
dzhang314 committed Sep 7, 2024
1 parent be88587 commit c996294
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 53 deletions.
43 changes: 11 additions & 32 deletions Manifest.toml
Original file line number Diff line number Diff line change
@@ -1,58 +1,44 @@
# This file is machine-generated - editing it directly is not advised

julia_version = "1.10.0"
julia_version = "1.10.5"
manifest_format = "2.0"
project_hash = "7eaccf21dc5611e80b3246ee4f7b04cbde37de4e"
project_hash = "48e6c585e40f6629013d65798df0e6e96a2696cf"

[[deps.Artifacts]]
uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"

[[deps.Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

[[deps.CompilerSupportLibraries_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae"
version = "1.0.5+1"
version = "1.1.1+0"

[[deps.Dates]]
deps = ["Printf"]
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"

[[deps.InteractiveUtils]]
deps = ["Markdown"]
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"

[[deps.Libdl]]
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"

[[deps.LinearAlgebra]]
deps = ["Libdl", "OpenBLAS_jll", "libblastrampoline_jll"]
uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

[[deps.Logging]]
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"

[[deps.Markdown]]
deps = ["Base64"]
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"

[[deps.OpenBLAS_jll]]
deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"]
uuid = "4536629a-c528-5b80-bd46-f80d51c5b363"
version = "0.3.23+2"
version = "0.3.23+4"

[[deps.PrecompileTools]]
deps = ["Preferences"]
git-tree-sha1 = "03b4c25b43cb84cee5c90aa9b5ea0a78fd848d2f"
git-tree-sha1 = "5aa36f7049a63a1528fe8f7c3f2113413ffd4e1f"
uuid = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
version = "1.2.0"
version = "1.2.1"

[[deps.Preferences]]
deps = ["TOML"]
git-tree-sha1 = "00805cd429dcb4870060ff49ef443486c262e38e"
git-tree-sha1 = "9306f6085165d270f7e3db02af26a400d580f5c6"
uuid = "21216c6a-2e73-6563-6e65-726566657250"
version = "1.4.1"
version = "1.4.3"

[[deps.Printf]]
deps = ["Unicode"]
Expand All @@ -68,26 +54,19 @@ version = "0.7.0"

[[deps.SIMD]]
deps = ["PrecompileTools"]
git-tree-sha1 = "d8911cc125da009051fb35322415641d02d9e37f"
git-tree-sha1 = "2803cab51702db743f3fda07dd1745aadfbf43bd"
uuid = "fdea26ae-647d-5447-a871-4b548cad5224"
version = "3.4.6"

[[deps.Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
version = "3.5.0"

[[deps.TOML]]
deps = ["Dates"]
uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
version = "1.0.3"

[[deps.Test]]
deps = ["InteractiveUtils", "Logging", "Random", "Serialization"]
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[[deps.Unicode]]
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"

[[deps.libblastrampoline_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "8e850b90-86db-534c-a0d3-1478176c7d93"
version = "5.8.0+1"
version = "5.11.0+0"
9 changes: 7 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
name = "MultiFloats"
uuid = "bdf0d083-296b-4888-a5b6-7498122e68a5"
authors = ["David K. Zhang <[email protected]>"]
version = "2.0.2"
version = "2.1.0"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SIMD = "fdea26ae-647d-5447-a871-4b548cad5224"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
julia = "^1.6"
SIMD = "^3"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]
71 changes: 52 additions & 19 deletions src/MultiFloats.jl
Original file line number Diff line number Diff line change
Expand Up @@ -771,13 +771,60 @@ function _call_big(f::F, x::_MF{T,N}, p::Int) where {F,T,N}
end


function Base.show(io::IO, x::_MF{T,N}) where {T,N}
function Base.print(io::IO, x::_MF{T,N}) where {T,N}
_call_big(y -> print(io, y), x)
return nothing
end


function Base.print(io::IO, x::_MFV{M,T,N}) where {M,T,N}
write(io, '<')
print(io, M)
write(io, " x ")
print(io, T)
write(io, " x ")
print(io, N)
write(io, ">[")
for i = 1:M
if i > 1
write(io, ", ")
end
_call_big(y -> print(io, y), x[i])
end
write(io, ']')
return nothing
end


function Base.show(io::IO, ::MIME"text/plain", x::_MF{T,N}) where {T,N}
_call_big(y -> show(io, y), x)
return nothing
end


function Base.show(io::IO, x::_MFV{M,T,N}) where {M,T,N}
show(io, _MFV{M,T,N})
write(io, "((")
for i = 1:N
if i > 1
write(io, ", ")
end
show(io, Vec{M,T})
write(io, "((")
for j = 1:M
if j > 1
write(io, ", ")
end
show(io, x._limbs[i][j])
end
write(io, "))")
end
write(io, "))")
return nothing
end


function Base.show(io::IO, ::MIME"text/plain", x::_MFV{M,T,N}) where {M,T,N}
write(io, '<')
show(io, M)
write(io, " x ")
Expand Down Expand Up @@ -1272,24 +1319,10 @@ end
end


@inline rsqrt(x::_MF{Float64,1}) = _rsqrt(x, Val{0}())
@inline rsqrt(x::_MF{Float64,2}) = _rsqrt(x, Val{1}())
@inline rsqrt(x::_MF{Float64,3}) = _rsqrt(x, Val{2}())
@inline rsqrt(x::_MF{Float64,4}) = _rsqrt(x, Val{2}())
@inline rsqrt(x::_MF{Float64,5}) = _rsqrt(x, Val{3}())
@inline rsqrt(x::_MF{Float64,6}) = _rsqrt(x, Val{3}())
@inline rsqrt(x::_MF{Float64,7}) = _rsqrt(x, Val{4}())
@inline rsqrt(x::_MF{Float64,8}) = _rsqrt(x, Val{4}())


@inline rsqrt(x::_MFV{M,Float64,1}) where {M} = _rsqrt(x, Val{0}())
@inline rsqrt(x::_MFV{M,Float64,2}) where {M} = _rsqrt(x, Val{1}())
@inline rsqrt(x::_MFV{M,Float64,3}) where {M} = _rsqrt(x, Val{2}())
@inline rsqrt(x::_MFV{M,Float64,4}) where {M} = _rsqrt(x, Val{2}())
@inline rsqrt(x::_MFV{M,Float64,5}) where {M} = _rsqrt(x, Val{3}())
@inline rsqrt(x::_MFV{M,Float64,6}) where {M} = _rsqrt(x, Val{3}())
@inline rsqrt(x::_MFV{M,Float64,7}) where {M} = _rsqrt(x, Val{4}())
@inline rsqrt(x::_MFV{M,Float64,8}) where {M} = _rsqrt(x, Val{4}())
@inline rsqrt(x::_MF{T,1}) where {T} = _rsqrt(x, Val{0}())
@inline rsqrt(x::_MF{T,N}) where {T,N} = _rsqrt(x, Val{(N + 1) >> 1}())
@inline rsqrt(x::_MFV{M,T,1}) where {M,T} = _rsqrt(x, Val{0}())
@inline rsqrt(x::_MFV{M,T,N}) where {M,T,N} = _rsqrt(x, Val{(N + 1) >> 1}())


@inline unsafe_sqrt(x::_MF{T,N}) where {T,N} = inv(rsqrt(x))
Expand Down

2 comments on commit c996294

@dzhang314
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/114729

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v2.1.0 -m "<description of version>" c9962948c2a1f2851b35bbdace31f3336593d630
git push origin v2.1.0

Please sign in to comment.