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

Remove redundant {swap,reverse}_{rows,cols} methods #1976

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
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
8 changes: 0 additions & 8 deletions src/arb/ComplexMat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -616,14 +616,6 @@ end
#
################################################################################

function swap_rows(x::ComplexMatrix, i::Int, j::Int)
_checkbounds(nrows(x), i) || throw(BoundsError())
_checkbounds(nrows(x), j) || throw(BoundsError())
z = deepcopy(x)
swap_rows!(z, i, j)
return z
end

function swap_rows!(x::ComplexMatrix, i::Int, j::Int)
@ccall libflint.acb_mat_swap_rows(x::Ref{ComplexMatrix}, C_NULL::Ptr{Nothing}, (i - 1)::Int, (j - 1)::Int)::Nothing
end
Expand Down
8 changes: 0 additions & 8 deletions src/arb/RealMat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -562,14 +562,6 @@ end
#
################################################################################

function swap_rows(x::RealMatrix, i::Int, j::Int)
_checkbounds(nrows(x), i) || throw(BoundsError())
_checkbounds(nrows(x), j) || throw(BoundsError())
z = deepcopy(x)
swap_rows!(z, i, j)
return z
end

function swap_rows!(x::RealMatrix, i::Int, j::Int)
@ccall libflint.arb_mat_swap_rows(x::Ref{RealMatrix}, C_NULL::Ptr{Nothing}, (i - 1)::Int, (j - 1)::Int)::Nothing
end
Expand Down
8 changes: 0 additions & 8 deletions src/arb/acb_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -617,14 +617,6 @@ end
#
################################################################################

function swap_rows(x::AcbMatrix, i::Int, j::Int)
_checkbounds(nrows(x), i) || throw(BoundsError())
_checkbounds(nrows(x), j) || throw(BoundsError())
z = deepcopy(x)
swap_rows!(z, i, j)
return z
end

function swap_rows!(x::AcbMatrix, i::Int, j::Int)
@ccall libflint.acb_mat_swap_rows(x::Ref{AcbMatrix}, C_NULL::Ptr{Nothing}, (i - 1)::Int, (j - 1)::Int)::Nothing
end
Expand Down
8 changes: 0 additions & 8 deletions src/arb/arb_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -585,14 +585,6 @@ end
#
################################################################################

function swap_rows(x::ArbMatrix, i::Int, j::Int)
_checkbounds(nrows(x), i) || throw(BoundsError())
_checkbounds(nrows(x), j) || throw(BoundsError())
z = deepcopy(x)
swap_rows!(z, i, j)
return z
end

function swap_rows!(x::ArbMatrix, i::Int, j::Int)
@ccall libflint.arb_mat_swap_rows(x::Ref{ArbMatrix}, C_NULL::Ptr{Nothing}, (i - 1)::Int, (j - 1)::Int)::Nothing
end
Expand Down
16 changes: 0 additions & 16 deletions src/flint/fmpq_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -223,37 +223,21 @@ function swap_rows!(x::QQMatrixOrPtr, i::Int, j::Int)
return x
end

function swap_rows(x::QQMatrix, i::Int, j::Int)
(1 <= i <= nrows(x) && 1 <= j <= nrows(x)) || throw(BoundsError())
y = deepcopy(x)
return swap_rows!(y, i, j)
end

function swap_cols!(x::QQMatrixOrPtr, i::Int, j::Int)
@ccall libflint.fmpq_mat_swap_cols(x::Ref{QQMatrix}, C_NULL::Ptr{Nothing}, (i - 1)::Int, (j - 1)::Int)::Nothing
return x
end

function swap_cols(x::QQMatrix, i::Int, j::Int)
(1 <= i <= ncols(x) && 1 <= j <= ncols(x)) || throw(BoundsError())
y = deepcopy(x)
return swap_cols!(y, i, j)
end

function reverse_rows!(x::QQMatrixOrPtr)
@ccall libflint.fmpq_mat_invert_rows(x::Ref{QQMatrix}, C_NULL::Ptr{Nothing})::Nothing
return x
end

reverse_rows(x::QQMatrix) = reverse_rows!(deepcopy(x))

function reverse_cols!(x::QQMatrixOrPtr)
@ccall libflint.fmpq_mat_invert_cols(x::Ref{QQMatrix}, C_NULL::Ptr{Nothing})::Nothing
return x
end

reverse_cols(x::QQMatrix) = reverse_cols!(deepcopy(x))

###############################################################################
#
# Binary operations
Expand Down
16 changes: 0 additions & 16 deletions src/flint/fmpz_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -230,37 +230,21 @@ function swap_rows!(x::ZZMatrix, i::Int, j::Int)
return x
end

function swap_rows(x::ZZMatrix, i::Int, j::Int)
(1 <= i <= nrows(x) && 1 <= j <= nrows(x)) || throw(BoundsError())
y = deepcopy(x)
return swap_rows!(y, i, j)
end

