-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize map_coefficients, change_base_ring for some inputs
Namely if the input polynomial is a `QQMPolyRingElem` and the transformation "function" is `ZZ` resp. a `fpField`. Before this patch: julia> Qxy,(x,y) = QQ[:x,:y]; Zxy,_ = ZZ[:u,:v]; julia> f = 11*(x^2/2 + ZZ(3)^50*x*y^5/7 + y^6/12); julia> @b $f*84 160.000 ns (4 allocs: 200 bytes) julia> @b change_base_ring($ZZ, $f*84) 1.559 μs (45 allocs: 1.633 KiB) julia> @b change_base_ring($ZZ, $f*84; parent = $Zxy) 1.002 μs (24 allocs: 808 bytes) julia> @b map_coefficients($ZZ, $f*84; parent = $Zxy) 996.680 ns (24 allocs: 808 bytes) After this patch: julia> Qxy,(x,y) = QQ[:x,:y]; Zxy,_ = ZZ[:u,:v]; julia> f = 11*(x^2/2 + ZZ(3)^50*x*y^5/7 + y^6/12); julia> @b $f*84 111.693 ns (4 allocs: 200 bytes) julia> @b change_base_ring($ZZ, $f*84) 733.806 ns (30 allocs: 1.227 KiB) julia> @b change_base_ring($ZZ, $f*84; parent = $Zxy) 242.117 ns (9 allocs: 392 bytes) julia> @b map_coefficients($ZZ, $f*84; parent = $Zxy) 249.607 ns (9 allocs: 392 bytes) As a bonus we now also have a special `mul!` method which is even faster but is not suitable for the faint of heart: julia> @b mul!($Zxy(), $f, 84) 129.041 ns (5 allocs: 192 bytes)
- Loading branch information
Showing
3 changed files
with
83 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters