Skip to content

Commit

Permalink
Merge pull request #2798 from oscar-system/lk/docs/solve_mixed
Browse files Browse the repository at this point in the history
  • Loading branch information
lkastner authored Sep 14, 2023
2 parents ebee98c + 35b3545 commit 92bf5cb
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions src/PolyhedralGeometry/solving_integrally.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ end
Solve $Ax = b$ under $Cx >= d$, assumes a finite solution set.
The output type may be specified in the variable `as`:
- `ZZMatrix` (default) a matrix with integers is returned.
- `SubObjectIterator{PointVector{ZZRingElem}}` an iterator over integer points is returned.
- `ZZMatrix` (default) a matrix with integers is returned. The solutions are
the (transposed) rows of the output.
- `SubObjectIterator{PointVector{ZZRingElem}}` an iterator over integer points
is returned.
# Examples
Find all $(x_1, x_2)\in\mathbb{Z}^2$ such that $x_1+x_2=7$, $x_1\ge 2$, and $x_2\ge 3$.
The solutions are the rows of the output.
Note that the output can be permuted, hence we sort it.
```jldoctest
julia> A = ZZMatrix([1 1]);
Expand All @@ -48,8 +49,15 @@ ZZMatrix
julia> typeof(solve_mixed(ZZMatrix, A, b, C, d))
ZZMatrix
julia> typeof(solve_mixed(SubObjectIterator{PointVector{ZZRingElem}}, A, b, C, d))
julia> it = solve_mixed(SubObjectIterator{PointVector{ZZRingElem}}, A, b, C);
julia> typeof(it)
SubObjectIterator{PointVector{ZZRingElem}}
julia> for x in it
print(A*x," ")
end
ZZRingElem[7] ZZRingElem[7] ZZRingElem[7] ZZRingElem[7] ZZRingElem[7] ZZRingElem[7] ZZRingElem[7] ZZRingElem[7]
```
"""
solve_mixed(as::Type{T}, A::ZZMatrix, b::ZZMatrix, C::ZZMatrix, d::ZZMatrix) where {T} = solve_mixed(T, A, b, C, d)
Expand All @@ -62,12 +70,13 @@ solve_mixed(A::ZZMatrix, b::ZZMatrix, C::ZZMatrix, d::ZZMatrix) = solve_mixed(ZZ
Solve $Ax = b$ under $Cx >= 0$, assumes a finite solution set.
The output type may be specified in the variable `as`:
- `ZZMatrix` (default) a matrix with integers is returned.
- `SubObjectIterator{PointVector{ZZRingElem}}` an iterator over integer points is returned.
- `ZZMatrix` (default) a matrix with integers is returned. The solutions are
the (transposed) rows of the output.
- `SubObjectIterator{PointVector{ZZRingElem}}` an iterator over integer points
is returned.
# Examples
Find all $(x_1, x_2)\in\mathbb{Z}^2_{\ge 0}$ such that $x_1+x_2=3$.
The solutions are the rows of the output.
Note that the output can be permuted, hence we sort it.
```jldoctest
julia> A = ZZMatrix([1 1]);
Expand All @@ -89,8 +98,15 @@ ZZMatrix
julia> typeof(solve_mixed(ZZMatrix, A, b, C))
ZZMatrix
julia> typeof(solve_mixed(SubObjectIterator{PointVector{ZZRingElem}}, A, b, C))
julia> it = solve_mixed(SubObjectIterator{PointVector{ZZRingElem}}, A, b, C);
julia> typeof(it)
SubObjectIterator{PointVector{ZZRingElem}}
julia> for x in it
print(A*x," ")
end
ZZRingElem[3] ZZRingElem[3] ZZRingElem[3] ZZRingElem[3]
```
"""
solve_mixed(as::Type{T}, A::ZZMatrix, b::ZZMatrix, C::ZZMatrix) where {T} = solve_mixed(T, A, b, C, zero_matrix(FlintZZ, nrows(C), 1))
Expand Down

0 comments on commit 92bf5cb

Please sign in to comment.