Skip to content

Commit

Permalink
Rename arb's *MatSpace -> *MatrixSpace
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens committed Jul 12, 2024
1 parent 1802812 commit 56b1df7
Show file tree
Hide file tree
Showing 13 changed files with 93 additions and 89 deletions.
8 changes: 4 additions & 4 deletions docs/src/matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ $\mathbb{Q}$ | Flint | `QQMatrix`
$\mathbb{Z}/p\mathbb{Z}$ (small $p$) | Flint | `fpMatrix` | `fpMatrixSpace`
$\mathbb{F}_{p^n}$ (small $p$) | Flint | `fqPolyRepMatrix` | `fqPolyRepMatrixSpace`
$\mathbb{F}_{p^n}$ (large $p$) | Flint | `FqPolyRepMatrix` | `FqPolyRepMatrixSpace`
$\mathbb{R}$ (arbitrary precision) | Arb | `RealMatrix` | `RealMatSpace`
$\mathbb{C}$ (arbitrary precision) | Arb | `ComplexMatrix` | `ComplexMatSpace`
$\mathbb{R}$ (fixed precision) | Arb | `ArbMatrix` | `ArbMatSpace`
$\mathbb{C}$ (fixed precision) | Arb | `AcbMatrix` | `AcbMatSpace`
$\mathbb{R}$ (arbitrary precision) | Arb | `RealMatrix` | `RealMatrixSpace`
$\mathbb{C}$ (arbitrary precision) | Arb | `ComplexMatrix` | `ComplexMatrixSpace`
$\mathbb{R}$ (fixed precision) | Arb | `ArbMatrix` | `ArbMatrixSpace`
$\mathbb{C}$ (fixed precision) | Arb | `AcbMatrix` | `AcbMatrixSpace`

The dimensions and base ring $R$ of a generic matrix are stored in its parent
object.
Expand Down
4 changes: 2 additions & 2 deletions docs/src/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ parent objects of the given rings and structures.
- `AcbFieldElem` (`AcbField`)
- `ArbPolyRingElem` (`ArbPolyRing`)
- `AcbPolyRingElem` (`AcbPolyRing`)
- `ArbMatrix` (`ArbMatSpace`)
- `AcbMatrix` (`AcbMatSpace`)
- `ArbMatrix` (`ArbMatrixSpace`)
- `AcbMatrix` (`AcbMatrixSpace`)

- Calcium

Expand Down
4 changes: 4 additions & 0 deletions src/Deprecations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
@alias RealPoly RealPolyRingElem
@alias ComplexMat ComplexMatrix
@alias RealMat RealMatrix
@alias AcbMatSpace AcbMatrixSpace
@alias ComplexMatSpace ComplexMatrixSpace
@alias ArbMatSpace ArbMatrixSpace
@alias RealMatSpace RealMatrixSpace

###############################################################################
#
Expand Down
8 changes: 4 additions & 4 deletions src/Exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export AbsSimpleNumFieldElem
export AcbField
export AcbFieldElem
export AcbMatrix
export AcbMatSpace
export AcbMatrixSpace
export AcbPolyRing
export AcbPolyRingElem
export accuracy_bits
Expand All @@ -34,7 +34,7 @@ export angle
export ArbField
export ArbFieldElem
export ArbMatrix
export ArbMatSpace
export ArbMatrixSpace
export ArbPolyRing
export ArbPolyRingElem
export Array
Expand Down Expand Up @@ -88,7 +88,7 @@ export complex_normal_form
export ComplexField
export ComplexFieldElem
export ComplexMatrix
export ComplexMatSpace
export ComplexMatrixSpace
export ComplexPolyRing
export ComplexPolyRingElem
export compose
Expand Down Expand Up @@ -526,7 +526,7 @@ export real
export RealField
export RealFieldElem
export RealMatrix
export RealMatSpace
export RealMatrixSpace
export RealPolyRing
export RealPolyRingElem
export reconstruct
Expand Down
12 changes: 6 additions & 6 deletions src/arb/ArbTypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -783,11 +783,11 @@ base_ring(a::AcbPolyRing) = a.base_ring

################################################################################
#
# Types and memory management for ArbMatSpace
# Types and memory management for ArbMatrixSpace
#
################################################################################

