+
    ,i6                         ^ RI t ^ RIHtHt ^ RIt^ RIHt  ! R R]4      t ! R R]4      t	 ! R R	]4      t
 ! R
 R4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R4      t ! R R4      tR# )    N)ABCabstractmethod)
MapWrapperc                   `   a  ] tR t^	t o RtR
R ltR tR t]R 4       t	]R 4       t
R tR	tV tR# )
VertexBasez
Base class for a vertex.
Nc                    Wn         \        V P                   4      V n        Ve   \        V4      V n        M\        4       V n        W0n        R# )z
Initiation of a vertex object.

Parameters
----------
x : tuple or vector
    The geometric location (domain).
nn : list, optional
    Nearest neighbour list.
index : int, optional
    Index of vertex.
N)xhashsetnnindex)selfr	   r   r   s   &&&&B/usr/lib/python3/dist-packages/scipy/optimize/_shgo_lib/_vertex.py__init__VertexBase.__init__   s6     L	>"gDGeDG
    c                    V P                   # N)r
   r   s   &r   __hash__VertexBase.__hash__$   s    yyr   c                    VR9  d   \        \        V 4       RV R24      hVR 8X  d2   \        P                  ! V P                  4      V n        V P
                  # R# )x_az object has no attribute ''N)r   )AttributeErrortypenparrayr	   r   )r   items   &&r   __getattr__VertexBase.__getattr__'   sY    w DJ< 0%%)F!"- . .5=xx'DH88O r   c                    \        R 4      hzKThis method is only implemented with an associated child of the base class.NotImplementedErrorr   vs   &&r   connectVertexBase.connect/       ! #H I 	Ir   c                    \        R 4      hr#   r$   r&   s   &&r   
disconnectVertexBase.disconnect4   r*   r   c                r    V P                   V n        V P                  P                  V 4       V P                  # )zReturns the star domain ``st(v)`` of the vertex.

Parameters
----------
v :
    The vertex ``v`` in ``st(v)``

Returns
-------
st : set
    A set containing all the vertices in ``st(v)``
)r   staddr   s   &r   starVertexBase.star9   s(     ''Dwwr   )r
   r   r   r/   r	   r   NN)__name__
__module____qualname____firstlineno____doc__r   r   r    r   r(   r,   r1   __static_attributes____classdictcell____classdict__s   @r   r   r   	   sO     . I I I I r   r   c                   R   a a ] tR t^Kt oRtRV 3R lltR tR tR tR t	Rt
VtV ;t# )	VertexScalarFieldzu
Add homology properties of a scalar field f: R^n --> R associated with
the geometry built from the VertexBase class
c                F   < \         SV `  WVR7       RV n        RV n        R# )a  
Parameters
----------
x : tuple,
    vector of vertex coordinates
field : callable, optional
    a scalar field f: R^n --> R associated with the geometry
nn : list, optional
    list of nearest neighbours
index : int, optional
    index of the vertex
field_args : tuple, optional
    additional arguments to be passed to field
g_cons : callable, optional
    constraints on the vertex
g_cons_args : tuple, optional
    additional arguments to be passed to g_cons

r   r   TN)superr   	check_min	check_max)	r   r	   fieldr   r   
field_argsg_consg_cons_args	__class__s	   &&&&&&&&r   r   VertexScalarField.__init__Q   s'    * 	/ r   c                    WJdg   WP                   9  dU   V P                   P                  V4       VP                   P                  V 4       RV n        RV n        RVn        RVn        R# R# R# )zlConnects self to another vertex object v.

Parameters
----------
v : VertexBase or VertexScalarField object
TN)r   r0   rB   rC   r&   s   &&r   r(   VertexScalarField.connectt   sU     =Qgg-GGKKNDDHHTN "DN!DNAKAK .=r   c                    WP                   9   dU   V P                   P                  V4       VP                   P                  V 4       R V n        R V n        R Vn        R Vn        R# R# )TN)r   removerB   rC   r&   s   &&r   r,   VertexScalarField.disconnect   sN    <GGNN1DDKK "DN!DNAKAK r   c                   a  S P                   '       d[   \        ;QJ d)    V 3R lS P                   4       F  '       d   K   RM	  RM! V 3R lS P                   4       4      S n        RS n         S P                  # )zBCheck whether this vertex is strictly less than all its
neighboursc              3   V   <"   T F  pSP                   VP                   8  x  K   	  R # 5ir   f.0r'   r   s   & r   	<genexpr>.VertexScalarField.minimiser.<locals>.<genexpr>        :'QDFFQSSL'   &)FT)rB   allr   _minr   s   fr   	minimiserVertexScalarField.minimiser   sI     >>>:$''::$''::DI"DNyyr   c                   a  S P                   '       d[   \        ;QJ d)    V 3R lS P                   4       F  '       d   K   RM	  RM! V 3R lS P                   4       4      S n        RS n         S P                  # )zH
Check whether this vertex is strictly greater than all its
neighbours.
c              3   V   <"   T F  pSP                   VP                   8  x  K   	  R # 5ir   rQ   rS   s   & r   rU   .VertexScalarField.maximiser.<locals>.<genexpr>   rW   rX   FT)rC   rY   r   _maxr   s   fr   	maximiserVertexScalarField.maximiser   sI    
 >>>:$''::$''::DI"DNyyr   )r`   rZ   rC   rB   )NNN Nrc   )r4   r5   r6   r7   r8   r   r(   r,   r[   ra   r9   r:   __classcell__rH   r<   s   @@r   r>   r>   K   s)     
!F"		 	r   r>   c                   :   a a ] tR t^t oRtRV 3R lltRtVtV ;t# )VertexVectorFieldzx
Add homology properties of a scalar field f: R^n --> R^m associated with
the geometry built from the VertexBase class.
c
                <   < \         S
V `  WV	R 7       \        R4      h)r@   z&This class is still a work in progress)rA   r   r%   )r   r	   sfieldvfieldrE   vfield_argsrF   rG   r   r   rH   s   &&&&&&&&&&r   r   VertexVectorField.__init__   s#     	/!"JKKr   rc   )NNrc   rc   Nrc   NN)	r4   r5   r6   r7   r8   r   r9   r:   rd   re   s   @@r   rg   rg      s     
L Lr   rg   c                   <   a  ] tR t^t o RtR tR tR tR tRt	V t
R# )VertexCacheBasez7Base class for a vertex cache for a simplicial complex.c                V    \         P                  ! 4       V n        ^ V n        RV n        R# )r   N)collectionsOrderedDictcachenfevr   r   s   &r   r   VertexCacheBase.__init__   s      ,,.
	
r   c              #  ^   "   V P                    F  pV P                   V,          x  K  	  R # 5ir   )rs   r&   s   & r   __iter__VertexCacheBase.__iter__   s$     A**Q- s   +-c                (    V P                   ^,           # )z%Returns the size of the vertex cache.r   r   s   &r   sizeVertexCacheBase.size   s    zzA~r   c                >   \        R \        V P                  4       R24      p\        RV,          4       \        R \        V P                  4       R24       \        RV,          4       V P                   F$  pV P                  V,          P                  4        K&  	  R# )zVertex cache of size: :=N)lenrs   print	print_out)r   headlenr'   s   &  r   r   VertexCacheBase.print_out   st    .s4::.?qABcGm&s4::&7q9:cGmAJJqM##% r   )rs   r   rt   N)r4   r5   r6   r7   r8   r   rw   r{   r   r9   r:   r;   s   @r   rn   rn      s!     A
& &r   rn   c                   F   a a ] tR t^t oRtRV 3R lltR tR tRtVt	V ;t
# )
VertexCubezVertex class to be used for a pure simplicial complex with no associated
differential geometry (single level domain that exists in R^n)c                *   < \         SV `  WVR 7       R# )r@   N)rA   r   )r   r	   r   r   rH   s   &&&&r   r   VertexCube.__init__   s    /r   c                    WJdK   WP                   9  d9   V P                   P                  V4       VP                   P                  V 4       R # R # R # r   )r   r0   r&   s   &&r   r(   VertexCube.connect   s5    =Qgg-GGKKNDDHHTN .=r   c                    WP                   9   d9   V P                   P                  V4       VP                   P                  V 4       R # R # r   )r   rM   r&   s   &&r   r,   VertexCube.disconnect   s0    <GGNN1DDKK r   rc   r3   )r4   r5   r6   r7   r8   r   r(   r,   r9   r:   rd   re   s   @@r   r   r      s     F0
 r   r   c                   <   a a ] tR t^t oV 3R ltRR ltRtVtV ;t# )VertexCacheIndexc                :   < \         SV `  4        \        V n        R# )z
Class for a vertex cache for a simplicial complex without an associated
field. Useful only for building and visualising a domain complex.

