def _paralleleval_dual_getExpandedExpr(args): i = args[0] nTerms = args[1] product = args[2] sumOfProducts = args[3] print ">> [MT] Evaluating expansion for " + str(i) + " of " + str( nTerms) + ", running deep copy." expandedSum = pt.Sum([]) if isinstance(product, pt.Product): for term in sumOfProducts.terms: if not isinstance(term, pt.Product) or pt.getDualProductAOrder( product, term) <= 6: p = pt.Product([product, term]) p.reduceTree() p = p.getExpandedExpr() expandedSum.addTerm(p) else: for term in sumOfProducts.terms: p = pt.Product([product, term]) p.reduceTree() p = p.getExpandedExpr() expandedSum.addTerm(p) expandedSum = expandedSum.getExpandedExpr() return expandedSum
def tZ05(): Mup = pt.MatrixM( False, "up" ) Mdn = pt.MatrixM( False, "dn" ) A = pt.Product( [pt.CoefficientFloat( 1.0 ), pt.TermA(), pt.DetM( Mup ), pt.DetM( Mdn )] ) B = pt.Product( [pt.CoefficientFloat( 2.0 ), pt.TermA(), pt.TermA(), pt.DetM( Mup ), pt.DetM( Mdn )] ) C = pt.areTermsCommon(A, B) return str( C )
def tZ07(): Mup = pt.MatrixM( False, "up" ) Mdn = pt.MatrixM( False, "dn" ) Dup = pt.MatrixK( "up" ) Dup.fourierTransform() Ddn = pt.MatrixK( "dn" ) Ddn.fourierTransform() A = pt.Product( [pt.CoefficientFloat( 1.0 ), pt.TermA(), pt.DetM( Mup ), pt.DetM( Mdn ), Ddn, Dup ] ) B = pt.Product( [pt.CoefficientFloat( 2.0 ), pt.TermA(), pt.DetM( Mup ), pt.DetM( Mdn ), Dup, Ddn ] ) C = pt.areTermsCommon(A, B) return str( C )
def tZ08(): Mup = pt.MatrixM( False, "up" ) Mdn = pt.MatrixM( False, "dn" ) Dup = pt.MatrixK( "up" ) Dup.fourierTransform() Ddn = pt.MatrixK( "dn" ) Ddn.fourierTransform() F1 = pt.FourierSum( [0,1,0,1], 4 ) F2 = pt.FourierSum( [0,0,1,1], 4 ) A = pt.Product( [pt.CoefficientFloat( 1.0 ), pt.TermA(), pt.DetM( Mup ), pt.DetM( Mdn ), Ddn, Dup, F1 ] ) B = pt.Product( [pt.CoefficientFloat( 2.0 ), pt.TermA(), pt.DetM( Mup ), pt.DetM( Mdn ), Dup, Ddn, F2 ] ) C = pt.areTermsCommon(A, B) return str( C )
def tY01(): Mup = pt.MatrixM( False, "up" ) Mdn = pt.MatrixM( False, "dn" ) Dup = pt.MatrixK( "up" ) Dup.fourierTransform() Dup.indices = 0 Ddn = pt.MatrixK( "dn" ) Ddn.fourierTransform() Ddn.indices = 0 A = pt.Product( [pt.CoefficientFloat( 1.0 ), pt.TermA(), pt.DetM( Mup ), pt.DetM( Mdn ), Ddn, Dup ] ) B = pt.Product( [pt.CoefficientFloat( 2.0 ), pt.TermA(), pt.DetM( Mup ), pt.DetM( Mdn ), Dup, Ddn ] ) C = pt.Sum( [ A, B ] ) D = pt.combineLikeTerms( C ) D.simplify() return str( D )
def tY04(): Mup = pt.MatrixM( False, "up" ) Mdn = pt.MatrixM( False, "dn" ) Dup = pt.MatrixK( "up" ) Dup.fourierTransform() Dup.indices = 0 Ddn = pt.MatrixK( "dn" ) Ddn.fourierTransform() Ddn.indices = 0 A1 = pt.Product( [pt.CoefficientFloat( 1.0 ), pt.TermA(), pt.DetM( Mup ), pt.DetM( Mdn ), Ddn, Dup ] ) A2 = pt.Product( [pt.CoefficientFloat( 9.0 ), pt.TermA(), pt.DetM( Mup ), pt.DetM( Mdn ), Dup, Dup ] ) A3 = pt.Product( [pt.CoefficientFloat( 2.0 ), pt.TermA(), pt.DetM( Mup ), pt.DetM( Mdn ), Dup, Ddn ] ) A4 = pt.Product( [pt.CoefficientFloat( 5.0 ), pt.TermA(), pt.DetM( Mup ), pt.DetM( Mdn ), Dup, Dup ] ) D = pt.Sum( [ A3, A2, A4, A1 ] ) E = pt.combineLikeTerms( D ) E.simplify() return str( E )
D2dn.setAsNoninteracting() D3up.setAsNoninteracting() D3dn.setAsNoninteracting() D4up.setAsNoninteracting() D4dn.setAsNoninteracting() # D5up.setAsNoninteracting() # D5dn.setAsNoninteracting() # D6up.setAsNoninteracting() # D6dn.setAsNoninteracting() # D7up.setAsNoninteracting() # D7dn.setAsNoninteracting() # D8up.setAsNoninteracting() # D8dn.setAsNoninteracting() print "Calculating spin-up partition function..." Zup = pt.Sum([detMup, pt.Product([ pt.TermA(), D1up ]), pt.Product([ pt.TermA(), pt.TermA(), pt.CoefficientFraction(1,2), D2up ]) , \ pt.Product([pt.TermA(), pt.TermA(), pt.TermA(), pt.CoefficientFraction(1,6), D3up]), \ pt.Product([pt.TermA(), pt.TermA(), pt.TermA(), pt.TermA(), pt.CoefficientFraction(1,24), D4up])])#, \ #pt.Product([pt.TermA(), pt.TermA(), pt.TermA(), pt.TermA(), pt.TermA(), pt.CoefficientFraction(1,120), D5up]), \ #pt.Product([pt.TermA(), pt.TermA(), pt.TermA(), pt.TermA(), pt.TermA(), pt.TermA(), pt.CoefficientFraction(1,720), D6up]), \ #pt.Product([pt.TermA(), pt.TermA(), pt.TermA(), pt.TermA(), pt.TermA(), pt.TermA(), pt.TermA(), pt.CoefficientFraction(1,5040), D7up]), #pt.Product([pt.TermA(), pt.TermA(), pt.TermA(), pt.TermA(), pt.TermA(), pt.TermA(), pt.TermA(), pt.TermA(), pt.CoefficientFraction(1,40320), D8up]) ]) Zup = Zup.getExpandedExpr() Zup.reduceTree() print "Calculating spin-down partition function..." Zdn = pt.Sum([detMdn, pt.Product([ pt.TermA(), D1dn ]), pt.Product([ pt.TermA(), pt.TermA(), pt.CoefficientFraction(1,2), D2dn ]), \ pt.Product([pt.TermA(), pt.TermA(), pt.TermA(), pt.CoefficientFraction(1,6), D3dn]), \ pt.Product([pt.TermA(), pt.TermA(), pt.TermA(), pt.TermA(), pt.CoefficientFraction(1,24), D4dn])])#, \ #pt.Product([pt.TermA(), pt.TermA(), pt.TermA(), pt.TermA(), pt.TermA(), pt.CoefficientFraction(1,120), D5dn]), \
def tZ02(): Mup = pt.MatrixM( False, "up" ) Mdn = pt.MatrixM( False, "dn" ) A = pt.Product( [pt.TermA(), pt.DetM( Mup ), pt.DetM( Mdn )] ) B = pt.areTermsCommon(A, A) return str( B )