const RealMatSpace = AbstractAlgebra.Generic.MatSpace{RealFieldElem}
const RealMatrixSpace = AbstractAlgebra.Generic.MatSpace{RealFieldElem}

mutable struct RealMatrix <: MatElem{RealFieldElem}
entries::Ptr{Nothing}
Expand Down Expand Up @@ -879,7 +879,7 @@ end

# fixed precision

const ArbMatSpace = AbstractAlgebra.Generic.MatSpace{ArbFieldElem}
const ArbMatrixSpace = AbstractAlgebra.Generic.MatSpace{ArbFieldElem}

mutable struct ArbMatrix <: MatElem{ArbFieldElem}
entries::Ptr{Nothing}
Expand Down Expand Up @@ -971,11 +971,11 @@ end

################################################################################
#
# Types and memory management for AcbMatSpace
# Types and memory management for AcbMatrixSpace
#
################################################################################

const ComplexMatSpace = AbstractAlgebra.Generic.MatSpace{ComplexFieldElem}
const ComplexMatrixSpace = AbstractAlgebra.Generic.MatSpace{ComplexFieldElem}

mutable struct ComplexMatrix <: MatElem{ComplexFieldElem}
entries::Ptr{Nothing}
Expand Down Expand Up @@ -1177,7 +1177,7 @@ end

# fixed precision

const AcbMatSpace = AbstractAlgebra.Generic.MatSpace{AcbFieldElem}
const AcbMatrixSpace = AbstractAlgebra.Generic.MatSpace{AcbFieldElem}

mutable struct AcbMatrix <: MatElem{AcbFieldElem}
entries::Ptr{Nothing}
Expand Down
36 changes: 18 additions & 18 deletions src/arb/ComplexMat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ end
setindex!(x::ComplexMatrix, y::Tuple{Rational{T}, Rational{T}}, r::Int, c::Int) where {T <: Integer} =

Check warning on line 83 in src/arb/ComplexMat.jl

View check run for this annotation

Codecov / codecov/patch

src/arb/ComplexMat.jl#L83

Added line #L83 was not covered by tests
setindex!(x, map(QQFieldElem, y), r, c)

function one(x::ComplexMatSpace)
function one(x::ComplexMatrixSpace)
z = x()
ccall((:acb_mat_one, libflint), Nothing, (Ref{ComplexMatrix}, ), z)
return z
Expand Down Expand Up @@ -743,19 +743,19 @@ end
#
###############################################################################

function (x::ComplexMatSpace)()
function (x::ComplexMatrixSpace)()
z = ComplexMatrix(nrows(x), ncols(x))
return z
end

function (x::ComplexMatSpace)(y::ZZMatrix)
function (x::ComplexMatrixSpace)(y::ZZMatrix)
(ncols(x) != ncols(y) || nrows(x) != nrows(y)) &&
error("Dimensions are wrong")
z = ComplexMatrix(y, precision(Balls))
return z
end

function (x::ComplexMatSpace)(y::RealMatrix)
function (x::ComplexMatrixSpace)(y::RealMatrix)

Check warning on line 758 in src/arb/ComplexMat.jl

View check run for this annotation

Codecov / codecov/patch

src/arb/ComplexMat.jl#L758

Added line #L758 was not covered by tests
(ncols(x) != ncols(y) || nrows(x) != nrows(y)) &&
error("Dimensions are wrong")
z = ComplexMatrix(y, precision(Balls))

Check warning on line 761 in src/arb/ComplexMat.jl

View check run for this annotation

Codecov / codecov/patch

src/arb/ComplexMat.jl#L761

Added line #L761 was not covered by tests
Expand All @@ -764,59 +764,59 @@ end

for T in [Float64, ZZRingElem, QQFieldElem, BigFloat, RealFieldElem, ComplexFieldElem, String]
@eval begin
function (x::ComplexMatSpace)(y::AbstractMatrix{$T})
function (x::ComplexMatrixSpace)(y::AbstractMatrix{$T})
_check_dim(nrows(x), ncols(x), y)
z = ComplexMatrix(nrows(x), ncols(x), y, precision(Balls))
return z
end

