File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -828,6 +828,38 @@ function fraction_field(F::Field; cached::Bool=true)
828
828
return F
829
829
end
830
830
831
+
832
+ @doc raw """
833
+ fraction_field_type(a)
834
+
835
+ Return the type of the base ring of the given element, element type, parent or parent type $a$.
836
+
837
+ # Examples
838
+ ```jldoctest
839
+ julia> R, x = polynomial_ring(ZZ, :x)
840
+ (Univariate polynomial ring in x over integers, x)
841
+
842
+ julia> fraction_field_type(R) == typeof(base_ring(R))
843
+ true
844
+
845
+ julia> fraction_field_type(zero(R)) == typeof(base_ring(zero(R)))
846
+ true
847
+
848
+ julia> fraction_field_type(typeof(R)) == typeof(base_ring(R))
849
+ true
850
+
851
+ julia> fraction_field_type(typeof(zero(R))) == typeof(base_ring(zero(R)))
852
+ true
853
+ ```
854
+ """
855
+ fraction_field_type (x) = fraction_field_type (typeof (x))
856
+ fraction_field_type (x:: Type{<:RingElement} ) = fraction_field_type (parent_type (x))
857
+ fraction_field_type (T:: DataType ) = throw (MethodError (fraction_field_type, (T,)))
858
+
859
+ fraction_field_type (:: Type{T} ) where {T <: Field } = T
860
+ fraction_field_type (:: Type{T} ) where {T <: Ring } = AbstractAlgebra. Generic. FracField{elem_type (T)}
861
+
862
+
831
863
@doc raw """
832
864
factored_fraction_field(R::Ring; cached::Bool=true)
833
865
Original file line number Diff line number Diff line change @@ -227,6 +227,7 @@ export find_pivot_popov
227
227
export finish
228
228
export fit!
229
229
export fraction_field
230
+ export fraction_field_type
230
231
export free_associative_algebra
231
232
export free_associative_algebra_type
232
233
export free_module
You can’t perform that action at this time.
0 commit comments