-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #163 from sumiya11/generic-coeffs
Generic coefficient type
- Loading branch information
Showing
30 changed files
with
501 additions
and
272 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,13 @@ | ||
Manifest.toml | ||
LocalPreferences.toml | ||
.vscode | ||
.benchmarkci | ||
|
||
# ignore coverage | ||
*.cov | ||
*.info | ||
*.png | ||
*.html | ||
*.css | ||
|
||
# ignore editor settings | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# This file is a part of Groebner.jl. License is GNU GPL v2. | ||
|
||
struct CoeffGeneric{T} | ||
data::T | ||
end | ||
|
||
generic_coeff_data(x) = x | ||
generic_coeff_data(x::CoeffGeneric) = x.data | ||
|
||
CoeffGeneric(x::CoeffGeneric{T}) where {T} = x | ||
CoeffGeneric{T}(x::CoeffGeneric{T}) where {T} = x | ||
|
||
Base.:+(x::CoeffGeneric, y::CoeffGeneric) = CoeffGeneric(x.data + y.data) | ||
Base.:-(x::CoeffGeneric, y::CoeffGeneric) = CoeffGeneric(x.data - y.data) | ||
Base.:*(x::CoeffGeneric, y::CoeffGeneric) = CoeffGeneric(x.data * y.data) | ||
Base.inv(x::CoeffGeneric) = CoeffGeneric(inv(x.data)) | ||
Base.:-(x::CoeffGeneric) = zero(x) - x | ||
|
||
Base.one(x::CoeffGeneric{T}) where {T} = CoeffGeneric{T}(one(x.data)) | ||
Base.zero(x::CoeffGeneric{T}) where {T} = CoeffGeneric{T}(zero(x.data)) | ||
|
||
Base.isone(x::CoeffGeneric) = isone(x.data) | ||
Base.iszero(x::CoeffGeneric) = iszero(x.data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.