function (x::ComplexMatSpace)(y::AbstractVector{$T})
function (x::ComplexMatrixSpace)(y::AbstractVector{$T})
_check_dim(nrows(x), ncols(x), y)
z = ComplexMatrix(nrows(x), ncols(x), y, precision(Balls))

Check warning on line 775 in src/arb/ComplexMat.jl

View check run for this annotation

Codecov / codecov/patch

src/arb/ComplexMat.jl#L775

Added line #L775 was not covered by tests
return z
end
end
end

(x::ComplexMatSpace)(y::AbstractMatrix{T}) where {T <: Integer} = x(map(ZZRingElem, y))
(x::ComplexMatrixSpace)(y::AbstractMatrix{T}) where {T <: Integer} = x(map(ZZRingElem, y))

(x::ComplexMatSpace)(y::AbstractVector{T}) where {T <: Integer} = x(map(ZZRingElem, y))
(x::ComplexMatrixSpace)(y::AbstractVector{T}) where {T <: Integer} = x(map(ZZRingElem, y))

(x::ComplexMatSpace)(y::AbstractMatrix{Rational{T}}) where {T <: Integer} = x(map(QQFieldElem, y))
(x::ComplexMatrixSpace)(y::AbstractMatrix{Rational{T}}) where {T <: Integer} = x(map(QQFieldElem, y))

(x::ComplexMatSpace)(y::AbstractVector{Rational{T}}) where {T <: Integer} = x(map(QQFieldElem, y))
(x::ComplexMatrixSpace)(y::AbstractVector{Rational{T}}) where {T <: Integer} = x(map(QQFieldElem, y))

Check warning on line 787 in src/arb/ComplexMat.jl

View check run for this annotation

Codecov / codecov/patch

src/arb/ComplexMat.jl#L787

Added line #L787 was not covered by tests

for T in [Float64, ZZRingElem, QQFieldElem, BigFloat, RealFieldElem, String]
@eval begin
function (x::ComplexMatSpace)(y::AbstractMatrix{Tuple{$T, $T}})
function (x::ComplexMatrixSpace)(y::AbstractMatrix{Tuple{$T, $T}})
_check_dim(nrows(x), ncols(x), y)
z = ComplexMatrix(nrows(x), ncols(x), y, precision(Balls))

Check warning on line 793 in src/arb/ComplexMat.jl

View check run for this annotation

Codecov / codecov/patch

src/arb/ComplexMat.jl#L793

Added line #L793 was not covered by tests
return z
end

function (x::ComplexMatSpace)(y::AbstractVector{Tuple{$T, $T}})
function (x::ComplexMatrixSpace)(y::AbstractVector{Tuple{$T, $T}})
_check_dim(nrows(x), ncols(x), y)
z = ComplexMatrix(nrows(x), ncols(x), y, precision(Balls))

Check warning on line 799 in src/arb/ComplexMat.jl

View check run for this annotation

Codecov / codecov/patch

src/arb/ComplexMat.jl#L799

Added line #L799 was not covered by tests
return z
end
end
end

(x::ComplexMatSpace)(y::AbstractMatrix{Tuple{T, T}}) where {T <: Integer} =
(x::ComplexMatrixSpace)(y::AbstractMatrix{Tuple{T, T}}) where {T <: Integer} =
x(map(z -> (ZZRingElem(z[1]), ZZRingElem(z[2])), y))

(x::ComplexMatSpace)(y::AbstractVector{Tuple{T, T}}) where {T <: Integer} =
(x::ComplexMatrixSpace)(y::AbstractVector{Tuple{T, T}}) where {T <: Integer} =
x(map(z -> (ZZRingElem(z[1]), ZZRingElem(z[2])), y))

(x::ComplexMatSpace)(y::AbstractMatrix{Tuple{Rational{T}, Rational{T}}}) where {T <: Integer} =
(x::ComplexMatrixSpace)(y::AbstractMatrix{Tuple{Rational{T}, Rational{T}}}) where {T <: Integer} =

Check warning on line 811 in src/arb/ComplexMat.jl

View check run for this annotation

Codecov / codecov/patch

src/arb/ComplexMat.jl#L811

Added line #L811 was not covered by tests
x(map(z -> (QQFieldElem(z[1]), QQFieldElem(z[2])), y))

