
    g                        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                             d           dddddidddddZdD ]Ze                                ed         e<    dD ]Ze                                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d
S )&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	          | ||           d S )Nz	_print_%sz1Edit method (or subclass) instead of overwriting.c           
          d                     | j        d                    t          | j        |j                                      S )Nz{}{}({}), )format_nsjoinmap_printargs)selfexpr	func_names     N/var/www/html/ai-engine/env/lib/python3.11/site-packages/sympy/printing/cxx.py_print_methodz+_attach_print_method.<locals>._print_methodG   s9      9diiDKQUQZ@[@[6\6\]]]    zPrints code for %s)hasattr
ValueErrork__doc__setattr)cls
sympy_namer   	meth_namer   s     `  r   _attach_print_methodr   C   sr    j(IsI NLMMM^ ^ ^ ^ ^014MCM*****r   c                 r    || j                                                  D ]\  }}t          | ||           d S N)standarditemsr   )r   contr   cxx_names       r   _attach_print_methodsr   M   sH     $S\ 2 8 8 : : 8 8
HS*h77778 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::Nc                 N    t                                          |pi            d S 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        d                   S | j        d|                     |j        d                   d|                      ||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       @@@@@@ty>>Q;;ty|,,,"&(((DKK	!,E,E,E,E"&++cc49QRR=.A"B"B"B"BD 	Dr   c                     ddl m} t          |j                  dk    r |                     |j        d                   S | j        d|                     |j        d                   d|                      ||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                 T    |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CCr   c                 D    |j         \  }d|                     |          z  S )Nzthrow %s)r   r   )r   rsargs      r   _print_Raisez _CXXCodePrinterBase._print_Raisep   s"    wDKK,,,,r   	stdexceptc                 T    |j         \  }| j        d|                     |          dS )Nzruntime_error(r   )r   r   r   )r   remessages      r   _print_RuntimeError_z(_CXXCodePrinterBase._print_RuntimeError_t   s.    7(,$++g2F2F2F2FGGr   r   )__name__
__module____qualname__printmethodlanguager   r   r   r   r   r   r   r   __classcell__r   s   @r   r   r   R   s        KH
C) ) ) ) ) ) X{m$$$D D %$D X{m$$$D D %$DD D D- - - X{m$$$H H %$H H H H Hr   r   c                   4    e Zd ZdZ eed                   ZdS )CXX98CodePrinterr   N)r   r   r   r   setreservedreserved_words r   r   r   r   z   s'        HS'*++NNNr   r   c                       e Zd ZdZ eed                   Z e ee	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                                                    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                  z  S )Nzusing %(alias)s = %(type)s)apply)r   r   r   r   kwargsr   )r   r   r   s     r   r   zCXX11CodePrinter._print_using   sC    :77''---/$++DK+2P2PPPr   )r   r   r   r   r   r   r   dictr   r   type_mappingsr   r   r   r   r   s   @r   r   r      sv       HS'*++ND&,,..DLL8i[1DMMI	{3DMMI	{3DMMI	{3DMMI	{3DNNZ)5DNNZ)5DNNZ)5D 5	{CD!7) EDLL.	
 %''   M"Q Q Q Q Q Q Q Q Qr   r   c                   n    e Zd ZdZ eed                   Z eej	        fi e
d         Z	d Zd Zd ZdS )CXX17CodePrinterr`   c                 ,    |                      |          S r   _print_math_funcr   s     r   _print_betazCXX17CodePrinter._print_beta       $$T***r   c                 ,    |                      |          S r   r   r   s     r   	_print_EizCXX17CodePrinter._print_Ei   r   r   c                 ,    |                      |          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      sy        HS'*++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      s          ( ( ( ( ( ( ( ( ! ! ! ! ! ! - - - - - - - - / . . . . .      W%aaa( , , ,   W%aaa(      $ $ $  
 	    
L , ,A"#''))OGQ 
4 , ,A"#''))OGQ+ + +8 8 8
%H %H %H %H %H %H %H %HP, , , , ,*N , , ,Q Q Q Q Q*N Q Q Q:+ + + + +*N + + +&     r   