Example #1
0
  def draw(self):
    k = self.s
    graph = self.graph
    dep = getDeps(k)

    show_sp = not(all([d.sparsity()==k.sparsity() for d in dep]))
    
    if show_sp:
      op = "op"
      self.drawSparsity(k,depid=op + str(k.__hash__()))
    else:
      op = ""
    
    if len(dep)>1:
      # Non-commutative operators are represented by 'record' shapes.
      # The dependencies have different 'ports' where arrows should arrive.
      s = getOperatorRepresentation(self.s,["| <f%d> | " %i for i in range(len(dep))])
      if s.startswith("(|") and s.endswith("|)"):
        s=s[2:-2]
      
      graph.add_node(pydot.Node(op + str(k.__hash__()),label=s,shape='Mrecord'))
      for i,n in enumerate(dep):
        graph.add_edge(pydot.Edge(str(n.__hash__()),op + str(k.__hash__())+":f%d" % i))
    else:
      s = getOperatorRepresentation(k,["."])
      self.graph.add_node(pydot.Node(op + str(k.__hash__()),label=s,shape='oval'))
      for i,n in enumerate(dep):
        self.graph.add_edge(pydot.Edge(str(n.__hash__()),op + str(k.__hash__())))
Example #2
0
 def draw(self):
   k = self.s
   graph = self.graph
   dep = getDeps(k)
   s = getOperatorRepresentation(k,[".", "."])
   self.graph.add_node(pydot.Node(str(k.__hash__()),label=s,shape='oval'))
   self.graph.add_edge(pydot.Edge(str(dep[0].__hash__()),str(k.__hash__())))
Example #3
0
 def draw(self):
   k = self.s
   graph = self.graph
   dep = getDeps(k)
   s = getOperatorRepresentation(k,[".", "."])
   self.graph.add_node(pydot.Node(str(k.__hash__()),label=s,shape='oval'))
   self.graph.add_edge(pydot.Edge(str(dep[0].__hash__()),str(k.__hash__())))
Example #4
0
 def draw(self):
   k = self.s
   graph = self.graph
   dep = getDeps(k)
   
   show_sp = True
   
   if k.isUnary() and dep[0].sparsity()==k.sparsity():
     show_sp = False
   if k.isBinary() and dep[0].sparsity()==k.sparsity() and dep[1].sparsity()==k.sparsity():
     show_sp = False
   
   if show_sp:
     op = "op"
     self.drawSparsity(k,depid=op + str(k.__hash__()))
   else:
     op = ""
   
   if not(k.isCommutative()):
     # Non-commutative operators are represented by 'record' shapes.
     # The dependencies have different 'ports' where arrows should arrive.
     s = getOperatorRepresentation(self.s,["| <f0> | ", " | <f1> |"])
     if s.startswith("(|") and s.endswith("|)"):
       s=s[2:-2]
     
     graph.add_node(pydot.Node(op + str(k.__hash__()),label=s,shape='Mrecord'))
     for i,n in enumerate(dep):
       graph.add_edge(pydot.Edge(str(n.__hash__()),op + str(k.__hash__())+":f%d" % i))
   else: 
    # Commutative operators can be represented more compactly as 'oval' shapes.
     s = getOperatorRepresentation(k,[".", "."])
     if s.startswith("(.") and s.endswith(".)"):
       s=s[2:-2]
     if s.startswith("(") and s.endswith(")"):
       s=s[1:-1]
     self.graph.add_node(pydot.Node(op + str(k.__hash__()),label=s,shape='oval'))
     for i,n in enumerate(dep):
       self.graph.add_edge(pydot.Edge(str(n.__hash__()),op + str(k.__hash__())))
Example #5
0
 def draw(self):
   k = self.s
   graph = self.graph
   dep = getDeps(k)
   
   show_sp = True
   
   if k.isUnary() and dep[0].sparsity()==k.sparsity():
     show_sp = False
   if k.isBinary() and dep[0].sparsity()==k.sparsity() and dep[1].sparsity()==k.sparsity():
     show_sp = False
   
   if show_sp:
     op = "op"
     self.drawSparsity(k,depid=op + str(k.__hash__()))
   else:
     op = ""
   
   if not(k.isCommutative()):
     # Non-commutative operators are represented by 'record' shapes.
     # The dependencies have different 'ports' where arrows should arrive.
     s = getOperatorRepresentation(self.s,["| <f0> | ", " | <f1> |"])
     if s.startswith("(|") and s.endswith("|)"):
       s=s[2:-2]
     
     graph.add_node(pydot.Node(op + str(k.__hash__()),label=s,shape='Mrecord'))
     for i,n in enumerate(dep):
       graph.add_edge(pydot.Edge(str(n.__hash__()),op + str(k.__hash__())+":f%d" % i))
   else: 
    # Commutative operators can be represented more compactly as 'oval' shapes.
     s = getOperatorRepresentation(k,[".", "."])
     if s.startswith("(.") and s.endswith(".)"):
       s=s[2:-2]
     if s.startswith("(") and s.endswith(")"):
       s=s[1:-1]
     self.graph.add_node(pydot.Node(op + str(k.__hash__()),label=s,shape='oval'))
     for i,n in enumerate(dep):
       self.graph.add_edge(pydot.Edge(str(n.__hash__()),op + str(k.__hash__())))