function swap_cols!(x::ZZMatrix, i::Int, j::Int)
@ccall libflint.fmpz_mat_swap_cols(x::Ref{ZZMatrix}, C_NULL::Ptr{Nothing}, (i - 1)::Int, (j - 1)::Int)::Nothing
return x
end

function swap_cols(x::ZZMatrix, i::Int, j::Int)
(1 <= i <= ncols(x) && 1 <= j <= ncols(x)) || throw(BoundsError())
y = deepcopy(x)
return swap_cols!(y, i, j)
end

function reverse_rows!(x::ZZMatrix)
@ccall libflint.fmpz_mat_invert_rows(x::Ref{ZZMatrix}, C_NULL::Ptr{Nothing})::Nothing
return x
end

reverse_rows(x::ZZMatrix) = reverse_rows!(deepcopy(x))

function reverse_cols!(x::ZZMatrix)
@ccall libflint.fmpz_mat_invert_cols(x::Ref{ZZMatrix}, C_NULL::Ptr{Nothing})::Nothing
return x
end

reverse_cols(x::ZZMatrix) = reverse_cols!(deepcopy(x))

###############################################################################
#
# Binary operations
Expand Down
16 changes: 0 additions & 16 deletions src/flint/fmpz_mod_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -135,37 +135,21 @@ function swap_rows!(x::T, i::Int, j::Int) where T <: Zmod_fmpz_mat
return x
end

function swap_rows(x::T, i::Int, j::Int) where T <: Zmod_fmpz_mat
(1 <= i <= nrows(x) && 1 <= j <= nrows(x)) || throw(BoundsError())
y = deepcopy(x)
return swap_rows!(y, i, j)
end

function swap_cols!(x::T, i::Int, j::Int) where T <: Zmod_fmpz_mat
@ccall libflint.fmpz_mod_mat_swap_cols(x::Ref{T}, C_NULL::Ptr{Nothing}, (i - 1)::Int, (j - 1)::Int)::Nothing
return x
end

function swap_cols(x::T, i::Int, j::Int) where T <: Zmod_fmpz_mat
(1 <= i <= ncols(x) && 1 <= j <= ncols(x)) || throw(BoundsError())
y = deepcopy(x)
return swap_cols!(y, i, j)
end

function reverse_rows!(x::T) where T <: Zmod_fmpz_mat
@ccall libflint.fmpz_mod_mat_invert_rows(x::Ref{T}, C_NULL::Ptr{Nothing})::Nothing
return x
end

reverse_rows(x::T) where T <: Zmod_fmpz_mat = reverse_rows!(deepcopy(x))

function reverse_cols!(x::T) where T <: Zmod_fmpz_mat
@ccall libflint.fmpz_mod_mat_invert_cols(x::Ref{T}, C_NULL::Ptr{Nothing})::Nothing
return x
end

reverse_cols(x::T) where T <: Zmod_fmpz_mat = reverse_cols!(deepcopy(x))

################################################################################
#
# Unary operators
Expand Down
16 changes: 0 additions & 16 deletions src/flint/fq_default_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -150,37 +150,21 @@ function swap_rows!(x::FqMatrix, i::Int, j::Int)
return x
end

function swap_rows(x::FqMatrix, i::Int, j::Int)
(1 <= i <= nrows(x) && 1 <= j <= nrows(x)) || throw(BoundsError())
y = deepcopy(x)
return swap_rows!(y, i, j)
end

function swap_cols!(x::FqMatrix, i::Int, j::Int)
@ccall libflint.fq_default_mat_swap_cols(x::Ref{FqMatrix}, C_NULL::Ptr{Nothing}, (i - 1)::Int, (j - 1)::Int, base_ring(x)::Ref{FqField})::Nothing
return x
end

function swap_cols(x::FqMatrix, i::Int, j::Int)
(1 <= i <= ncols(x) && 1 <= j <= ncols(x)) || throw(BoundsError())
y = deepcopy(x)
return swap_cols!(y, i, j)
end

function reverse_rows!(x::FqMatrix)
@ccall libflint.fq_default_mat_invert_rows(x::Ref{FqMatrix}, C_NULL::Ptr{Nothing}, base_ring(x)::Ref{FqField})::Nothing
return x
end

reverse_rows(x::FqMatrix) = reverse_rows!(deepcopy(x))

function reverse_cols!(x::FqMatrix)
@ccall libflint.fq_default_mat_invert_cols(x::Ref{FqMatrix}, C_NULL::Ptr{Nothing}, base_ring(x)::Ref{FqField})::Nothing
return x
end

reverse_cols(x::FqMatrix) = reverse_cols!(deepcopy(x))

################################################################################
#
# Unary operators
Expand Down
16 changes: 0 additions & 16 deletions src/flint/fq_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -155,37 +155,21 @@ function swap_rows!(x::FqPolyRepMatrix, i::Int, j::Int)
return x
end

function swap_rows(x::FqPolyRepMatrix, i::Int, j::Int)
(1 <= i <= nrows(x) && 1 <= j <= nrows(x)) || throw(BoundsError())
y = deepcopy(x)
return swap_rows!(y, i, j)
end