(x::ComplexMatSpace)(y::AbstractVector{Tuple{Rational{T}, Rational{T}}}) where {T <: Integer} =
(x::ComplexMatrixSpace)(y::AbstractVector{Tuple{Rational{T}, Rational{T}}}) where {T <: Integer} =

Check warning on line 814 in src/arb/ComplexMat.jl

View check run for this annotation

Codecov / codecov/patch

src/arb/ComplexMat.jl#L814

Added line #L814 was not covered by tests
x(map(z -> (QQFieldElem(z[1]), QQFieldElem(z[2])), y))

for T in [Integer, ZZRingElem, QQFieldElem, Float64, BigFloat, RealFieldElem, ComplexFieldElem, String]
@eval begin
function (x::ComplexMatSpace)(y::$T)
function (x::ComplexMatrixSpace)(y::$T)
z = x()
for i in 1:nrows(z)
for j = 1:ncols(z)
Expand All @@ -832,7 +832,7 @@ for T in [Integer, ZZRingElem, QQFieldElem, Float64, BigFloat, RealFieldElem, Co
end
end

(x::ComplexMatSpace)(y::Rational{T}) where {T <: Integer} = x(QQFieldElem(y))
(x::ComplexMatrixSpace)(y::Rational{T}) where {T <: Integer} = x(QQFieldElem(y))

Check warning on line 835 in src/arb/ComplexMat.jl

View check run for this annotation

Codecov / codecov/patch

src/arb/ComplexMat.jl#L835

Added line #L835 was not covered by tests

###############################################################################
#
Expand Down
12 changes: 6 additions & 6 deletions src/arb/RealMat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Base.@propagate_inbounds setindex!(x::RealMatrix, y::Rational{T},
r::Int, c::Int) where {T <: Integer} =
setindex!(x, ZZRingElem(y), r, c)

function one(x::RealMatSpace)
function one(x::RealMatrixSpace)
z = x()
ccall((:arb_mat_one, libflint), Nothing, (Ref{RealMatrix}, ), z)
return z
Expand Down Expand Up @@ -685,31 +685,31 @@ end
#
###############################################################################

function (x::RealMatSpace)()
function (x::RealMatrixSpace)()
z = RealMatrix(nrows(x), ncols(x))
return z
end

function (x::RealMatSpace)(y::ZZMatrix)
function (x::RealMatrixSpace)(y::ZZMatrix)
(ncols(x) != ncols(y) || nrows(x) != nrows(y)) &&
error("Dimensions are wrong")
z = RealMatrix(y, precision(Balls))
return z
end

function (x::RealMatSpace)(y::AbstractMatrix{T}) where {T <: Union{Int, UInt, ZZRingElem, QQFieldElem, Float64, BigFloat, RealFieldElem, AbstractString}}
function (x::RealMatrixSpace)(y::AbstractMatrix{T}) where {T <: Union{Int, UInt, ZZRingElem, QQFieldElem, Float64, BigFloat, RealFieldElem, AbstractString}}
_check_dim(nrows(x), ncols(x), y)
z = RealMatrix(nrows(x), ncols(x), y, precision(Balls))
return z
end

function (x::RealMatSpace)(y::AbstractVector{T}) where {T <: Union{Int, UInt, ZZRingElem, QQFieldElem, Float64, BigFloat, RealFieldElem, AbstractString}}
function (x::RealMatrixSpace)(y::AbstractVector{T}) where {T <: Union{Int, UInt, ZZRingElem, QQFieldElem, Float64, BigFloat, RealFieldElem, AbstractString}}
_check_dim(nrows(x), ncols(x), y)
z = RealMatrix(nrows(x), ncols(x), y, precision(Balls))

Check warning on line 708 in src/arb/RealMat.jl

View check run for this annotation

Codecov / codecov/patch

src/arb/RealMat.jl#L708

Added line #L708 was not covered by tests
return z
end

function (x::RealMatSpace)(y::Union{Int, UInt, ZZRingElem, QQFieldElem, Float64,
function (x::RealMatrixSpace)(y::Union{Int, UInt, ZZRingElem, QQFieldElem, Float64,
BigFloat, RealFieldElem, AbstractString})
z = x()
for i in 1:nrows(z)
Expand Down
Loading

0 comments on commit 56b1df7

Please sign in to comment.