R2 = iegenlib.Relation("{[i,j]->[ip,jp]: ip=f(i) and jp=2j}") print "R2 = ", R2 R3 = iegenlib.Relation("{[q,r]->[i,j]: i=q and j=r}") print "R3 = ", R3 R3 = R3.Compose(R2) # Compose operation # print "R3 = ", R3 R2 = R2.Inverse() # Inverse operation # print "R2 = ", R2 # Some examples that use function inverse declarations. iegenlib.appendCurrEnv("f() = inverse f_inv()") S5 = iegenlib.Set("{[i,j]:i=f(f_inv(j))}") print "S5 = ", S5 R4 = iegenlib.Relation("{[i,j]->[ip,j]: ip=f(i)}") print "R4 = ", R4 S6 = R4.Apply(S5) print "S6 = ", S6 # The user can obtain dot files for SparseConstraints objects of sets/relations # from the IEGenlib Python Interface by using toDotString() methods. Python # methods open(filename, mode) and write(item) can be used to open and write to # the output file, as in the following examples:
print "S4 = ", S4 R2 = iegenlib.Relation("{[i,j]->[ip,jp]: ip=f(i) and jp=2j}") print "R2 = ", R2 R3 = iegenlib.Relation("{[q,r]->[i,j]: i=q and j=r}") print "R3 = ", R3 R3 = R3.Compose(R2) # Compose operation # print "R3 = ", R3 R2 = R2.Inverse() # Inverse operation # print "R2 = ", R2 # Some examples that use function inverse declarations. iegenlib.appendCurrEnv("f() = inverse f_inv()") S5 = iegenlib.Set("{[i,j]:i=f(f_inv(j))}") print "S5 = ", S5 R4 = iegenlib.Relation("{[i,j]->[ip,j]: ip=f(i)}") print "R4 = ", R4 S6 = R4.Apply(S5) print "S6 = ", S6 # The user can obtain dot files for SparseConstraints objects of sets/relations # from the IEGenlib Python Interface by using toDotString() methods. Python # methods open(filename, mode) and write(item) can be used to open and write to # the output file, as in the following examples:
# A8, access relation for S3, targets data array x print print "==== A8, access relation for S3" a8 = Relation("{[s,i]->[k]: k=inter2(i)}") print a8 print "Modified a8, or a8_0" a8_0 = a8.Compose(S3_sched.Inverse()) print a8_0 #### DataPermuteTrans print print "==== DataPermuteTrans" # transformation specification print iegenlib.appendCurrEnv("sigma() = inverse sigma_inv()") R_x0_x1 = Relation("{[k] -> [j] : j = sigma(k)}") print "data reordering specification: (R_x0_x1) = ", R_x0_x1 # straight-forward specification of input to cpack print print "UFS specification for sigma" cpack_in = Relation( "{[ii] -> [p] : p=inter1(ii) } union {[ii] -> [p] : p=inter2(ii) }") print " input to cpack: \n cpack_in = ", cpack_in # FIXME: Here, we are projecting out variables with the composition # but we do not have two functions or two function inverses. # BUT in the paper we were just providing these. ## more involved computation of input to cpack that does ## some testing of the union, inverse, and compose operations
print print "==== A8, access relation for S3" a8 = Relation("{[s,i]->[k]: k=inter2(i)}") print a8 print "Modified a8, or a8_0" a8_0 = a8.Compose(S3_sched.Inverse()) print a8_0 #### DataPermuteTrans print print "==== DataPermuteTrans" # transformation specification print iegenlib.appendCurrEnv("sigma() = inverse sigma_inv()"); R_x0_x1 = Relation("{[k] -> [j] : j = sigma(k)}") print "data reordering specification: (R_x0_x1) = ", R_x0_x1 # straight-forward specification of input to cpack print print "UFS specification for sigma" cpack_in = Relation("{[ii] -> [p] : p=inter1(ii) } union {[ii] -> [p] : p=inter2(ii) }") print " input to cpack: \n cpack_in = ", cpack_in # FIXME: Here, we are projecting out variables with the composition # but we do not have two functions or two function inverses. # BUT in the paper we were just providing these. ## more involved computation of input to cpack that does ## some testing of the union, inverse, and compose operations