function swap_cols!(x::FqPolyRepMatrix, i::Int, j::Int)
@ccall libflint.fq_mat_swap_cols(x::Ref{FqPolyRepMatrix}, C_NULL::Ptr{Nothing}, (i - 1)::Int, (j - 1)::Int, base_ring(x)::Ref{FqPolyRepField})::Nothing
return x
end

function swap_cols(x::FqPolyRepMatrix, i::Int, j::Int)
(1 <= i <= ncols(x) && 1 <= j <= ncols(x)) || throw(BoundsError())
y = deepcopy(x)
return swap_cols!(y, i, j)
end

function reverse_rows!(x::FqPolyRepMatrix)
@ccall libflint.fq_mat_invert_rows(x::Ref{FqPolyRepMatrix}, C_NULL::Ptr{Nothing}, base_ring(x)::Ref{FqPolyRepField})::Nothing
return x
end

reverse_rows(x::FqPolyRepMatrix) = reverse_rows!(deepcopy(x))

function reverse_cols!(x::FqPolyRepMatrix)
@ccall libflint.fq_mat_invert_cols(x::Ref{FqPolyRepMatrix}, C_NULL::Ptr{Nothing}, base_ring(x)::Ref{FqPolyRepField})::Nothing
return x
end

reverse_cols(x::FqPolyRepMatrix) = reverse_cols!(deepcopy(x))

################################################################################
#
# Unary operators
Expand Down
16 changes: 0 additions & 16 deletions src/flint/fq_nmod_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -143,37 +143,21 @@ function swap_rows!(x::fqPolyRepMatrix, i::Int, j::Int)
return x
end

function swap_rows(x::fqPolyRepMatrix, i::Int, j::Int)
(1 <= i <= nrows(x) && 1 <= j <= nrows(x)) || throw(BoundsError())
y = deepcopy(x)
return swap_rows!(y, i, j)
end

function swap_cols!(x::fqPolyRepMatrix, i::Int, j::Int)
@ccall libflint.fq_nmod_mat_swap_cols(x::Ref{fqPolyRepMatrix}, C_NULL::Ptr{Nothing}, (i - 1)::Int, (j - 1)::Int, base_ring(x)::Ref{fqPolyRepField})::Nothing
return x
end

function swap_cols(x::fqPolyRepMatrix, i::Int, j::Int)
(1 <= i <= ncols(x) && 1 <= j <= ncols(x)) || throw(BoundsError())
y = deepcopy(x)
return swap_cols!(y, i, j)
end

function reverse_rows!(x::fqPolyRepMatrix)
@ccall libflint.fq_nmod_mat_invert_rows(x::Ref{fqPolyRepMatrix}, C_NULL::Ptr{Nothing}, base_ring(x)::Ref{fqPolyRepField})::Nothing
return x
end

reverse_rows(x::fqPolyRepMatrix) = reverse_rows!(deepcopy(x))

function reverse_cols!(x::fqPolyRepMatrix)
@ccall libflint.fq_nmod_mat_invert_cols(x::Ref{fqPolyRepMatrix}, C_NULL::Ptr{Nothing}, base_ring(x)::Ref{fqPolyRepField})::Nothing
return x
end

reverse_cols(x::fqPolyRepMatrix) = reverse_cols!(deepcopy(x))

################################################################################
#
# Unary operators
Expand Down
16 changes: 0 additions & 16 deletions src/flint/nmod_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -147,37 +147,21 @@ function swap_rows!(x::T, i::Int, j::Int) where T <: Zmodn_mat
return x
end

function swap_rows(x::T, i::Int, j::Int) where T <: Zmodn_mat
(1 <= i <= nrows(x) && 1 <= j <= nrows(x)) || throw(BoundsError())
y = deepcopy(x)
return swap_rows!(y, i, j)
end

function swap_cols!(x::T, i::Int, j::Int) where T <: Zmodn_mat
@ccall libflint.nmod_mat_swap_cols(x::Ref{T}, C_NULL::Ptr{Nothing}, (i - 1)::Int, (j - 1)::Int)::Nothing
return x
end

function swap_cols(x::T, i::Int, j::Int) where T <: Zmodn_mat
(1 <= i <= ncols(x) && 1 <= j <= ncols(x)) || throw(BoundsError())
y = deepcopy(x)
return swap_cols!(y, i, j)
end

function reverse_rows!(x::T) where T <: Zmodn_mat
@ccall libflint.nmod_mat_invert_rows(x::Ref{T}, C_NULL::Ptr{Nothing})::Nothing
return x
end

reverse_rows(x::T) where T <: Zmodn_mat = reverse_rows!(deepcopy(x))

function reverse_cols!(x::T) where T <: Zmodn_mat
@ccall libflint.nmod_mat_invert_cols(x::Ref{T}, C_NULL::Ptr{Nothing})::Nothing
return x
end

reverse_cols(x::T) where T <: Zmodn_mat = reverse_cols!(deepcopy(x))

################################################################################
#
# Unary operators
Expand Down
Loading