diff --git a/src/arb/ComplexMat.jl b/src/arb/ComplexMat.jl index 4c662bad37..d16b3b96b4 100644 --- a/src/arb/ComplexMat.jl +++ b/src/arb/ComplexMat.jl @@ -706,13 +706,7 @@ end for T in [Float64, ZZRingElem, QQFieldElem, BigFloat, RealFieldElem, ComplexFieldElem, String] @eval begin - 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::ComplexMatrixSpace)(y::AbstractVector{$T}) + function (x::ComplexMatrixSpace)(y::AbstractVecOrMat{$T}) _check_dim(nrows(x), ncols(x), y) z = ComplexMatrix(nrows(x), ncols(x), y, precision(Balls)) return z @@ -720,23 +714,13 @@ for T in [Float64, ZZRingElem, QQFieldElem, BigFloat, RealFieldElem, ComplexFiel end end -(x::ComplexMatrixSpace)(y::AbstractMatrix{T}) where {T <: Integer} = x(map(ZZRingElem, y)) - -(x::ComplexMatrixSpace)(y::AbstractVector{T}) where {T <: Integer} = x(map(ZZRingElem, y)) +(x::ComplexMatrixSpace)(y::AbstractVecOrMat{T}) where {T <: Integer} = x(map(ZZRingElem, y)) -(x::ComplexMatrixSpace)(y::AbstractMatrix{Rational{T}}) where {T <: Integer} = x(map(QQFieldElem, y)) - -(x::ComplexMatrixSpace)(y::AbstractVector{Rational{T}}) where {T <: Integer} = x(map(QQFieldElem, y)) +(x::ComplexMatrixSpace)(y::AbstractVecOrMat{Rational{T}}) where {T <: Integer} = x(map(QQFieldElem, y)) for T in [Float64, ZZRingElem, QQFieldElem, BigFloat, RealFieldElem, String] @eval begin - function (x::ComplexMatrixSpace)(y::AbstractMatrix{Tuple{$T, $T}}) - _check_dim(nrows(x), ncols(x), y) - z = ComplexMatrix(nrows(x), ncols(x), y, precision(Balls)) - return z - end - - function (x::ComplexMatrixSpace)(y::AbstractVector{Tuple{$T, $T}}) + function (x::ComplexMatrixSpace)(y::AbstractVecOrMat{Tuple{$T, $T}}) _check_dim(nrows(x), ncols(x), y) z = ComplexMatrix(nrows(x), ncols(x), y, precision(Balls)) return z @@ -744,16 +728,10 @@ for T in [Float64, ZZRingElem, QQFieldElem, BigFloat, RealFieldElem, String] end end -(x::ComplexMatrixSpace)(y::AbstractMatrix{Tuple{T, T}}) where {T <: Integer} = +(x::ComplexMatrixSpace)(y::AbstractVecOrMat{Tuple{T, T}}) where {T <: Integer} = x(map(z -> (ZZRingElem(z[1]), ZZRingElem(z[2])), y)) -(x::ComplexMatrixSpace)(y::AbstractVector{Tuple{T, T}}) where {T <: Integer} = -x(map(z -> (ZZRingElem(z[1]), ZZRingElem(z[2])), y)) - -(x::ComplexMatrixSpace)(y::AbstractMatrix{Tuple{Rational{T}, Rational{T}}}) where {T <: Integer} = -x(map(z -> (QQFieldElem(z[1]), QQFieldElem(z[2])), y)) - -(x::ComplexMatrixSpace)(y::AbstractVector{Tuple{Rational{T}, Rational{T}}}) where {T <: Integer} = +(x::ComplexMatrixSpace)(y::AbstractVecOrMat{Tuple{Rational{T}, Rational{T}}}) where {T <: Integer} = x(map(z -> (QQFieldElem(z[1]), QQFieldElem(z[2])), y)) for T in [Integer, ZZRingElem, QQFieldElem, Float64, BigFloat, RealFieldElem, ComplexFieldElem, String] diff --git a/src/arb/RealMat.jl b/src/arb/RealMat.jl index ad469b8a95..e9f39d33b3 100644 --- a/src/arb/RealMat.jl +++ b/src/arb/RealMat.jl @@ -643,13 +643,7 @@ function (x::RealMatrixSpace)(y::ZZMatrix) return z end -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::RealMatrixSpace)(y::AbstractVector{T}) where {T <: Union{Int, UInt, ZZRingElem, QQFieldElem, Float64, BigFloat, RealFieldElem, AbstractString}} +function (x::RealMatrixSpace)(y::AbstractVecOrMat{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 diff --git a/src/arb/acb_mat.jl b/src/arb/acb_mat.jl index 94ae3b8ef5..d3447ae9d0 100644 --- a/src/arb/acb_mat.jl +++ b/src/arb/acb_mat.jl @@ -709,14 +709,7 @@ end for T in [Float64, ZZRingElem, QQFieldElem, BigFloat, ArbFieldElem, AcbFieldElem, String] @eval begin - function (x::AcbMatrixSpace)(y::AbstractMatrix{$T}) - _check_dim(nrows(x), ncols(x), y) - z = AcbMatrix(nrows(x), ncols(x), y, precision(x)) - z.base_ring = x.base_ring - return z - end - - function (x::AcbMatrixSpace)(y::AbstractVector{$T}) + function (x::AcbMatrixSpace)(y::AbstractVecOrMat{$T}) _check_dim(nrows(x), ncols(x), y) z = AcbMatrix(nrows(x), ncols(x), y, precision(x)) z.base_ring = x.base_ring @@ -725,24 +718,13 @@ for T in [Float64, ZZRingElem, QQFieldElem, BigFloat, ArbFieldElem, AcbFieldElem end end -(x::AcbMatrixSpace)(y::AbstractMatrix{T}) where {T <: Integer} = x(map(ZZRingElem, y)) - -(x::AcbMatrixSpace)(y::AbstractVector{T}) where {T <: Integer} = x(map(ZZRingElem, y)) +(x::AcbMatrixSpace)(y::AbstractVecOrMat{T}) where {T <: Integer} = x(map(ZZRingElem, y)) -(x::AcbMatrixSpace)(y::AbstractMatrix{Rational{T}}) where {T <: Integer} = x(map(QQFieldElem, y)) - -(x::AcbMatrixSpace)(y::AbstractVector{Rational{T}}) where {T <: Integer} = x(map(QQFieldElem, y)) +(x::AcbMatrixSpace)(y::AbstractVecOrMat{Rational{T}}) where {T <: Integer} = x(map(QQFieldElem, y)) for T in [Float64, ZZRingElem, QQFieldElem, BigFloat, ArbFieldElem, String] @eval begin - function (x::AcbMatrixSpace)(y::AbstractMatrix{Tuple{$T, $T}}) - _check_dim(nrows(x), ncols(x), y) - z = AcbMatrix(nrows(x), ncols(x), y, precision(x)) - z.base_ring = x.base_ring - return z - end - - function (x::AcbMatrixSpace)(y::AbstractVector{Tuple{$T, $T}}) + function (x::AcbMatrixSpace)(y::AbstractVecOrMat{Tuple{$T, $T}}) _check_dim(nrows(x), ncols(x), y) z = AcbMatrix(nrows(x), ncols(x), y, precision(x)) z.base_ring = x.base_ring @@ -751,16 +733,10 @@ for T in [Float64, ZZRingElem, QQFieldElem, BigFloat, ArbFieldElem, String] end end -(x::AcbMatrixSpace)(y::AbstractMatrix{Tuple{T, T}}) where {T <: Integer} = +(x::AcbMatrixSpace)(y::AbstractVecOrMat{Tuple{T, T}}) where {T <: Integer} = x(map(z -> (ZZRingElem(z[1]), ZZRingElem(z[2])), y)) -(x::AcbMatrixSpace)(y::AbstractVector{Tuple{T, T}}) where {T <: Integer} = -x(map(z -> (ZZRingElem(z[1]), ZZRingElem(z[2])), y)) - -(x::AcbMatrixSpace)(y::AbstractMatrix{Tuple{Rational{T}, Rational{T}}}) where {T <: Integer} = -x(map(z -> (QQFieldElem(z[1]), QQFieldElem(z[2])), y)) - -(x::AcbMatrixSpace)(y::AbstractVector{Tuple{Rational{T}, Rational{T}}}) where {T <: Integer} = +(x::AcbMatrixSpace)(y::AbstractVecOrMat{Tuple{Rational{T}, Rational{T}}}) where {T <: Integer} = x(map(z -> (QQFieldElem(z[1]), QQFieldElem(z[2])), y)) for T in [Integer, ZZRingElem, QQFieldElem, Float64, BigFloat, ArbFieldElem, AcbFieldElem, String] diff --git a/src/arb/arb_mat.jl b/src/arb/arb_mat.jl index f6b4cb1d45..93ca811f2c 100644 --- a/src/arb/arb_mat.jl +++ b/src/arb/arb_mat.jl @@ -667,14 +667,7 @@ function (x::ArbMatrixSpace)(y::ZZMatrix) return z end -function (x::ArbMatrixSpace)(y::AbstractMatrix{T}) where {T <: Union{Int, UInt, ZZRingElem, QQFieldElem, Float64, BigFloat, ArbFieldElem, AbstractString}} - _check_dim(nrows(x), ncols(x), y) - z = ArbMatrix(nrows(x), ncols(x), y, precision(x)) - z.base_ring = x.base_ring - return z -end - -function (x::ArbMatrixSpace)(y::AbstractVector{T}) where {T <: Union{Int, UInt, ZZRingElem, QQFieldElem, Float64, BigFloat, ArbFieldElem, AbstractString}} +function (x::ArbMatrixSpace)(y::AbstractVecOrMat{T}) where {T <: Union{Int, UInt, ZZRingElem, QQFieldElem, Float64, BigFloat, ArbFieldElem, AbstractString}} _check_dim(nrows(x), ncols(x), y) z = ArbMatrix(nrows(x), ncols(x), y, precision(x)) z.base_ring = x.base_ring diff --git a/src/flint/fmpq_mat.jl b/src/flint/fmpq_mat.jl index dc1c543f87..4437bd26b1 100644 --- a/src/flint/fmpq_mat.jl +++ b/src/flint/fmpq_mat.jl @@ -727,50 +727,19 @@ function (a::QQMatrixSpace)() return z end -function (a::QQMatrixSpace)(arr::AbstractMatrix{QQFieldElem}) +function (a::QQMatrixSpace)(arr::AbstractVecOrMat{QQFieldElem}) _check_dim(nrows(a), ncols(a), arr) z = QQMatrix(nrows(a), ncols(a), arr) return z end -function (a::QQMatrixSpace)(arr::AbstractMatrix{ZZRingElem}) +function (a::QQMatrixSpace)(arr::AbstractVecOrMat{T}) where {T <: IntegerUnion} _check_dim(nrows(a), ncols(a), arr) z = QQMatrix(nrows(a), ncols(a), arr) return z end - -function (a::QQMatrixSpace)(arr::AbstractMatrix{T}) where {T <: Integer} - _check_dim(nrows(a), ncols(a), arr) - z = QQMatrix(nrows(a), ncols(a), arr) - return z -end - -function (a::QQMatrixSpace)(arr::AbstractMatrix{Rational{T}}) where {T <: Integer} - _check_dim(nrows(a), ncols(a), arr) - z = QQMatrix(nrows(a), ncols(a), map(QQFieldElem, arr)) - return z -end - -function (a::QQMatrixSpace)(arr::AbstractVector{QQFieldElem}) - _check_dim(nrows(a), ncols(a), arr) - z = QQMatrix(nrows(a), ncols(a), arr) - return z -end - -function (a::QQMatrixSpace)(arr::AbstractVector{ZZRingElem}) - _check_dim(nrows(a), ncols(a), arr) - z = QQMatrix(nrows(a), ncols(a), arr) - return z -end - -function (a::QQMatrixSpace)(arr::AbstractVector{T}) where {T <: Integer} - _check_dim(nrows(a), ncols(a), arr) - z = QQMatrix(nrows(a), ncols(a), arr) - return z -end - -function (a::QQMatrixSpace)(arr::AbstractVector{Rational{T}}) where {T <: Integer} +function (a::QQMatrixSpace)(arr::AbstractVecOrMat{<:Rational}) _check_dim(nrows(a), ncols(a), arr) z = QQMatrix(nrows(a), ncols(a), map(QQFieldElem, arr)) return z @@ -781,17 +750,7 @@ function (a::QQMatrixSpace)(d::QQFieldElem) return z end -function (a::QQMatrixSpace)(d::ZZRingElem) - z = QQMatrix(nrows(a), ncols(a), QQFieldElem(d)) - return z -end - -function (a::QQMatrixSpace)(d::Integer) - z = QQMatrix(nrows(a), ncols(a), QQFieldElem(d)) - return z -end - -(a::QQMatrixSpace)(d::Rational) = a(QQFieldElem(d)) +(a::QQMatrixSpace)(d::RationalUnion) = a(QQFieldElem(d)) function (a::QQMatrixSpace)(M::ZZMatrix) (ncols(a) == ncols(M) && nrows(a) == nrows(M)) || error("wrong matrix dimension") diff --git a/src/flint/fmpz_mat.jl b/src/flint/fmpz_mat.jl index d33663debf..07a811319c 100644 --- a/src/flint/fmpz_mat.jl +++ b/src/flint/fmpz_mat.jl @@ -1908,13 +1908,7 @@ function (a::ZZMatrixSpace)() return z end -function (a::ZZMatrixSpace)(arr::AbstractMatrix{T}) where {T <: IntegerUnion} - _check_dim(nrows(a), ncols(a), arr) - z = ZZMatrix(nrows(a), ncols(a), arr) - return z -end - -function (a::ZZMatrixSpace)(arr::AbstractVector{T}) where {T <: IntegerUnion} +function (a::ZZMatrixSpace)(arr::AbstractVecOrMat{T}) where {T <: IntegerUnion} _check_dim(nrows(a), ncols(a), arr) z = ZZMatrix(nrows(a), ncols(a), arr) return z diff --git a/src/flint/fmpz_mod_mat.jl b/src/flint/fmpz_mod_mat.jl index 54cd7abc34..f39ac6960d 100644 --- a/src/flint/fmpz_mod_mat.jl +++ b/src/flint/fmpz_mod_mat.jl @@ -638,57 +638,14 @@ function (a::ZZModMatrixSpace)() return z end -function (a::ZZModMatrixSpace)(arr::AbstractMatrix{BigInt}) +function (a::ZZModMatrixSpace)(arr::AbstractVecOrMat{<:IntegerUnion}) _check_dim(nrows(a), ncols(a), arr) z = ZZModMatrix(nrows(a), ncols(a), base_ring(a).ninv, arr) z.base_ring = a.base_ring return z end -function (a::ZZModMatrixSpace)(arr::AbstractVector{BigInt}) - _check_dim(nrows(a), ncols(a), arr) - z = ZZModMatrix(nrows(a), ncols(a), base_ring(a).ninv, arr) - z.base_ring = a.base_ring - return z -end - -function (a::ZZModMatrixSpace)(arr::AbstractMatrix{ZZRingElem}) - _check_dim(nrows(a), ncols(a), arr) - z = ZZModMatrix(nrows(a), ncols(a), base_ring(a).ninv, arr) - z.base_ring = a.base_ring - return z -end - -function (a::ZZModMatrixSpace)(arr::AbstractVector{ZZRingElem}) - _check_dim(nrows(a), ncols(a), arr) - z = ZZModMatrix(nrows(a), ncols(a), base_ring(a).ninv, arr) - z.base_ring = a.base_ring - return z -end - -function (a::ZZModMatrixSpace)(arr::AbstractMatrix{Int}) - _check_dim(nrows(a), ncols(a), arr) - z = ZZModMatrix(nrows(a), ncols(a), base_ring(a).ninv, arr) - z.base_ring = a.base_ring - return z -end - -function (a::ZZModMatrixSpace)(arr::AbstractVector{Int}) - _check_dim(nrows(a), ncols(a), arr) - z = ZZModMatrix(nrows(a), ncols(a), base_ring(a).ninv, arr) - z.base_ring = a.base_ring - return z -end - -function (a::ZZModMatrixSpace)(arr::AbstractMatrix{ZZModRingElem}) - _check_dim(nrows(a), ncols(a), arr) - (length(arr) > 0 && (base_ring(a) != parent(arr[1]))) && error("Elements must have same base ring") - z = ZZModMatrix(nrows(a), ncols(a), base_ring(a).ninv, arr) - z.base_ring = a.base_ring - return z -end - -function (a::ZZModMatrixSpace)(arr::AbstractVector{ZZModRingElem}) +function (a::ZZModMatrixSpace)(arr::AbstractVecOrMat{ZZModRingElem}) _check_dim(nrows(a), ncols(a), arr) (length(arr) > 0 && (base_ring(a) != parent(arr[1]))) && error("Elements must have same base ring") z = ZZModMatrix(nrows(a), ncols(a), base_ring(a).ninv, arr) diff --git a/src/flint/gfp_fmpz_mat.jl b/src/flint/gfp_fmpz_mat.jl index ddd660f370..5a3492503f 100644 --- a/src/flint/gfp_fmpz_mat.jl +++ b/src/flint/gfp_fmpz_mat.jl @@ -224,57 +224,14 @@ function (a::FpMatrixSpace)(b::FpFieldElem) return M end -function (a::FpMatrixSpace)(arr::AbstractMatrix{BigInt}) +function (a::FpMatrixSpace)(arr::AbstractVecOrMat{T}) where {T <: IntegerUnion} _check_dim(nrows(a), ncols(a), arr) z = FpMatrix(nrows(a), ncols(a), base_ring(a).ninv, arr) z.base_ring = a.base_ring return z end -function (a::FpMatrixSpace)(arr::AbstractVector{BigInt}) - _check_dim(nrows(a), ncols(a), arr) - z = FpMatrix(nrows(a), ncols(a), base_ring(a).ninv, arr) - z.base_ring = a.base_ring - return z -end - -function (a::FpMatrixSpace)(arr::AbstractMatrix{ZZRingElem}) - _check_dim(nrows(a), ncols(a), arr) - z = FpMatrix(nrows(a), ncols(a), base_ring(a).ninv, arr) - z.base_ring = a.base_ring - return z -end - -function (a::FpMatrixSpace)(arr::AbstractVector{ZZRingElem}) - _check_dim(nrows(a), ncols(a), arr) - z = FpMatrix(nrows(a), ncols(a), base_ring(a).ninv, arr) - z.base_ring = a.base_ring - return z -end - -function (a::FpMatrixSpace)(arr::AbstractMatrix{Int}) - _check_dim(nrows(a), ncols(a), arr) - z = FpMatrix(nrows(a), ncols(a), base_ring(a).ninv, arr) - z.base_ring = a.base_ring - return z -end - -function (a::FpMatrixSpace)(arr::AbstractVector{Int}) - _check_dim(nrows(a), ncols(a), arr) - z = FpMatrix(nrows(a), ncols(a), base_ring(a).ninv, arr) - z.base_ring = a.base_ring - return z -end - -function (a::FpMatrixSpace)(arr::AbstractMatrix{FpFieldElem}) - _check_dim(nrows(a), ncols(a), arr) - (length(arr) > 0 && (base_ring(a) != parent(arr[1]))) && error("Elements must have same base ring") - z = FpMatrix(nrows(a), ncols(a), base_ring(a).ninv, arr) - z.base_ring = a.base_ring - return z -end - -function (a::FpMatrixSpace)(arr::AbstractVector{FpFieldElem}) +function (a::FpMatrixSpace)(arr::AbstractVecOrMat{FpFieldElem}) _check_dim(nrows(a), ncols(a), arr) (length(arr) > 0 && (base_ring(a) != parent(arr[1]))) && error("Elements must have same base ring") z = FpMatrix(nrows(a), ncols(a), base_ring(a).ninv, arr) diff --git a/src/flint/gfp_mat.jl b/src/flint/gfp_mat.jl index 1ce0447e59..41c92d5a31 100644 --- a/src/flint/gfp_mat.jl +++ b/src/flint/gfp_mat.jl @@ -285,57 +285,14 @@ function (a::fpMatrixSpace)() return z end -function (a::fpMatrixSpace)(arr::AbstractMatrix{BigInt}) +function (a::fpMatrixSpace)(arr::AbstractVecOrMat{T}) where {T <: IntegerUnion} _check_dim(nrows(a), ncols(a), arr) z = fpMatrix(nrows(a), ncols(a), modulus(base_ring(a)), arr) z.base_ring = a.base_ring return z end -function (a::fpMatrixSpace)(arr::AbstractVector{BigInt}) - _check_dim(nrows(a), ncols(a), arr) - z = fpMatrix(nrows(a), ncols(a), modulus(base_ring(a)), arr) - z.base_ring = a.base_ring - return z -end - -function (a::fpMatrixSpace)(arr::AbstractMatrix{ZZRingElem}) - _check_dim(nrows(a), ncols(a), arr) - z = fpMatrix(nrows(a), ncols(a), modulus(base_ring(a)), arr) - z.base_ring = a.base_ring - return z -end - -function (a::fpMatrixSpace)(arr::AbstractVector{ZZRingElem}) - _check_dim(nrows(a), ncols(a), arr) - z = fpMatrix(nrows(a), ncols(a), modulus(base_ring(a)), arr) - z.base_ring = a.base_ring - return z -end - -function (a::fpMatrixSpace)(arr::AbstractMatrix{Int}) - _check_dim(nrows(a), ncols(a), arr) - z = fpMatrix(nrows(a), ncols(a), modulus(base_ring(a)), arr) - z.base_ring = a.base_ring - return z -end - -function (a::fpMatrixSpace)(arr::AbstractVector{Int}) - _check_dim(nrows(a), ncols(a), arr) - z = fpMatrix(nrows(a), ncols(a), modulus(base_ring(a)), arr) - z.base_ring = a.base_ring - return z -end - -function (a::fpMatrixSpace)(arr::AbstractMatrix{fpFieldElem}) - _check_dim(nrows(a), ncols(a), arr) - (length(arr) > 0 && (base_ring(a) != parent(arr[1]))) && error("Elements must have same base ring") - z = fpMatrix(nrows(a), ncols(a), modulus(base_ring(a)), arr) - z.base_ring = a.base_ring - return z -end - -function (a::fpMatrixSpace)(arr::AbstractVector{fpFieldElem}) +function (a::fpMatrixSpace)(arr::AbstractVecOrMat{fpFieldElem}) _check_dim(nrows(a), ncols(a), arr) (length(arr) > 0 && (base_ring(a) != parent(arr[1]))) && error("Elements must have same base ring") z = fpMatrix(nrows(a), ncols(a), modulus(base_ring(a)), arr) diff --git a/src/flint/nmod_mat.jl b/src/flint/nmod_mat.jl index 09f81b9917..f506fdc332 100644 --- a/src/flint/nmod_mat.jl +++ b/src/flint/nmod_mat.jl @@ -706,57 +706,14 @@ function (a::zzModMatrixSpace)() return z end -function (a::zzModMatrixSpace)(arr::AbstractMatrix{BigInt}) +function (a::zzModMatrixSpace)(arr::AbstractVecOrMat{T}) where {T <: IntegerUnion} _check_dim(nrows(a), ncols(a), arr) z = zzModMatrix(nrows(a), ncols(a), modulus(base_ring(a)), arr) z.base_ring = a.base_ring return z end -function (a::zzModMatrixSpace)(arr::AbstractVector{BigInt}) - _check_dim(nrows(a), ncols(a), arr) - z = zzModMatrix(nrows(a), ncols(a), modulus(base_ring(a)), arr) - z.base_ring = a.base_ring - return z -end - -function (a::zzModMatrixSpace)(arr::AbstractMatrix{ZZRingElem}) - _check_dim(nrows(a), ncols(a), arr) - z = zzModMatrix(nrows(a), ncols(a), modulus(base_ring(a)), arr) - z.base_ring = a.base_ring - return z -end - -function (a::zzModMatrixSpace)(arr::AbstractVector{ZZRingElem}) - _check_dim(nrows(a), ncols(a), arr) - z = zzModMatrix(nrows(a), ncols(a), modulus(base_ring(a)), arr) - z.base_ring = a.base_ring - return z -end - -function (a::zzModMatrixSpace)(arr::AbstractMatrix{Int}) - _check_dim(nrows(a), ncols(a), arr) - z = zzModMatrix(nrows(a), ncols(a), modulus(base_ring(a)), arr) - z.base_ring = a.base_ring - return z -end - -function (a::zzModMatrixSpace)(arr::AbstractVector{Int}) - _check_dim(nrows(a), ncols(a), arr) - z = zzModMatrix(nrows(a), ncols(a), modulus(base_ring(a)), arr) - z.base_ring = a.base_ring - return z -end - -function (a::zzModMatrixSpace)(arr::AbstractMatrix{zzModRingElem}) - _check_dim(nrows(a), ncols(a), arr) - (length(arr) > 0 && (base_ring(a) != parent(arr[1]))) && error("Elements must have same base ring") - z = zzModMatrix(nrows(a), ncols(a), modulus(base_ring(a)), arr) - z.base_ring = a.base_ring - return z -end - -function (a::zzModMatrixSpace)(arr::AbstractVector{zzModRingElem}) +function (a::zzModMatrixSpace)(arr::AbstractVecOrMat{zzModRingElem}) _check_dim(nrows(a), ncols(a), arr) (length(arr) > 0 && (base_ring(a) != parent(arr[1]))) && error("Elements must have same base ring") z = zzModMatrix(nrows(a), ncols(a), modulus(base_ring(a)), arr)