
    wg                        d Z ddlmZ ddlmZmZ ddl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   )requires)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++17r9   fmodceil)Modceilinggammatgammabetaexpintriemann_zeta)rg   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     W/home/mcse/projects/flask/flask-venv/lib/python3.12/site-packages/sympy/printing/cxx.py_print_methodz+_attach_print_method.<locals>._print_methodG   s7      9diiDKKQUQZQZ@[6\]]    zPrints code for %s)hasattr
ValueErrork__doc__setattr)cls
sympy_namer   	meth_namer   s     `  r   _attach_print_methodr   C   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   M   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 edh      d        Z edh      d        Z	d	 Z
d
 Z edh      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__W   s    R(r   	algorithm)headersc                    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_MaxZ   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_Minb   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_usingj   s)    ::		))BCCr   c                 F    |j                   \  }d| j                  |      z  S )Nzthrow %s)r   r   )r   rsargs      r   _print_Raisez _CXXCodePrinterBase._print_Raisep   s!    wwDKK,,,r   	stdexceptc                 `    |j                   \  }| j                  d| j                  |      dS )Nzruntime_error(r   )r   r   r   )r   remessages      r   _print_RuntimeError_z(_CXXCodePrinterBase._print_RuntimeError_t   s%    77(,$++g2FGGr   r   )__name__
__module____qualname__printmethodlanguager   r   r   r   r   r   r   r   __classcell__r   s   @r   r   r   R   sy    KH
C) {m$D %D {m$D %DD- {m$H %H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   z   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      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   codeprinterr   cr   r	   sympy.printing.codeprinterr
   r   remover   r   lowerr   r   r   r   r   r   cxx_code_printersr   r   r   <module>r      sM    ( ! - /    W%a( ,   W%a(      $ 
 	  
L ,A"#'')OGQ,
 
4 ,A"#'')OGQ,+8
%H %HP,*N ,Q*N Q:+*N +&  r   