All Downloads are FREE. Search and download functionalities are using the official Maven repository.

Lib.Krakatau.ssa.variablegraph.pyc Maven / Gradle / Ivy

There is a newer version: 1.1
Show newest version
?
?HRc@sddlZddlZddlmZmZddlmZdefd??YZd?Z	d	?Z
d
?Zdd?ZdS(
i????Ni(tjointmeeti(t
graph_utiltBaseNodecBs&eZed?Zd?Zd?ZRS(cCsf|dk	st?g|_g|_||_d|_|_||_||_t	|_
d|_dS(Ni(tNonetAssertionErrortsourcestusestprocesstiterstupIterstpropagateInvalidt
filterNonetFalset	upInvalidtroot(tselftprocessfunctisphiR((sA/home/alex/projects/github/krakatau/Krakatau/ssa/variablegraph.pyt__init__s			
		cCs?|jr+d|kr+dt|j?}n?|jr\g|D]}|dk	r;|^q;}n|j|?}t|j?t|?ks?t?td?t|j|?D??}|S(Ncss$|]\}}t||?VqdS(N(R(t.0toldvtnewv((sA/home/alex/projects/github/krakatau/Krakatau/ssa/variablegraph.pys	s(N(	RRtlentoutputRRRttupletzip(Rtinputstnewtx((sA/home/alex/projects/github/krakatau/Krakatau/ssa/variablegraph.pyt
_propagates	(!"cCsI|js%|j|jks!t?tSt}|j|kr?|jg|jD]\}}|j|^qJ?}||jkr?||_|jd7_t}q?n|j|krEt|_	|jg|jD]\}}|j|^q??}||jkrE||_|j|sdnd7_t}x|j
D]}t|_	q,WqEn|S(Nii(RRtupOutputRR
R	RtTrueR
RR(Rt	iterlimittchangedtnodetkeyR((sA/home/alex/projects/github/krakatau/Krakatau/ssa/variablegraph.pytupdate s(	2		2	(t__name__t
__module__R RRR%(((sA/home/alex/projects/github/krakatau/Krakatau/ssa/variablegraph.pyRs
	cCs+x$|D]\}}|jj|?qWdS(N(Rtappend(tuseRR#tindex((sA/home/alex/projects/github/krakatau/Krakatau/ssa/variablegraph.pytregisterUses:sc	Cs8|||f|kr&||||fS|j}||jkr(t|d?r(t|j|?t?}g|jD]}||?df^qo|_t||j?td?|jD??|_	dt|j	?|_||_
x6t|j?D]%\}}||f||||fIs(N(tjumptparamsthasattrRR,R
RR+RRRRRRt	enumerate(	tpairtsourcetvart
getVarNodet
jumplookupR.tntparamti((sA/home/alex/projects/github/krakatau/Krakatau/ssa/variablegraph.pytgetJumpNode>s	+	c	Cs?tj?}i}tjjd?|D??}tjjd?|D??}tjjd?|D??}d?}d?}xB|D]:\}	}
t|t?}|
f|_|||	<|	|_qWx?|D]?}t|t	?}|j
}
xQ|
jD]F\}}|jj
t|
|f||j||f?|j|??q?Wt||j?||j}|jdf|_d
|_|dfg|_|jj
|?||_q?WxJ|D]B}t|d?rt|jt?}g|jD]}	||	df^q?|_t||j?ntdt?}g}x|t|j??D]h\}}	|	dkrX|j
d?q0||	}|j
|jd?|jj
|?||fg|_q0Wt|?|_|jr?dn|j|_||_t|?d	ks?t?q?W|j?}x6|D].}|js|jndt|j?|_q?Wx?|D]x}|jr|x3t|j?dD]}||jksZt?qZWnx0|jD]%}|t|j?dks?t?q?Wq7W|S(
Ncss|]}|jj?VqdS(N(tunaryConstraintstitems(Rtblock((sA/home/alex/projects/github/krakatau/Krakatau/ssa/variablegraph.pys	Wscss|]}|jVqdS(N(tphis(RR=((sA/home/alex/projects/github/krakatau/Krakatau/ssa/variablegraph.pys	Xscss|]}|jVqdS(N(tlines(RR=((sA/home/alex/projects/github/krakatau/Krakatau/ssa/variablegraph.pys	YscWs|S(N((R((sA/home/alex/projects/github/krakatau/Krakatau/ssa/variablegraph.pyt\scWs|rt|?ndgS(N(RR(R((sA/home/alex/projects/github/krakatau/Krakatau/ssa/variablegraph.pyR@]sitpropagateConstraintsi*i(N(NNN(N(tcollectionstOrderedDictt	itertoolstchaint
from_iterableRR
RRR R=tpredecessorsRR(R:tgetR+trvalRRRR0RAR/R1t
getOutputsRRRtvaluesR(tenvtblockstlookupR6t	variablesR>topstvarlambtphilambR4tcurUCR7tphiR=R3texctoutnodetopRR9tvnodetvnodesR#R)((sA/home/alex/projects/github/krakatau/Krakatau/ssa/variablegraph.pyt	makeGraphSsh		


	>
	

)
	
,
	'ics?tj|j?d??}x?|D]??t???xT?r??jd?}|j|?}|r7?j??fd?|jD??q7q7Wtd??D??}|r?x:?D]}|j	|_
q?Wq"x?D]}|j
|_	q?Wq"WdS(NcSsg|jD]}|d^q
S(Ni(R(R#R-((sA/home/alex/projects/github/krakatau/Krakatau/ssa/variablegraph.pyR@?sic3s-|]#}|?kr|?kr|VqdS(N((RR)(tscctworklist(sA/home/alex/projects/github/krakatau/Krakatau/ssa/variablegraph.pys	?scss+|]!}|jp"|j|jkVqdS(N(RRR(RR#((sA/home/alex/projects/github/krakatau/Krakatau/ssa/variablegraph.pys	?s(Rt	tarjanSCCRKtlisttpopR%textendRtallRR(tgraphR!tsccsR#R"t	converged((R[R\sA/home/alex/projects/github/krakatau/Krakatau/ssa/variablegraph.pytprocessGraph?s
	*

(
RBRDtconstraintsRRtRtobjectRR+R:RZRe(((sA/home/alex/projects/github/krakatau/Krakatau/ssa/variablegraph.pyts3			D




© 2015 - 2025 Weber Informatics LLC | Privacy Policy