-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What is scaledual
?
#130
Comments
Dang, you're right. Obviously I will submit a fix, but it will be a breaking change so we'll need to do a minor-version-number bump when we release it. |
Apart from the appearance:sweat_smile:, the new function Vec3{T}(v::Vec3{U}, _) where {T, U}
x::T = *(scaledual(T, v.x)...)
y::T = *(scaledual(T, v.y)...)
z::T = *(scaledual(T, v.z)...)
Vec3{T}(x, y, z)
end
function Vec4{T}(v::Vec4{U}, _) where {T, U}
x::T = *(scaledual(T, v.x)...)
y::T = *(scaledual(T, v.y)...)
z::T = *(scaledual(T, v.z)...)
w::T = *(scaledual(T, v.w)...)
Vec4{T}(x, y, z, w)
end julia> vec3_n0f8 = rand(Vec3{N0f8}, 64, 64);
julia> @btime Vec3{Float32}.(mat) setup=(mat=vec3_n0f8);
2.763 μs (2 allocations: 48.08 KiB)
julia> @btime Vec3{Float32}.(mat, 0) setup=(mat=vec3_n0f8); # scaledual
2.788 μs (2 allocations: 48.08 KiB)
julia> @btime Vec3{Float64}.(mat) setup=(mat=vec3_n0f8);
4.600 μs (2 allocations: 96.08 KiB)
julia> @btime Vec3{Float64}.(mat, 0) setup=(mat=vec3_n0f8); # scaledual
4.620 μs (2 allocations: 96.08 KiB) julia> vec4_n0f8 = rand(Vec4{N0f8}, 64, 64);
julia> @btime Vec4{Float32}.(mat) setup=(mat=vec4_n0f8);
2.657 μs (2 allocations: 64.08 KiB)
julia> @btime Vec4{Float32}.(mat, 0) setup=(mat=vec4_n0f8); # scaledual
2.857 μs (2 allocations: 64.08 KiB)
julia> @btime Vec4{Float64}.(mat) setup=(mat=vec4_n0f8);
4.200 μs (2 allocations: 128.08 KiB)
julia> @btime Vec4{Float64}.(mat, 0) setup=(mat=vec4_n0f8); # scaledual
4.166 μs (2 allocations: 128.08 KiB) Of course, |
I am working on improving the accuracy of the conversions from
Normed
toFloat
(#129), and I am interested inscaledual
, which seems to be related with the conversions.The
scaledual
was introduced in d1087f7.Originally posted by @timholy in #2 (comment)
However, in the current codebase, I think
scaledual
does not have the property above as its test specifies. (a[1] != af8[1]
)FixedPointNumbers.jl/test/normed.jl
Lines 287 to 294 in da39318
I do my best for #129, but a slowdown is inevitable. If
scaledual
is helpful as a workaround for people who prefer speed over accuracy, I feel relieved.@timholy , did I not understand that correctly?
The text was updated successfully, but these errors were encountered: