ソースを参照

Fix up some docstrings

master
コミット
9ab83c46ac
1個のファイルの変更10行の追加12行の削除
  1. +10
    -12
      abp/graphstate.py

+ 10
- 12
abp/graphstate.py ファイルの表示

@@ -62,18 +62,9 @@ class GraphState(object):
self._del_node(node)

def _add_node(self, node, **kwargs):
""" Add a node. By default, nodes are initialized with ``vop=``:math:`I`, i.e. they are in the :math:`|+\\rangle` state.

:param node: The name of the node, e.g. ``9``, ``start``
:type node: Any hashable type
:param kwargs: Any extra node attributes

Example of using node attributes ::

>>> g.add_node(0, label="fred", position=(1,2,3))
>>> g.node[0]["label"]
fred

""" Add a node.
By default, nodes are initialized with ``vop=``:math:`I`, i.e. they are in the :math:`|+\\rangle` state.
"""
if node in self.node:
print "Warning: node {} already exists".format(node)
@@ -94,6 +85,13 @@ class GraphState(object):
:param kwargs: Any extra node attributes

By default, qubits are initialized in the :math:`|0\\rangle` state. Provide the optional ``vop`` argument to set the initial state.

Example of using node attributes ::

>>> g._add_node(0, label="fred", position=(1,2,3))
>>> g.node[0]["label"]
fred

"""
kwargs["vop"] = clifford.by_name[
str(kwargs.get("vop", "hadamard"))] # TODO: ugly


読み込み中…
キャンセル
保存