Parameters
----------
N)rA   r   r   Vertex)r   rH   s   &r   r   VertexCacheIndex.__init__   s     	 r   c                     V P                   V,          #   \         dZ    T ;P                  ^,          un        T P                  YP                  R7      pY0P                   T&   T P                   T,          u # i ; i)   rz   )rs   KeyErrorr   r   r   r	   r   xvals   &&& r   __getitem__VertexCacheIndex.__getitem__   s`    		!::a=  	!JJ!OJ;;q

;3D !JJqM::a= 	!s    A!A98A9)r   r   )	r4   r5   r6   r7   r   r   r9   r:   rd   re   s   @@r   r   r      s     	!
! 
!r   r   c                      a a ] tR t^t oRV 3R lltRR ltR tR tR tR t	R t
R tR	 tR
 tR tR tR tRtVtV ;t# )VertexCacheFieldc                $  < \         SV `  4        RV n        \        V n        Wn        W n        \        W4      V n        W0n	        W@n
        \        W44      V n        \        4       V n        \        4       V n        RV n        WPn        \%        V4      V n        V^8X  d<   V P(                  V n        Vf   V P,                  V n        R# V P0                  V n        R# V P2                  V n        Vf   V P4                  V n        R# V P6                  V n        R# )aw  
Class for a vertex cache for a simplicial complex with an associated
field.

Parameters
----------
field : callable
    Scalar or vector field callable.
field_args : tuple, optional
    Any additional fixed parameters needed to completely specify the
    field function
g_cons : dict or sequence of dict, optional
    Constraints definition.
    Function(s) ``R**n`` in the form::
g_cons_args : tuple, optional
    Any additional fixed parameters needed to completely specify the
    constraint functions
workers : int  optional
    Uses `multiprocessing.Pool <multiprocessing>`) to compute the field
     functions in parallel.

FNrp   )rA   r   r   r>   r   rD   rE   FieldWrapperwfieldrF   rG   ConstraintWrapperwgconsr   gpoolfpoolsfc_lockworkersr   _mapwrapper
proc_gpoolprocess_gpoolproc_fpool_nogprocess_fpoolproc_fpool_gpproc_gpoolpproc_fpool_nogpproc_fpool_g)r   rD   rE   rF   rG   r   rH   s   &&&&&&r   r   VertexCacheField.__init__   s    0 	
'
$"55&'<U
 U
%g.a<!%D~%)%8%8"%)%6%6"!%!1!1D~%)%9%9"%)%7%7"r   c                    V P                   V,          #   \         d    T ;P                  ^,          un        T P                  YP                  Y P                  T P
                  T P                  T P                  R7      pY0P                   T&   T P                  P                  T4       T P                  P                  T4       T P                   T,          u # i ; i)r   )rD   r   r   rE   rF   rG   )rs   r   r   r   rD   rE   rF   rG   r   r0   r   r   s   &&& r   r   VertexCacheField.__getitem__0  s    	!::a=  
	!JJ!OJ;;q

r*.//&*kk+/+;+;  =D
 !JJqMJJNN4 JJNN4 ::a= 
	!s    CCCc                @    V P                   P                  4       pVR  V# )pool)__dict__copy)r   	self_dicts   & r   __getstate__VertexCacheField.__getstate__?  s"    MM&&(	fr   c                    V P                   e   V P                  4        V P                  4        V P                  4        R # r   )rF   r   r   proc_minimisersr   s   &r   process_poolsVertexCacheField.process_poolsD  s0    ;;" r   c                   R Vn         \        V P                  V P                  4       FU  w  r#\        P
                  ! V! VP                  .VO5!  R8  4      '       g   K8  \        P                  Vn        RVn          R# 	  R# )T        FN)	feasibleziprF   rG   r   anyr   infrR   )r   r'   gargss   &&  r   feasibility_check"VertexCacheField.feasibility_checkJ  s[    
4;;(8(89GAvvaoo+,,ff"
 :r   c                Z    V P                   ! VP                  .V P                  O5!  Vn        V ;P                  ^,          un        \        P                  ! VP                  4      '       d   \        P                  Vn        R# R#   \
         d    \        P                  Tn         Lai ; i)zzCompute the scalar field values of a vertex object `v`.

Parameters
----------
v : VertexBase or VertexScalarField object
N)	rD   r   rE   rR   rt   r   r   r   isnanr&   s   &&r   compute_sfieldVertexCacheField.compute_sfieldS  sp    	**QUU5T__5ACIINI 88ACC==&&AC   	&&AC	s   AB  B*)B*c                    V P                   e%   V P                   F  pV P                  V4       K  	  \        4       V n        R# )zProcess all constraints.N)rF   r   r   r   r&   s   & r   r   VertexCacheField.proc_gpoolc  s3    ;;"ZZ&&q)   U
r   c                    . pV P                    F  pVP                  VP                  4       K   	  V P                  V P                  P
                  V4      p\        V P                   V4       F  w  r$WBn        K  	  R# )z$Process all constraints in parallel.N)r   appendr   r   r   gconsr   r   )r   gpool_lr'   Gr   s   &    r   r   VertexCacheField.pproc_gpoolk  s_    ANN155!  T[[..8

