
    MZdi                        d Z ddlmZ ddlmZmZ ddlmZmZ ddl	m
Z
 dg diZed   d	d	 g d
z   ed<   ed   d	d	 ed<   ed   j                  d       dddddidddddZdD ]  Zej                         ed   e<    dD ]  Zej                         ed   e<    d Zd Z G d d      Z G d dee      Z G d  d!ee      Z G d" d#ee      Zeeed$Zy	)%z
C++ code printer
    )chain)Typenone   )C89CodePrinterC99CodePrinter)cxxcodeC++98)Jandand_eqasmautobitandbitorboolbreakcasezcatch,charclasscomplconst
const_castcontinuedefaultdeletedodoubledynamic_castelseenumexplicitexportexternfalsefloatforfriendgotoifinlineintlongmutable	namespacenewnotnot_eqoperatororor_eqprivate	protectedpublicregisterreinterpret_castreturnshortsignedsizeofstaticstatic_caststructswitchtemplatethisthrowtruetrytypedeftypeidtypenameunionunsignedusingvirtualvoidvolatilewchar_twhilexorxor_eqN)
alignasalignofchar16_tchar32_t	constexprdecltypenoexceptnullptrstatic_assertthread_localC++11C++17r8   fmodceil)Modceilinggammatgammabetaexpintriemann_zeta)rf   Eizeta)r
   r^   r_   )Absexploglog10sqrtsincostanasinacosatanatan2sinhcoshtanhfloor)asinhacoshatanherferfcc                 ~    d|z  }t        | |      rt        d      fd}dt        z  |_        t	        | ||       y )Nz	_print_%sz1Edit method (or subclass) instead of overwriting.c           
          dj                  | j                  dj                  t        | j                  |j
                                    S )Nz{}{}({}), )format_nsjoinmap_printargs)selfexpr	func_names     4/usr/lib/python3/dist-packages/sympy/printing/cxx.py_print_methodz+_attach_print_method.<locals>._print_methodF   s7      9diiDKKQUQZQZ@[6\]]    zPrints code for %s)hasattr
ValueErrork__doc__setattr)cls
sympy_namer   	meth_namer   s     `  r   _attach_print_methodr   B   sB    j(IsILMM^014MCM*r   c                 h    || j                      j                         D ]  \  }}t        | ||        y N)standarditemsr   )r   contr   cxx_names       r   _attach_print_methodsr   L   s4     $S\\ 2 8 8 : 8
HS*h78r   c                   >     e Zd ZdZdZdZd fd	Zd Zd Zd Z	 xZ
S )	_CXXCodePrinterBase_cxxcodezC++zstd::c                 ,    t         |   |xs i        y r   )super__init__)r   settings	__class__s     r   r   z_CXXCodePrinterBase.__init__V   s    R(r   c                    ddl m} t        |j                        dk(  r| j	                  |j                  d         S | j
                  d| j	                  |j                  d         d| j	                   ||j                  dd         dS )Nr   )Maxr   zmax(r   ))(sympy.functions.elementary.miscellaneousr   lenr   r   r   )r   r   r   s      r   
_print_Maxz_CXXCodePrinterBase._print_MaxY   m    @tyy>Q;;tyy|,,"&((DKK		!,E"&++c499QR=.A"BD 	Dr   c                    ddl m} t        |j                        dk(  r| j	                  |j                  d         S | j
                  d| j	                  |j                  d         d| j	                   ||j                  dd         dS )Nr   )Minr   zmin(r   r   )r   r   r   r   r   r   )r   r   r   s      r   
_print_Minz_CXXCodePrinterBase._print_Min`   r   r   c                 \    |j                   t        k(  rd|j                  z  S t        d      )Nzusing %sz#C++98 does not support type aliases)aliasr   typer   r   r   s     r   _print_usingz _CXXCodePrinterBase._print_usingg   s)    ::		))BCCr   r   )__name__
__module____qualname__printmethodlanguager   r   r   r   r   __classcell__r   s   @r   r   r   Q   s)    KH
C)DDDr   r   c                   &    e Zd ZdZ eed         Zy)CXX98CodePrinterr
   N)r   r   r   r   setreservedreserved_words r   r   r   r   n   s    H'*+Nr   r   c                       e Zd ZdZ eed         Z e ee	j                  j                          ed      ddhf ed      ddhf ed      ddhf ed	      d
dhf ed      ddhf ed      ddhf ed      ddhf ed      ddhf ed      ddhf ed      ddhf ed      dij                                     Z
 fdZ xZS )CXX11CodePrinterr^   int8int8_tcstdintint16int16_tint32int32_tint64int64_tuint8uint8_tuint16uint16_tuint32uint32_tuint64uint64_t	complex64zstd::complex<float>complex
complex128zstd::complex<double>r   )r   Nc                     |j                   t        k(  rt        |   |      S d|j	                  | j
                        z  S )Nzusing %(alias)s = %(type)s)apply)r   r   r   r   kwargsr   )r   r   r   s     r   r   zCXX11CodePrinter._print_using   s9    ::7'--/$++DKK+2PPPr   )r   r   r   r   r   r   r   dictr   r   type_mappingsr   r   r   r   r   s   @r   r   r   v   s   H'*+N&&,,.L8i[1MI	{3MI	{3MI	{3MI	{3NZ)5NZ)5NZ)5 5	{C!7) EL.	
 %' M"Q Qr   r   c                   d    e Zd ZdZ eed         Z eej                  fi e
d   Z	d Zd Zd Zy)CXX17CodePrinterr_   c                 $    | j                  |      S r   _print_math_funcr   s     r   _print_betazCXX17CodePrinter._print_beta       $$T**r   c                 $    | j                  |      S r   r   r   s     r   	_print_EizCXX17CodePrinter._print_Ei   r   r   c                 $    | j                  |      S r   r   r   s     r   _print_zetazCXX17CodePrinter._print_zeta   r   r   N)r   r   r   r   r   r   r   r   r   _kf_math_functionsr   r   r   r   r   r   r   r      s?    H'*+N
~!!
>_W%=
>C+++r   r   )zc++98zc++11zc++17)r   	itertoolsr   sympy.codegen.astr   r   cr   r   sympy.printing.codeprinterr	   r   remover   r   lowerr   r   r   r   r   r   cxx_code_printersr   r   r   <module>r      sI    ( - /    W%a( ,   W%a(      $ 
 	  
L ,A"#'')OGQ,
 
4 ,A"#'')OGQ,+8
D D:,*N ,Q*N Q:+*N +&  r   