ó
a#nSc           @   sN   d  Z  d d l Z d d l m Z d d l m Z d d l Z d d „ Z d S(   s�    Python functions for manipulating molecular graphs

In theory much of the functionality in here should be migrating into the
C/C++ codebase.

iÿÿÿÿN(   t   Chem(   t   DataStructsc   	      C   sÎ   |  j  ƒ  } | d k r n | } d t j | ƒ } | } t j | d t j ƒ } d | d <xZ t d | d ƒ D]E } d | t j | ƒ | | <| | | | } t j | | ƒ } qq W| d c d 9)| S(   sF   calculates the characteristic polynomial for a molecular graph

    if mat is not passed in, the molecule's Weighted Adjacency Matrix will
    be used.

    The approach used is the Le Verrier-Faddeev-Frame method described
    in _Chemical Graph Theory, 2nd Edition_ by Nenad Trinajstic (CRC Press,
    1992), pg 76.
    
  g      ð?i   i    iÿÿÿÿN(	   t   GetNumAtomst   Nonet   numpyt   identityt   zerost   floatt   xranget   tracet   dot(	   t   molt   matt   nAtomst   At   It   Ant   rest   nt   Bn(    (    sS   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/python2.7/site-packages/rdkit/Chem/Graphs.pyt   CharacteristicPolynomial   s    
(   t   __doc__R   t   rdkitR    R   t   typesR   R   (    (    (    sS   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/python2.7/site-packages/rdkit/Chem/Graphs.pyt   <module>   s
   