81
81
# # Scalar product
82
82
# ##############################################################################
83
83
84
- function * (c:: QQFieldElem , Sigma:: PolyhedralComplex )
84
+ function * (c:: scalar_types_extended , Sigma:: PolyhedralComplex )
85
85
# if scalar is zero, return polyhedral complex consisting only of the origin
86
86
if iszero (c)
87
87
return polyhedral_complex (convex_hull (zero_matrix (QQ,1 ,ambient_dim (Sigma))))
@@ -92,10 +92,9 @@ function *(c::QQFieldElem, Sigma::PolyhedralComplex)
92
92
SigmaRayIndices = findall (vr -> vr isa RayVector, SigmaVertsAndRays)
93
93
SigmaLineality = lineality_space (Sigma)
94
94
SigmaIncidence = maximal_polyhedra (IncidenceMatrix,Sigma)
95
- return polyhedral_complex (SigmaIncidence, multiply_by_nonzero_scalar .( SigmaVertsAndRays,c) , SigmaRayIndices, SigmaLineality)
95
+ return polyhedral_complex (coefficient_field (Sigma), SigmaIncidence, SigmaVertsAndRays .* c , SigmaRayIndices, SigmaLineality)
96
96
end
97
- * (c:: RationalUnion , Sigma:: PolyhedralComplex ) = QQ (c)* Sigma
98
- * (Sigma:: PolyhedralComplex , c:: RationalUnion ) = c* Sigma
97
+ * (Sigma:: PolyhedralComplex , c:: scalar_types_extended ) = c* Sigma
99
98
100
99
101
100
# ##############################################################################
@@ -114,27 +113,23 @@ end
114
113
# # Translation
115
114
# ##############################################################################
116
115
117
- function translate_by_vector (u:: PointVector{QQFieldElem} , v:: Vector{QQFieldElem} )
118
- return u .+ v
116
+ # requires separate function because to ensure that translation does not change ray vectors
117
+ function translate_by_vector (u:: PointVector{<:scalar_types_extended} , v:: Vector{<:scalar_types_extended} )
118
+ return u + v
119
119
end
120
- function translate_by_vector (u:: RayVector{QQFieldElem } , :: Vector{QQFieldElem } )
120
+ function translate_by_vector (u:: RayVector{<:scalar_types_extended } , :: Vector{<:scalar_types_extended } )
121
121
return u
122
122
end
123
- function + (v:: Vector{QQFieldElem } , Sigma:: PolyhedralComplex )
123
+ function + (v:: Vector{<:scalar_types_extended } , Sigma:: PolyhedralComplex )
124
124
@req length (v)== ambient_dim (Sigma) " ambient dimension mismatch"
125
125
SigmaVertsAndRays = vertices_and_rays (Sigma)
126
126
SigmaRayIndices = findall (vr -> vr isa RayVector, SigmaVertsAndRays)
127
127
SigmaLineality = lineality_space (Sigma)
128
128
SigmaIncidence = maximal_polyhedra (IncidenceMatrix,Sigma)
129
- return polyhedral_complex (SigmaIncidence, translate_by_vector .(SigmaVertsAndRays,Ref (v)), SigmaRayIndices, SigmaLineality)
129
+ return polyhedral_complex (coefficient_field (Sigma), SigmaIncidence, translate_by_vector .(SigmaVertsAndRays,Ref (v)), SigmaRayIndices, SigmaLineality)
130
130
end
131
- + (v:: Vector{ZZRingElem} , Sigma:: PolyhedralComplex ) = QQ .(v)+ Sigma
132
- + (v:: Vector{Rational} , Sigma:: PolyhedralComplex ) = QQ .(v)+ Sigma
133
- + (v:: Vector{Int} , Sigma:: PolyhedralComplex ) = QQ .(v)+ Sigma
134
-
135
- + (Sigma:: PolyhedralComplex , v:: Vector{QQFieldElem} ) = v+ Sigma
136
- + (Sigma:: PolyhedralComplex , v:: Vector{<:RationalUnion} ) = QQ .(v)+ Sigma
131
+ + (Sigma:: PolyhedralComplex , v:: Vector{<:scalar_types_extended} ) = v+ Sigma
137
132
138
133
# Vector addition for polyhedral fans
139
- + (Sigma:: PolyhedralFan , v:: Vector ) = polyhedral_complex (Sigma)+ v
140
- + (v:: Vector , Sigma:: PolyhedralFan ) = v+ polyhedral_complex (Sigma)
134
+ + (Sigma:: PolyhedralFan , v:: Vector{<:scalar_types_extended} ) = polyhedral_complex (Sigma)+ v
135
+ + (v:: Vector{<:scalar_types_extended} , Sigma:: PolyhedralFan ) = v+ polyhedral_complex (Sigma)
0 commit comments