Skip to content
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

More mul!, addmul!, submul! methods for ZZRingElemOrPtr #1860

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 35 additions & 18 deletions src/flint/fmpz.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2572,10 +2572,9 @@
return z
end

function add!(z::ZZRingElem, a::ZZRingElem, b::UInt)
function add!(z::ZZRingElem, x::ZZRingElem, y::UInt)
ccall((:fmpz_add_ui, libflint), Nothing,
(Ref{ZZRingElem}, Ref{ZZRingElem}, UInt),
z, a, b)
(Ref{ZZRingElem}, Ref{ZZRingElem}, UInt), z, x, y)
return z
end

Expand Down Expand Up @@ -2633,51 +2632,69 @@
return z
end

function mul!(z::ZZRingElem, x::ZZRingElem, y::Int)
function mul!(z::ZZRingElemOrPtr, x::ZZRingElemOrPtr, y::Int)
ccall((:fmpz_mul_si, libflint), Nothing,
(Ref{ZZRingElem}, Ref{ZZRingElem}, Int), z, x, y)
return z
end

function mul!(z::ZZRingElem, a::ZZRingElem, b::UInt)
function mul!(z::ZZRingElemOrPtr, x::ZZRingElemOrPtr, y::UInt)
ccall((:fmpz_mul_ui, libflint), Nothing,
(Ref{ZZRingElem}, Ref{ZZRingElem}, UInt),
z, a, b)
(Ref{ZZRingElem}, Ref{ZZRingElem}, UInt), z, x, y)
return z
end

mul!(z::ZZRingElem, a::ZZRingElem, b::Integer) = mul!(z, a, ZZRingElem(b))
mul!(z::ZZRingElemOrPtr, a::ZZRingElemOrPtr, b::Integer) = mul!(z, a, ZZRingElem(b))

mul!(z::ZZRingElem, x::Int, y::ZZRingElem) = mul!(z, y, x)
mul!(z::ZZRingElemOrPtr, x::Integer, y::ZZRingElemOrPtr) = mul!(z, y, x)

Check warning on line 2649 in src/flint/fmpz.jl

View check run for this annotation

Codecov / codecov/patch

src/flint/fmpz.jl#L2649

Added line #L2649 was not covered by tests

function mul!(a::ZZRingElem, b::ZZRingElem, c::Ptr{Int})
function mul!(a::ZZRingElemOrPtr, b::ZZRingElemOrPtr, c::Ptr{Int})

Check warning on line 2651 in src/flint/fmpz.jl

View check run for this annotation

Codecov / codecov/patch

src/flint/fmpz.jl#L2651

Added line #L2651 was not covered by tests
ccall((:fmpz_mul, libflint), Nothing, (Ref{ZZRingElem}, Ref{ZZRingElem}, Ptr{Int}), a, b, c)
return a
end

function addmul!(z::ZZRingElem, x::ZZRingElem, y::ZZRingElem)
function addmul!(z::ZZRingElemOrPtr, x::ZZRingElemOrPtr, y::ZZRingElemOrPtr)
ccall((:fmpz_addmul, libflint), Nothing,
(Ref{ZZRingElem}, Ref{ZZRingElem}, Ref{ZZRingElem}), z, x, y)
return z
end

addmul!(z::ZZRingElem, x::ZZRingElem, y::ZZRingElem, ::ZZRingElem) = addmul!(z, x, y)

function addmul!(z::ZZRingElem, x::ZZRingElem, y::Int)
function addmul!(z::ZZRingElemOrPtr, x::ZZRingElemOrPtr, y::Int)

Check warning on line 2662 in src/flint/fmpz.jl

View check run for this annotation

Codecov / codecov/patch

src/flint/fmpz.jl#L2662

Added line #L2662 was not covered by tests
ccall((:fmpz_addmul_si, libflint), Nothing,
(Ref{ZZRingElem}, Ref{ZZRingElem}, Int), z, x, y)
return z
end

addmul!(z::ZZRingElem, x::ZZRingElem, y::Int, ::ZZRingElem) = addmul!(z, x, y)
function addmul!(z::ZZRingElemOrPtr, x::ZZRingElemOrPtr, y::UInt)
ccall((:fmpz_addmul_ui, libflint), Nothing,

Check warning on line 2669 in src/flint/fmpz.jl

View check run for this annotation

Codecov / codecov/patch

src/flint/fmpz.jl#L2668-L2669

Added lines #L2668 - L2669 were not covered by tests
(Ref{ZZRingElem}, Ref{ZZRingElem}, UInt), z, x, y)
return z

Check warning on line 2671 in src/flint/fmpz.jl

View check run for this annotation

Codecov / codecov/patch

src/flint/fmpz.jl#L2671

Added line #L2671 was not covered by tests
end

# ignore fourth argument
addmul!(z::ZZRingElemOrPtr, x::ZZRingElemOrPtr, y::Union{ZZRingElemOrPtr,Integer}, ::ZZRingElemOrPtr) = addmul!(z, x, y)

Check warning on line 2675 in src/flint/fmpz.jl

View check run for this annotation

Codecov / codecov/patch

src/flint/fmpz.jl#L2675

Added line #L2675 was not covered by tests

function submul!(z::ZZRingElem, a::ZZRingElem, b::ZZRingElem)
function submul!(z::ZZRingElemOrPtr, x::ZZRingElemOrPtr, y::ZZRingElemOrPtr)
ccall((:fmpz_submul, libflint), Nothing,
(Ref{ZZRingElem}, Ref{ZZRingElem}, Ref{ZZRingElem}),
z, a, b)
(Ref{ZZRingElem}, Ref{ZZRingElem}, Ref{ZZRingElem}), z, x, y)
return z
end

function submul!(z::ZZRingElemOrPtr, x::ZZRingElemOrPtr, y::Int)
ccall((:fmpz_submul_si, libflint), Nothing,

Check warning on line 2684 in src/flint/fmpz.jl

View check run for this annotation

Codecov / codecov/patch

src/flint/fmpz.jl#L2683-L2684

Added lines #L2683 - L2684 were not covered by tests
(Ref{ZZRingElem}, Ref{ZZRingElem}, Int), z, x, y)
return z
end

function submul!(z::ZZRingElemOrPtr, x::ZZRingElemOrPtr, y::UInt)
ccall((:fmpz_submul_ui, libflint), Nothing,

Check warning on line 2690 in src/flint/fmpz.jl

View check run for this annotation

Codecov / codecov/patch

src/flint/fmpz.jl#L2689-L2690

Added lines #L2689 - L2690 were not covered by tests
(Ref{ZZRingElem}, Ref{ZZRingElem}, UInt), z, x, y)
return z

Check warning on line 2692 in src/flint/fmpz.jl

View check run for this annotation

Codecov / codecov/patch

src/flint/fmpz.jl#L2692

Added line #L2692 was not covered by tests
end

# ignore fourth argument
submul!(z::ZZRingElemOrPtr, x::ZZRingElemOrPtr, y::Union{ZZRingElemOrPtr,Integer}, ::ZZRingElemOrPtr) = submul!(z, x, y)

Check warning on line 2696 in src/flint/fmpz.jl

View check run for this annotation

Codecov / codecov/patch

src/flint/fmpz.jl#L2696

Added line #L2696 was not covered by tests

@doc raw"""
fmma!(r::ZZRingElem, a::ZZRingElem, b::ZZRingElem, c::ZZRingElem, d::ZZRingElem)

Expand Down
Loading