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 18, 2024
1 parent b3abc70 commit e8e31b2
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 @@ -875,7 +875,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 @@ -963,11 +963,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 @@ -1157,7 +1157,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 @@ -79,7 +79,7 @@ end
setindex!(x::ComplexMatrix, y::Tuple{Rational{T}, Rational{T}}, r::Int, c::Int) where {T <: Integer} =

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

View check run for this annotation

Codecov / codecov/patch

src/arb/ComplexMat.jl#L79

Added line #L79 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 @@ -739,19 +739,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 754 in src/arb/ComplexMat.jl

View check run for this annotation

Codecov / codecov/patch

src/arb/ComplexMat.jl#L754

Added line #L754 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 757 in src/arb/ComplexMat.jl

View check run for this annotation

Codecov / codecov/patch

src/arb/ComplexMat.jl#L757

Added line #L757 was not covered by tests
Expand All @@ -760,59 +760,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 771 in src/arb/ComplexMat.jl

View check run for this annotation

Codecov / codecov/patch

src/arb/ComplexMat.jl#L771

Added line #L771 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 783 in src/arb/ComplexMat.jl

View check run for this annotation

Codecov / codecov/patch

src/arb/ComplexMat.jl#L783

Added line #L783 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 789 in src/arb/ComplexMat.jl

View check run for this annotation

Codecov / codecov/patch

src/arb/ComplexMat.jl#L789

Added line #L789 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 795 in src/arb/ComplexMat.jl

View check run for this annotation

Codecov / codecov/patch

src/arb/ComplexMat.jl#L795

Added line #L795 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 807 in src/arb/ComplexMat.jl

View check run for this annotation

Codecov / codecov/patch

src/arb/ComplexMat.jl#L807

Added line #L807 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 810 in src/arb/ComplexMat.jl

View check run for this annotation

Codecov / codecov/patch

src/arb/ComplexMat.jl#L810

Added line #L810 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 @@ -828,7 +828,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 831 in src/arb/ComplexMat.jl

View check run for this annotation

Codecov / codecov/patch

src/arb/ComplexMat.jl#L831

Added line #L831 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 @@ -67,7 +67,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 @@ -682,31 +682,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 705 in src/arb/RealMat.jl

View check run for this annotation

Codecov / codecov/patch

src/arb/RealMat.jl#L705

Added line #L705 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 e8e31b2

Please sign in to comment.