Skip to content

Commit

Permalink
nrows
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens committed Jan 18, 2024
1 parent 2ef721e commit cd86e74
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 20 deletions.
6 changes: 3 additions & 3 deletions docs/src/matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -395,12 +395,12 @@ dense_matrix_type(::Ring)
```

```@docs
nrows(::MatSpace)
number_of_rows(::MatSpace)
number_of_columns(::MatSpace)
```

```@docs
nrows(::MatrixElem{T}) where T <: RingElement
number_of_rows(::MatrixElem{T}) where T <: RingElement
number_of_columns(::MatrixElem{T}) where T <: RingElement
```

Expand Down Expand Up @@ -501,7 +501,7 @@ julia> B = S([R(2) R(3) R(1); t t + 1 t + 2; R(-1) t^2 t^3])
julia> T = dense_matrix_type(R)
AbstractAlgebra.Generic.MatSpaceElem{AbstractAlgebra.Generic.Poly{Rational{BigInt}}}
julia> r = nrows(B)
julia> r = number_of_rows(B)
3
julia> c = number_of_columns(B)
Expand Down
6 changes: 3 additions & 3 deletions docs/src/matrix_interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ E.g. in Nemo, which depends on AbstractAlgebra, we define
`dense_matrix_type(::Type{ZZRingElem}) = ZZMatrix`.

```julia
nrows(M::MyMatSpace{T}) where T <: RingElem
nrows(M::MyMatAlgebra{T}) where T <: RingElem
number_of_rows(M::MyMatSpace{T}) where T <: RingElem
number_of_rows(M::MyMatAlgebra{T}) where T <: RingElem
```

Return the number of rows of matrices in the matrix space.
Expand All @@ -184,7 +184,7 @@ number_of_columns(M:MyMatAlgebra{T}) where T <: RingElem
Return the number of columns of matrices in the matrix space.

```julia
nrows(f::MyMat{T}) where T <: RingElem
number_of_rows(f::MyMat{T}) where T <: RingElem
```

Return the number of rows of the given matrix.
Expand Down
4 changes: 3 additions & 1 deletion src/AbstractAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,13 @@ const is_upper_triangular = istriu
function number_of_columns end
const number_of_generators = GroupsCore.ngens # replace once GroupsCore is excised
#function number_of_generators end
function number_of_rows end
export number_of_columns
export number_of_generators
export number_of_rows
@alias ncols number_of_columns
@alias ngens number_of_generators
@alias nrows number_of_rows

###############################################################################
# Macros for fancy printing. to use, enable attribute storage for your struct,
Expand Down Expand Up @@ -1043,7 +1046,6 @@ export newton_to_monomial!
export norm
export normal_form
export normalise
export nrows
export nullspace
export num_coeff
export number_field
Expand Down
2 changes: 1 addition & 1 deletion src/Generic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ import ..AbstractAlgebra: number_of_digits
import ..AbstractAlgebra: number_of_generators
import ..AbstractAlgebra: NCRing
import ..AbstractAlgebra: NCRingElem
import ..AbstractAlgebra: nrows
import ..AbstractAlgebra: number_of_rows
import ..AbstractAlgebra: numerator
import ..AbstractAlgebra: nvars
import ..AbstractAlgebra: O
Expand Down
10 changes: 5 additions & 5 deletions src/Matrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ check_square(S::MatAlgebra) = S
###############################################################################

@doc raw"""
nrows(a::MatSpace)
number_of_rows(a::MatSpace)
Return the number of rows of the given matrix space.
"""
nrows(a::MatSpace) = a.nrows
number_of_rows(a::MatSpace) = a.nrows

@doc raw"""
number_of_columns(a::MatSpace)
Expand All @@ -114,11 +114,11 @@ function Base.hash(a::MatElem, h::UInt)
end

@doc raw"""
nrows(a::MatrixElem{T}) where T <: NCRingElement
number_of_rows(a::MatrixElem{T}) where T <: NCRingElement
Return the number of rows of the given matrix.
"""
nrows(a::MatrixElem{T}) where T <: NCRingElement
number_of_rows(a::MatrixElem{T}) where T <: NCRingElement

@doc raw"""
number_of_columns(a::MatrixElem{T}) where T <: NCRingElement
Expand Down Expand Up @@ -373,7 +373,7 @@ the submatrix $A$ of $M$ defined by `A[i,j] = M[rows[i], cols[j]]`
for `i=1,...,length(rows)` and `j=1,...,length(cols)`.
Instead of a vector, `rows` and `cols` can also be:
* an integer `i`, which is interpreted as `i:i`, or
* `:`, which is interpreted as `1:nrows(M)` or `1:ncols(M)` respectively.
* `:`, which is interpreted as `1:number_of_rows(M)` or `1:number_of_columns(M)` respectively.
"""
function getindex(M::MatElem, rows::AbstractVector{Int}, cols::AbstractVector{Int})
_checkbounds(M, rows, cols)
Expand Down
4 changes: 2 additions & 2 deletions src/MatrixAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ function Base.hash(a::MatAlgElem, h::UInt)
return b
end

nrows(a::MatAlgebra) = a.n
number_of_columns(a::MatAlgebra) = nrows(a)
number_of_rows(a::MatAlgebra) = a.n
number_of_columns(a::MatAlgebra) = number_of_rows(a)

@doc raw"""
degree(a::MatAlgebra)
Expand Down
6 changes: 3 additions & 3 deletions src/generic/Matrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ dense_matrix_type(::Type{T}) where T <: NCRingElement = MatSpaceElem{T}
###############################################################################

@doc raw"""
nrows(a::MatSpace)
number_of_rows(a::MatSpace)
Return the number of rows of the given matrix space.
"""
nrows(a::MatSpace) = a.nrows
number_of_rows(a::MatSpace) = a.nrows

@doc raw"""
number_of_columns(a::MatSpace)
Expand All @@ -57,7 +57,7 @@ Return the number of columns of the given matrix space.
"""
number_of_columns(a::MatSpace) = a.ncols

nrows(a::Union{Mat, MatAlgElem}) = size(a.entries, 1)
number_of_rows(a::Union{Mat, MatAlgElem}) = size(a.entries, 1)

number_of_columns(a::Union{Mat,MatAlgElem}) = size(a.entries, 2)

Expand Down
2 changes: 1 addition & 1 deletion src/julia/Matrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
###############################################################################

nrows(A::Matrix{T}) where {T} = size(A)[1]
number_of_rows(A::Matrix{T}) where {T} = size(A)[1]
number_of_columns(A::Matrix{T}) where {T} = size(A)[2]

function is_zero_row(M::Matrix, i::Int)
Expand Down
2 changes: 1 addition & 1 deletion test/generic/Matrix-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ AbstractAlgebra.dense_matrix_type(::Type{F2}) = F2Matrix
AbstractAlgebra.parent(a::F2Matrix) = F2MatSpace(nrows(a), ncols(a))
AbstractAlgebra.matrix_space(::F2, r::Int, c::Int) = F2MatSpace(r, c)

AbstractAlgebra.nrows(a::F2Matrix) = nrows(a.m)
AbstractAlgebra.number_of_rows(a::F2Matrix) = nrows(a.m)
AbstractAlgebra.number_of_columns(a::F2Matrix) = ncols(a.m)
AbstractAlgebra.base_ring(::F2Matrix) = F2()

Expand Down

0 comments on commit cd86e74

Please sign in to comment.