A&DAJ 'r   c                    V P                    F(  pVP                  '       g   K  V P                  V4       K*  	  \        4       V n         R# )z6Process all field functions with constraints supplied.N)r   r   r   r   r&   s   & r   r   VertexCacheField.proc_fpool_gu  s2    Azzz##A&  U
r   c                l    V P                    F  pV P                  V4       K  	  \        4       V n         R# )z9Process all field functions with no constraints supplied.N)r   r   r   r&   s   & r   r   VertexCacheField.proc_fpool_nog}  s)    A"  U
r   c                   V P                   P                   . pV P                   FG  pVP                  '       d   VP	                  VP
                  4       K2  \        P                  Vn        KI  	  V P                  V P                   P                  V4      p\        W4       F6  w  rE\        V4      pWPV,          n        V ;P                  ^,          un        K8  	  \        4       V n        R# )zD
Process all field functions with constraints supplied in parallel.
N)r   funcr   r   r   r   r   r   rR   r   r   tuplert   r   r   fpool_lr'   FvarR   vts   &      r   r   VertexCacheField.pproc_fpool_g  s     	Azzzquu%ff	 
 T[[--w7_EBrBHJIINI %
 U
r   c                   V P                   P                   . pV P                   F  pVP                  VP                  4       K   	  V P                  V P                   P                  V4      p\        W4       F6  w  rE\        V4      pWPV,          n        V ;P                  ^,          un	        K8  	  \        4       V n        R# )zG
Process all field functions with no constraints supplied in parallel.
N)r   r   r   r   r   r   r   r   rR   rt   r   r   s   &      r   r    VertexCacheField.pproc_fpool_nog  s     	ANN155! T[[--w7_EBrBHJIINI %
 U
r   c                X    V  F#  pVP                  4        VP                  4        K%  	  R# )zCheck for minimisers.N)r[   ra   r&   s   & r   r    VertexCacheField.proc_minimisers  s    AKKMKKM r   )r   r   rD   rE   r   rF   rG   r   r   r   r   r   r   r   r   )Nrc   Nrc   r   r   )r4   r5   r6   r7   r   r   r   r   r   r   r   r   r   r   r   r   r   r9   r:   rd   re   s   @@r   r   r      sL     68p!
 &  r   r   c                   0   a  ] tR tRt o RtR tR tRtV tR# )r   i  z=Object to wrap constraints to pass to `multiprocessing.Pool`.c                    Wn         W n        R # r   rF   rG   )r   rF   rG   s   &&&r   r   ConstraintWrapper.__init__  s    &r   c                    R p\        V P                  V P                  4       F1  w  r4\        P                  ! V! V.VO5!  R8  4      '       g   K.  Rp V# 	  V# )Tr   F)r   rF   rG   r   r   )r   v_x_a	vfeasibler   r   s   &&   r   r   ConstraintWrapper.gcons  sV    	4;;(8(89GAvvaoo+,,!	 :
 r   r   N)	r4   r5   r6   r7   r8   r   r   r9   r:   r;   s   @r   r   r     s     G' r   r   c                   0   a  ] tR tRt o RtR tR tRtV tR# )r   i  z7Object to wrap field to pass to `multiprocessing.Pool`.c                    Wn         W n        R # r   rD   rE   )r   rD   rE   s   &&&r   r   FieldWrapper.__init__  s    
$r   c                     V P                   ! V.V P                  O5!  p\        P
                  ! V4      '       d   \        P                  pV#   \         d    \        P                  p LKi ; ir   )rD   rE   	Exceptionr   r   r   )r   r   v_fs   && r   r   FieldWrapper.func  sU    	**U5T__5C 88C==&&C
  	&&C	s   A A,+A,r   N)	r4   r5   r6   r7   r8   r   r   r9   r:   r;   s   @r   r   r     s     A% r   r   )rq   abcr   r   numpyr   scipy._lib._utilr   r   r>   rg   rn   r   r   r   r   r   rc   r   r   <module>r      s     #  '? ?DW
 WtL
 L& &4 "! !2t tn   r   