/usr/share/axiom-20170501/src/algebra/SHDP.spad is in axiom-source 20170501-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | )abbrev domain SHDP SplitHomogeneousDirectProduct
++ Author: Mark Botch
++ Description:
++ This type represents the finite direct or cartesian product of an
++ underlying ordered component type. The vectors are ordered as if
++ they were split into two blocks. The dim1 parameter specifies the
++ length of the first block. The ordering is lexicographic between
++ the blocks but acts like \spadtype{HomogeneousDirectProduct}
++ within each block. This type is a suitable third argument for
++ \spadtype{GeneralDistributedMultivariatePolynomial}.
SplitHomogeneousDirectProduct(dimtot,dim1,S) : SIG == CODE where
NNI ==> NonNegativeInteger
dim1 : NNI
dimtot : NNI
S : OrderedAbelianMonoidSup
SIG ==> DirectProductCategory(dimtot,S)
CODE ==> DirectProduct(dimtot,S) add
Rep:=Vector(S)
lessThanRlex(v1:%,v2:%,low:NNI,high:NNI):Boolean ==
-- reverse lexicographical ordering
n1:S:=0
n2:S:=0
for i in low..high repeat
n1:= n1+qelt(v1,i)
n2:=n2+qelt(v2,i)
n1<n2 => true
n2<n1 => false
for i in reverse(low..high) repeat
if qelt(v2,i) < qelt(v1,i) then return true
if qelt(v1,i) < qelt(v2,i) then return false
false
(v1:% < v2:%):Boolean ==
lessThanRlex(v1,v2,1,dim1) => true
for i in 1..dim1 repeat
if qelt(v1,i) ^= qelt(v2,i) then return false
lessThanRlex(v1,v2,dim1+1,dimtot)
|