§
    PŠtjBÛ  ã                   ó"  — d dl mZ d dlmZmZmZmZmZmZ d dl	m
Z
 d dlmZ d dlmZ d dlmZ d dlmZmZ d dlmZmZmZmZmZmZmZmZmZmZmZ d d	l m!Z! d d
l"m#Z# dId„Z$d„ Z%d„ Z&d„ Z'd„ Z(d„ Z)d„ Z*d„ Z+d„ Z,d„ Z-d„ Z.d„ Z/d„ Z0d„ Z1d„ Z2d„ Z3d„ Z4d„ Z5d„ Z6d „ Z7d!„ Z8d"„ Z9d#„ Z:d$„ Z;d%„ Z<d&„ Z=d'„ Z>d(„ Z?d)„ Z@d*„ ZAd+„ ZBd,„ ZCd-„ ZDd.„ ZEd/„ ZFd0„ ZGd1„ ZHd2„ ZId3„ ZJd4„ ZKd5„ ZLd6„ ZMd7„ ZNd8„ ZOd9„ ZPd:„ ZQd;„ ZRd<„ ZSd=„ ZTd>„ ZUd?„ ZVd@„ ZWdA„ ZXdB„ ZYdC„ ZZdD„ Z[dE„ Z\dF„ Z]dG„ Z^dHS )Jé    )ÚStringIO)ÚsymbolsÚEqÚpiÚCatalanÚLambdaÚDummy©ÚEquality)ÚSymbol)Úerf)ÚIntegral)ÚMatrixÚMatrixSymbol)ÚcodegenÚmake_routineÚCCodeGenÚ
C89CodeGenÚ
C99CodeGenÚInputArgumentÚCodeGenErrorÚFCodeGenÚCodeGenArgumentListErrorÚOutputArgumentÚInOutArgument)Úraises)Úimplemented_functionÚfileFc                 ó�   — t          ¦   «         } | |||||¦  «         |                     ¦   «         }|                     ¦   «          |S )a5  Wrapper for dump_fn. dump_fn writes its results to a stream object and
       this wrapper returns the contents of that stream as a string. This
       auxiliary function is used by many tests below.

       The header and the empty lines are not generated to facilitate the
       testing of the output.
    )r   ÚgetvalueÚclose)Údump_fnÚroutinesÚprefixÚheaderÚemptyÚoutputÚsources          ú`/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/sympy/utilities/tests/test_codegen.pyÚ
get_stringr*      sF   € õ ‰ZŒZ€FØ€GˆH�f˜f f¨eÑ4Ô4Ð4Ø�_Š_ÑÔ€FØ
‡L‚L�N„N€NØ€Mó    c                  óú  ‡‡‡	‡
‡— t          d¦  «        \  ŠŠ	Š
Š‰	‰
z   ‰z  Št          t          ˆˆ	ˆfd„¦  «         t          t          ˆˆˆ	ˆ
ˆfd„¦  «         t          dt	          ‰‰¦  «        ‰‰	‰‰
g¬¦  «        } d„ | j        D ¦   «         ‰‰	‰‰
gk    sJ ‚d„ | j        D ¦   «         t          t          t          t          gk    sJ ‚t          dt	          ‰‰¦  «        ‰‰	‰
g¬¦  «        } d„ | j        D ¦   «         t          t          t          gk    sJ ‚d	d
l	m
}m} t          |ddg¦  «        \  }}t          dd¬¦  «        } |d|¦  «        }t          dt	          ||         ||         ¦  «        |||g¬¦  «        } d„ | j        D ¦   «         |j        |j        |gk    sJ ‚t          ‰	‰
z  ‰z  ‰	ddf‰
ddf¦  «        Št          dt	          ‰‰¦  «        ‰‰	‰‰
g¬¦  «        } d„ | j        D ¦   «         ‰‰	‰‰
gk    sJ ‚d S )Nza x y zc                  ó,   •— t          d‰ ‰‰g¬¦  «        S ©NÚtest©Úargument_sequence©r   )ÚexprÚxÚzs   €€€r)   ú<lambda>z-test_Routine_argument_order.<locals>.<lambda>&   s!   ø€ ­\¸&À$Ø ˜Vð.%ñ .%ô .%€ r+   c                  óJ   •— t          dt          ‰ ‰¦  «        ‰‰‰g¬¦  «        S r.   )r   r   )Úar3   r4   Úyr5   s   €€€€€r)   r6   z-test_Routine_argument_order.<locals>.<lambda>(   s4   ø€ ­\¸&Å"ÀQØñCô CØ%&¨¨1 Ið./ñ ./ô ./€ r+   r/   r0   c                 ó   — g | ]	}|j         ‘Œ
S © ©Úname©Ú.0Úargs     r)   ú
<listcomp>z/test_Routine_argument_order.<locals>.<listcomp>+   ó   € Ð.Ð.Ð.˜#ˆSŒXÐ.Ð.Ð.r+   c                 ó,   — g | ]}t          |¦  «        ‘ŒS r;   ©Útyper>   s     r)   rA   z/test_Routine_argument_order.<locals>.<listcomp>,   ó   € Ð/Ð/Ð/˜3�T�#‰YŒYÐ/Ð/Ð/r+   c                 ó,   — g | ]}t          |¦  «        ‘ŒS r;   rD   r>   s     r)   rA   z/test_Routine_argument_order.<locals>.<listcomp>/   rF   r+   r   ©ÚIndexedBaseÚIdxÚAÚBÚmT©ÚintegerÚic                 ó   — g | ]	}|j         ‘Œ
S r;   r<   r>   s     r)   rA   z/test_Routine_argument_order.<locals>.<listcomp>7   rB   r+   é   é   é   c                 ó   — g | ]	}|j         ‘Œ
S r;   r<   r>   s     r)   rA   z/test_Routine_argument_order.<locals>.<listcomp>;   rB   r+   )r   r   r   r   r   Ú	argumentsr   r   r   Úsympy.tensorrI   rJ   ÚmapÚlabelr   )ÚrrI   rJ   rK   rL   rM   rP   r8   r3   r4   r9   r5   s          @@@@@r)   Útest_Routine_argument_orderr[   #   s•  øøøøø€ Ý˜Ñ#Ô#�J€A€qˆ!ˆQØ�‰E�1‰9€DÝ
Õ#ð &%ð &%ð &%ð &%ð &%ð &%ñ &ô &ð &å
Õ#ð &/ð &/ð &/ð &/ð &/ð &/ð &/ð &/ñ 0ô 0ð 0å�V�R  4™[œ[¸QÀÀ1Àa¸LÐIÑIÔI€AØ.Ð. ¤Ð.Ñ.Ô.°1°a¸¸A°,Ò>Ð>Ð>Ð>Ø/Ð/ !¤+Ð/Ñ/Ô/Ý•}¥nµmð4Gò Gð Gð Gð Gå�V�R  4™[œ[¸QÀÀ1¸IÐFÑFÔF€AØ/Ð/ !¤+Ð/Ñ/Ô/Ý•}¥mð46ò 6ð 6ð 6ð 6ð .Ð-Ð-Ð-Ð-Ð-Ð-Ð-Ýˆ{˜S #˜JÑ'Ô'�D€A€qÝ�˜TÐ"Ñ"Ô"€AØˆˆC�‰Œ€AÝ�V�R  !¤ a¨¤d™^œ^ÀÀ1Àa¸yÐIÑIÔI€AØ.Ð. ¤Ð.Ñ.Ô.°1´7¸A¼GÀQÐ2GÒGÐGÐGÐGå�A�a‘C˜‘E˜A˜q !˜9 q¨!¨Q iÑ0Ô0€DÝ�V�R  4™[œ[¸QÀÀ1Àa¸LÐIÑIÔI€AØ.Ð. ¤Ð.Ñ.Ô.°1°a¸¸A°,Ò>Ð>Ð>Ð>Ð>Ð>r+   c                  ó\   — t          ¦   «         } t          | j        g ¦  «        }|dk    sJ ‚d S )Nz$#include "file.h"
#include <math.h>
©r   r*   Údump_c©Úcode_genr(   s     r)   Útest_empty_c_codera   >   s4   € Ý‰|Œ|€HÝ˜œ¨Ñ,Ô,€FØÐ?Ò?Ð?Ð?Ð?Ð?Ð?r+   c                  ó�   — t          ¦   «         } t          | j        g d¬¦  «        }|d d…         dk    sJ ‚|dd …         dk    sJ ‚d S )NT©r%   éR   zR/******************************************************************************
 *éž   a·  *
 *                                                                            *
 *              See http://www.sympy.org/ for more information.               *
 *                                                                            *
 *                       This file is part of 'project'                       *
 ******************************************************************************/
#include "file.h"
#include <math.h>
r]   r_   s     r)   Útest_empty_c_code_with_commentrf   D   st   € Ý‰|Œ|€HÝ˜œ¨°DÐ9Ñ9Ô9€FØ�#�2�#Œ;Ø]òð ð ð ð �#�$�$Œ<ð ["ò ð ð ð ð ð r+   c                  ó\   — t          ¦   «         } t          | j        g ¦  «        }|dk    sJ ‚d S )Nz9#ifndef PROJECT__FILE__H
#define PROJECT__FILE__H
#endif
)r   r*   Údump_hr_   s     r)   Útest_empty_c_headerri   V   s4   € Ý‰|Œ|€HÝ˜œ¨Ñ,Ô,€FØÐSÒSÐSÐSÐSÐSÐSr+   c                  ó¸   — t          d¦  «        \  } }}| |z   |z  }t          d|¦  «        }t          ¦   «         }t          |j        |g¦  «        }d}||k    sJ ‚d S )Núx,y,zr/   úœ#include "file.h"
#include <math.h>
double test(double x, double y, double z) {
   double test_result;
   test_result = z*(x + y);
   return test_result;
}
©r   r   r   r*   r^   ©r4   r9   r5   r3   Úroutiner`   r(   Úexpecteds           r)   Útest_simple_c_coderq   \   sp   € Ý�gÑÔ�G€A€qˆ!Ø�‰E�1‰9€DÝ˜6 4Ñ(Ô(€GÝ‰|Œ|€HÝ˜œ¨'¨Ñ3Ô3€Fð	ð ð �XÒÐÐÐÐÐr+   c                  ó¸   — t          d¦  «        \  } }}| |z   |z  }t          d|¦  «        }t          ¦   «         }t          |j        |g¦  «        }d}||k    sJ ‚d S )Nzif, typedef, whiler/   z¸#include "file.h"
#include <math.h>
double test(double if_, double typedef_, double while_) {
   double test_result;
   test_result = while_*(if_ + typedef_);
   return test_result;
}
)r   r   r   r*   r^   rn   s           r)   Útest_c_code_reserved_wordsrs   n   sq   € ÝÐ*Ñ+Ô+�G€A€qˆ!Ø�‰E�Q‰;€DÝ˜6 4Ñ(Ô(€GÝ‰|Œ|€HÝ˜œ¨'¨Ñ3Ô3€Fð	ð ð �XÒÐÐÐÐÐr+   c                  óÆ   — t          dt          t          z  ¦  «        } t          ¦   «         }t	          |j        | g¦  «        }dt          j        d¦  «        z  }||k    sJ ‚d S )Nr/   z§#include "file.h"
#include <math.h>
double test() {
   double test_result;
   double const Catalan = %s;
   test_result = pow(M_PI, Catalan);
   return test_result;
}
é   )r   r   r   r   r*   r^   Úevalf©ro   r`   r(   rp   s       r)   Útest_numbersymbol_c_coderx   €   se   € Ý˜6¥2¥w¡;Ñ/Ô/€GÝ‰|Œ|€HÝ˜œ¨'¨Ñ3Ô3€Fð	õ 	Œ�bÑÔñ	€Hð �XÒÐÐÐÐÐr+   c                  ó¼   — t          d¦  «        \  } }}| |z   }t          d||| |g¬¦  «        }t          ¦   «         }t          |j        |g¦  «        }d}||k    sJ ‚d S )Nrk   r/   r0   z˜#include "file.h"
#include <math.h>
double test(double z, double x, double y) {
   double test_result;
   test_result = x + y;
   return test_result;
}
rm   rn   s           r)   Útest_c_code_argument_orderrz   ‘   sw   € Ý�gÑÔ�G€A€qˆ!Øˆq‰5€DÝ˜6 4¸A¸qÀ!¸9ÐEÑEÔE€GÝ‰|Œ|€HÝ˜œ¨'¨Ñ3Ô3€Fð	ð ð �XÒÐÐÐÐÐr+   c                  ó¸   — t          d¦  «        \  } }}| |z   |z  }t          d|¦  «        }t          ¦   «         }t          |j        |g¦  «        }d}||k    sJ ‚d S )Nrk   r/   úd#ifndef PROJECT__FILE__H
#define PROJECT__FILE__H
double test(double x, double y, double z);
#endif
)r   r   r   r*   rh   rn   s           r)   Útest_simple_c_headerr}   £   sp   € Ý�gÑÔ�G€A€qˆ!Ø�‰E�1‰9€DÝ˜6 4Ñ(Ô(€GÝ‰|Œ|€HÝ˜œ¨'¨Ñ3Ô3€Fð	ð ð �XÒÐÐÐÐÐr+   c                  ó€   — t          d¦  «        \  } }}| |z   |z  }ddg}t          d|fdddd¬¦  «        }||k    sJ ‚d S )	Nrk   )úfile.crl   )úfile.hr|   r/   ÚCr   F©r%   r&   ©r   r   )r4   r9   r5   r3   rp   Úresults         r)   Útest_simple_c_codegenr…   ²   sh   € Ý�gÑÔ�G€A€qˆ!Ø�‰E�1‰9€Dð	ð	ð€Hõ �f˜d�^ S¨&¸ÀeÐLÑLÔL€FØ�XÒÐÐÐÐÐr+   c                  óÂ   ‡‡— t          d¦  «        \  } }}| |z   |z  }| |z
  |z  }t          d||g¦  «        Št          ¦   «         Št          t          ˆˆfd„¦  «         d S )Nrk   r/   c                  ó0   •— t          ‰ j        ‰g¦  «        S ©N©r*   rh   ©r`   ro   s   €€r)   r6   z)test_multiple_results_c.<locals>.<lambda>Ñ   ó   ø€ ¥¨H¬O¸g¸YÑ!GÔ!G€ r+   )r   r   r   r   r   ©r4   r9   r5   Úexpr1Úexpr2r`   ro   s        @@r)   Útest_multiple_results_cr�   È   sx   øø€ Ý�gÑÔ�G€A€qˆ!Ø�‰U�A‰I€EØ�‰U�A‰I€EÝØØ	�ˆñô €Gõ ‰|Œ|€HÝ
�<ÐGÐGÐGÐGÐGÑHÔHÐHÐHÐHr+   c                  ó2   — t          t          d„ ¦  «         d S )Nc                  ó"   — t          dg ¦  «        S ©Nr/   r2   r;   r+   r)   r6   z#test_no_results_c.<locals>.<lambda>Õ   ó   € �|¨F°BÑ7Ô7€ r+   ©r   Ú
ValueErrorr;   r+   r)   Útest_no_results_cr–   Ô   ó   € Ý
�:Ð7Ð7Ñ8Ô8Ð8Ð8Ð8r+   c                  óÀ  — ddl m}  ddlm} ddlm}m}m} ddlm	}m
} ddlm} ddlm}m}	m}
m}m}m} t)          d¦  «        }d	 | |¦  «        fd
 ||¦  «        fd |	|¦  «        fd |
|¦  «        fd ||¦  «        fd ||¦  «        fd ||¦  «        fd ||¦  «        fd ||¦  «        fd ||¦  «        fd ||¦  «        fd ||¦  «        fd ||¦  «        fd ||¦  «        fd ||¦  «        fg}t+          |dddd¬¦  «        }|d         d         dk    sJ ‚|d         d         dk    sJ ‚|d         d         dk    sJ ‚|d         d         d k    sJ ‚d S )!Nr   ©ÚAbs©Úlog©ÚcoshÚsinhÚtanh)ÚceilingÚfloor©Úsqrt©ÚacosÚasinÚatanÚcosÚsinÚtanr4   Ú	test_fabsÚ	test_acosÚ	test_asinÚ	test_atanÚ	test_ceilÚtest_cosÚ	test_coshÚ
test_floorÚtest_logÚtest_lnÚtest_sinÚ	test_sinhÚ	test_sqrtÚtest_tanÚ	test_tanhÚC89r   Fr‚   r   rR   aö  #include "file.h"
#include <math.h>
double test_fabs(double x) {
   double test_fabs_result;
   test_fabs_result = fabs(x);
   return test_fabs_result;
}
double test_acos(double x) {
   double test_acos_result;
   test_acos_result = acos(x);
   return test_acos_result;
}
double test_asin(double x) {
   double test_asin_result;
   test_asin_result = asin(x);
   return test_asin_result;
}
double test_atan(double x) {
   double test_atan_result;
   test_atan_result = atan(x);
   return test_atan_result;
}
double test_ceil(double x) {
   double test_ceil_result;
   test_ceil_result = ceil(x);
   return test_ceil_result;
}
double test_cos(double x) {
   double test_cos_result;
   test_cos_result = cos(x);
   return test_cos_result;
}
double test_cosh(double x) {
   double test_cosh_result;
   test_cosh_result = cosh(x);
   return test_cosh_result;
}
double test_floor(double x) {
   double test_floor_result;
   test_floor_result = floor(x);
   return test_floor_result;
}
double test_log(double x) {
   double test_log_result;
   test_log_result = log(x);
   return test_log_result;
}
double test_ln(double x) {
   double test_ln_result;
   test_ln_result = log(x);
   return test_ln_result;
}
double test_sin(double x) {
   double test_sin_result;
   test_sin_result = sin(x);
   return test_sin_result;
}
double test_sinh(double x) {
   double test_sinh_result;
   test_sinh_result = sinh(x);
   return test_sinh_result;
}
double test_sqrt(double x) {
   double test_sqrt_result;
   test_sqrt_result = sqrt(x);
   return test_sqrt_result;
}
double test_tan(double x) {
   double test_tan_result;
   test_tan_result = tan(x);
   return test_tan_result;
}
double test_tanh(double x) {
   double test_tanh_result;
   test_tanh_result = tanh(x);
   return test_tanh_result;
}
r€   aØ  #ifndef PROJECT__FILE__H
#define PROJECT__FILE__H
double test_fabs(double x);
double test_acos(double x);
double test_asin(double x);
double test_atan(double x);
double test_ceil(double x);
double test_cos(double x);
double test_cosh(double x);
double test_floor(double x);
double test_log(double x);
double test_ln(double x);
double test_sin(double x);
double test_sinh(double x);
double test_sqrt(double x);
double test_tan(double x);
double test_tanh(double x);
#endif
)Ú$sympy.functions.elementary.complexesrš   Ú&sympy.functions.elementary.exponentialrœ   Ú%sympy.functions.elementary.hyperbolicrž   rŸ   r    Ú#sympy.functions.elementary.integersr¡   r¢   Ú(sympy.functions.elementary.miscellaneousr¤   Ú(sympy.functions.elementary.trigonometricr¦   r§   r¨   r©   rª   r«   r   r   )rš   rœ   rž   rŸ   r    r¡   r¢   r¤   r¦   r§   r¨   r©   rª   r«   r4   Ú	name_exprr„   s                    r)   Útest_ansi_math1_codegenrÃ   Ø   sA  € à8Ð8Ð8Ð8Ð8Ð8Ø:Ð:Ð:Ð:Ð:Ð:ØHÐHÐHÐHÐHÐHÐHÐHÐHÐHØDÐDÐDÐDÐDÐDÐDÐDØ=Ð=Ð=Ð=Ð=Ð=ØZÐZÐZÐZÐZÐZÐZÐZÐZÐZÐZÐZÐZÐZÐZÐZÝ�‰Œ€Aà	�c�c˜!‘f”fÐØ	�d�d˜1‘g”gÐØ	�d�d˜1‘g”gÐØ	�d�d˜1‘g”gÐØ	�g�g˜a‘j”jÐ!Ø	�S�S˜‘V”VÐØ	�d�d˜1‘g”gÐØ	�u�u˜Q‘x”xÐ Ø	�S�S˜‘V”VÐØ	�C�C˜‘F”FÐØ	�S�S˜‘V”VÐØ	�d�d˜1‘g”gÐØ	�d�d˜1‘g”gÐØ	�S�S˜‘V”VÐØ	�d�d˜1‘g”gÐð€Iõ" �Y  v°eÀ5ÐIÑIÔI€FØ�!Œ9�QŒ<˜8Ò#Ð#Ð#Ð#Ø�!Œ9�QŒ<ð	Fòð ð ð ð$ �!Œ9�QŒ<˜8Ò#Ð#Ð#Ð#Ø�!Œ9�QŒ<ð	0ò
ð 
ð 
ð 
ð 
ð 
r+   c                  ó(  — ddl m}  t          d¦  «        \  }}d | ||¦  «        fd||z  fg}t          |dddd¬	¦  «        }|d         d         d
k    sJ ‚|d         d         dk    sJ ‚|d         d         dk    sJ ‚|d         d         dk    sJ ‚d S )Nr   ©Úatan2úx,yÚ
test_atan2Útest_powr»   r   Fr‚   r   rR   a*  #include "file.h"
#include <math.h>
double test_atan2(double x, double y) {
   double test_atan2_result;
   test_atan2_result = atan2(x, y);
   return test_atan2_result;
}
double test_pow(double x, double y) {
   double test_pow_result;
   test_pow_result = pow(x, y);
   return test_pow_result;
}
r€   z…#ifndef PROJECT__FILE__H
#define PROJECT__FILE__H
double test_atan2(double x, double y);
double test_pow(double x, double y);
#endif
©rÁ   rÆ   r   r   )rÆ   r4   r9   rÂ   r„   s        r)   Útest_ansi_math2_codegenrË     sé   € à>Ð>Ð>Ð>Ð>Ð>Ý�5‰>Œ>�D€A€qà	�u�u˜Q ‘{”{Ð#Ø	�Q˜‘TÐð€Iõ �Y  v°eÀ5ÐIÑIÔI€FØ�!Œ9�QŒ<˜8Ò#Ð#Ð#Ð#Ø�!Œ9�QŒ<ð	Nòð ð ð ð
 �!Œ9�QŒ<˜8Ò#Ð#Ð#Ð#Ø�!Œ9�QŒ<ð	òð ð ð ð ð r+   c                  ó   — ddl m} m}m} t	          d¦  «        \  }}}d ||¦  «         | |¦  «        z    ||¦  «        z   dz                       ¦   «         fd |  |  |  |  |  |  |  | ||z   |z   ¦  «        ¦  «        ¦  «        ¦  «        ¦  «        ¦  «        ¦  «        ¦  «        fg}t          |ddd	d	¬
¦  «        }|d         d         dk    sJ ‚|d         d         dk    sJ ‚|d         d         dk    sJ ‚|d         d         dk    sJ ‚d S )Nr   ©r©   rª   r«   rk   Útest1é   Útest2r»   r   Fr‚   r   rR   a-  #include "file.h"
#include <math.h>
double test1(double x, double y, double z) {
   double test1_result;
   test1_result = pow(sin(x), 7) + 7*pow(sin(x), 6)*cos(y) + 7*pow(sin(x), 6)*tan(z) + 21*pow(sin(x), 5)*pow(cos(y), 2) + 42*pow(sin(x), 5)*cos(y)*tan(z) + 21*pow(sin(x), 5)*pow(tan(z), 2) + 35*pow(sin(x), 4)*pow(cos(y), 3) + 105*pow(sin(x), 4)*pow(cos(y), 2)*tan(z) + 105*pow(sin(x), 4)*cos(y)*pow(tan(z), 2) + 35*pow(sin(x), 4)*pow(tan(z), 3) + 35*pow(sin(x), 3)*pow(cos(y), 4) + 140*pow(sin(x), 3)*pow(cos(y), 3)*tan(z) + 210*pow(sin(x), 3)*pow(cos(y), 2)*pow(tan(z), 2) + 140*pow(sin(x), 3)*cos(y)*pow(tan(z), 3) + 35*pow(sin(x), 3)*pow(tan(z), 4) + 21*pow(sin(x), 2)*pow(cos(y), 5) + 105*pow(sin(x), 2)*pow(cos(y), 4)*tan(z) + 210*pow(sin(x), 2)*pow(cos(y), 3)*pow(tan(z), 2) + 210*pow(sin(x), 2)*pow(cos(y), 2)*pow(tan(z), 3) + 105*pow(sin(x), 2)*cos(y)*pow(tan(z), 4) + 21*pow(sin(x), 2)*pow(tan(z), 5) + 7*sin(x)*pow(cos(y), 6) + 42*sin(x)*pow(cos(y), 5)*tan(z) + 105*sin(x)*pow(cos(y), 4)*pow(tan(z), 2) + 140*sin(x)*pow(cos(y), 3)*pow(tan(z), 3) + 105*sin(x)*pow(cos(y), 2)*pow(tan(z), 4) + 42*sin(x)*cos(y)*pow(tan(z), 5) + 7*sin(x)*pow(tan(z), 6) + pow(cos(y), 7) + 7*pow(cos(y), 6)*tan(z) + 21*pow(cos(y), 5)*pow(tan(z), 2) + 35*pow(cos(y), 4)*pow(tan(z), 3) + 35*pow(cos(y), 3)*pow(tan(z), 4) + 21*pow(cos(y), 2)*pow(tan(z), 5) + 7*cos(y)*pow(tan(z), 6) + pow(tan(z), 7);
   return test1_result;
}
double test2(double x, double y, double z) {
   double test2_result;
   test2_result = cos(cos(cos(cos(cos(cos(cos(cos(x + y + z))))))));
   return test2_result;
}
r€   z‘#ifndef PROJECT__FILE__H
#define PROJECT__FILE__H
double test1(double x, double y, double z);
double test2(double x, double y, double z);
#endif
©rÁ   r©   rª   r«   r   Úexpandr   )r©   rª   r«   r4   r9   r5   rÂ   r„   s           r)   Útest_complicated_codegenrÓ   ,  ss  € ØHÐHÐHÐHÐHÐHÐHÐHÐHÐHÝ�gÑÔ�G€A€qˆ!à	�C�C˜‘F”F˜S˜S ™VœV‘O c c¨!¡f¤fÑ,¨qÑ0×8Ò8Ñ:Ô:Ð;Ø	�#�#�c�c˜#˜#˜c˜c # # c c¨#¨#¨c¨c°!°a±%¸!±)©n¬nÑ*=Ô*=Ñ&>Ô&>Ñ"?Ô"?Ñ@Ô@ÑAÔAÑBÔBÑCÔCÐDð€Iõ �Y  v°eÀ5ÐIÑIÔI€FØ�!Œ9�QŒ<˜8Ò#Ð#Ð#Ð#Ø�!Œ9�QŒ<ð.	ò0ð 0ð 0ð 0ðb �!Œ9�QŒ<˜8Ò#Ð#Ð#Ð#Ø�!Œ9�QŒ<ð	òð ð ð ð ð r+   c            	      ó  — ddl m} m} ddlm}  |dd¬¦  «        \  }} | d¦  «        } | d¦  «        } | d	¦  «        } |d
|¦  «        } |d|¦  «        }	t          dt          ||         |||	f         ||	         z  ¦  «        fdddd¬¦  «        \  \  }
}\  }}|
dk    sJ ‚d}||dd||z  |	z   z  iz  k    s>||dd|	||z  z   z  iz  k    s*||dd||z  |	z   z  iz  k    s||dd|	||z  z   z  iz  k    sJ ‚|dk    sJ ‚|dk    sJ ‚d S )Nr   rH   ©r   ún mTrN   rK   r4   r9   rP   ÚjÚmatrix_vectorÚC99r   Fr‚   r   a  #include "file.h"
#include <math.h>
void matrix_vector(double *A, int m, int n, double *x, double *y) {
   for (int i=0; i<m; i++){
      y[i] = 0;
   }
   for (int i=0; i<m; i++){
      for (int j=0; j<n; j++){
         y[i] = %(rhs)s + y[i];
      }
   }
}
Úrhsú
A[%s]*x[j]ú
x[j]*A[%s]r€   z|#ifndef PROJECT__FILE__H
#define PROJECT__FILE__H
void matrix_vector(double *A, int m, int n, double *x, double *y);
#endif
©rW   rI   rJ   Úsympy.core.symbolr   r   r   ©rI   rJ   r   ÚnrM   rK   r4   r9   rP   r×   Úf1ÚcodeÚf2Ú	interfacerp   s                  r)   Útest_loops_crå   p  sÃ  € Ø-Ð-Ð-Ð-Ð-Ð-Ð-Ð-Ø)Ð)Ð)Ð)Ð)Ð)Øˆ7�5 $Ð'Ñ'Ô'�D€A€qØˆ�CÑÔ€AØˆ�CÑÔ€AØˆ�CÑÔ€AØˆˆC�‰Œ€AØˆˆC�‰Œ€Aå")Ø	�"˜Q˜qœT 1 Q¨ T¤7¨1¨Q¬4¡<Ñ0Ô0Ð1°5¸&ÈÐV[ð#]ñ #]ô #]Ñ�J€Rˆ‘��Yð �Š>ˆ>ˆ>ˆ>ð	ð ð �H  |°q¸±s¸Q±wÑ'?Ð@Ñ@Ò@Ð@Ø�H  |°q¸1¸Q¹3±wÑ'?Ð@Ñ@Ò@Ð@Ø�H  |°q¸±s¸Q±wÑ'?Ð@Ñ@Ò@Ð@Ø�H  |°q¸1¸Q¹3±wÑ'?Ð@Ñ@Ò@Ð@Ð@ðAð �Š>ˆ>ˆ>ˆ>Øð	òð ð ð ð ð r+   c                  ó
  — ddl m} m} t          ddt          ¬¦  «        \  }} | d¦  «        } | d¦  «        } |||¦  «        }d|j        j        |j        d	œz  }t          d
t          ||         ||         ¦  «        ¦  «        }t          ¦   «         }t          ¦   «         }	t          |	j        |g¦  «        }
|
|k    sJ ‚t          t          ¦  «        5  t          |j        |g¦  «         d d d ¦  «         d S # 1 swxY w Y   d S )Nr   rH   úi mT©rO   Úclsr4   r9   zÃ#include "file.h"
#include <math.h>
void test_dummies(int m_%(mno)i, double *x, double *y) {
   for (int i_%(ino)i=0; i_%(ino)i<m_%(mno)i; i_%(ino)i++){
      y[i_%(ino)i] = x[i_%(ino)i];
   }
}
)ÚinoÚmnoÚtest_dummies)rW   rI   rJ   r   r	   rY   Údummy_indexr   r   r   r   r*   r^   r   ÚNotImplementedError)rI   rJ   rP   rM   r4   r9   rp   rZ   Úc89Úc99râ   s              r)   Útest_dummy_loops_crñ   š  s]  € Ø-Ð-Ð-Ð-Ð-Ð-Ð-Ð-Ý�5 $­EÐ2Ñ2Ô2�D€A€qØˆ�CÑÔ€AØˆ�CÑÔ€AØˆˆAˆq‰	Œ	€Að	ð ”Ô#¨A¬MÐ:Ð:ñ;€Hõ 	�^¥R¨¨!¬¨a°¬d¡^¤^Ñ4Ô4€AÝ
‰,Œ,€CÝ
‰,Œ,€CÝ�c”j 1 #Ñ&Ô&€DØ�8ÒÐÐÐÝ	Õ#Ñ	$Ô	$ð $ð $Ý�3”: ˜sÑ#Ô#Ð#ð$ð $ð $ñ $ô $ð $ð $ð $ð $ð $ð $ð $øøøð $ð $ð $ð $ð $ð $s   ÃC8Ã8C<Ã?C<c            	      ó<  — ddl m} m} ddlm}  |dd¬¦  «        \  }}}} | d||f¬¦  «        } | d	¦  «        } | d
¦  «        }	 |d||dz
  f¦  «        }
 |d|¦  «        }t          dt          |	|
         ||
|f         ||         z  ¦  «        fdddd¬¦  «        \  \  }}\  }}|dk    sJ ‚d|dz
  ddœz  }||dd|
|z  |z   z  iz  k    s>||dd||
|z  z   z  iz  k    s*||dd|
|z  |z   z  iz  k    s||dd||
|z  z   z  iz  k    sJ ‚|dk    sJ ‚|dk    sJ ‚d S )Nr   rH   rÕ   ún m o pTrN   rK   ©Úshaper4   r9   rP   é   r×   rØ   rÙ   r   Fr‚   r   a#  #include "file.h"
#include <math.h>
void matrix_vector(double *A, int m, int n, int o, int p, double *x, double *y) {
   for (int i=o; i<%(upperi)s; i++){
      y[i] = 0;
   }
   for (int i=o; i<%(upperi)s; i++){
      for (int j=0; j<n; j++){
         y[i] = %(rhs)s + y[i];
      }
   }
}
é   ú%(rhs)s)ÚupperirÚ   rÚ   rÛ   rÜ   r€   zŠ#ifndef PROJECT__FILE__H
#define PROJECT__FILE__H
void matrix_vector(double *A, int m, int n, int o, int p, double *x, double *y);
#endif
rÝ   ©rI   rJ   r   rà   rM   ÚoÚprK   r4   r9   rP   r×   rá   râ   rã   rä   rp   s                    r)   Útest_partial_loops_crý   ±  sï  € ð .Ð-Ð-Ð-Ð-Ð-Ð-Ð-Ø)Ð)Ð)Ð)Ð)Ð)Ø�˜¨DÐ1Ñ1Ô1�J€A€qˆ!ˆQØˆ�C  1˜vÐ&Ñ&Ô&€AØˆ�CÑÔ€AØˆ�CÑÔ€AØˆˆC�!�Q˜‘U�ÑÔ€AØˆˆC�‰Œ€Aå")Ø	�"˜Q˜qœT 1 Q¨ T¤7¨1¨Q¬4¡<Ñ0Ô0Ð1°5¸&ÈÐV[ð#]ñ #]ô #]Ñ�J€Rˆ‘��Yð �Š>ˆ>ˆ>ˆ>ð	ð �q‘5 Ð+Ð+ñ,€Hð �H  |°q¸±s¸Q±wÑ'?Ð@Ñ@Ò@Ð@Ø�H  |°q¸1¸Q¹3±wÑ'?Ð@Ñ@Ò@Ð@Ø�H  |°q¸±s¸Q±wÑ'?Ð@Ñ@Ò@Ð@Ø�H  |°q¸1¸Q¹3±wÑ'?Ð@Ñ@Ò@Ð@Ð@ðAð �Š>ˆ>ˆ>ˆ>Øð	òð ð ð ð ð r+   c            	      óH  — ddl m}  ddlm}m} t          d¦  «        \  }}}t          d | | ||¦  «        ¦  «         ||¦  «        g¦  «        }t          ¦   «         }|                     |gddd¬¦  «        }|d         d         d	k    sJ ‚d
}	|d         d         |	k    sJ ‚d S )Nr   r
   ©r©   rª   rk   Úfoor/   Fr‚   útest.czž#include "test.h"
#include <math.h>
double foo(double x, double *y) {
   (*y) = sin(x);
   double foo_result;
   foo_result = cos(x);
   return foo_result;
}
rR   ©	Úsympy.core.relationalr   rÁ   r©   rª   r   r   r   Úwrite©
r   r©   rª   r4   r9   r5   rZ   Úcr„   rp   s
             r)   Útest_output_arg_cr  Ý  s×   € Ø.Ð.Ð.Ð.Ð.Ð.ØCÐCÐCÐCÐCÐCÐCÐCÝ�gÑÔ�G€A€qˆ!Ý�U˜X˜X a¨¨¨Q©¬Ñ0Ô0°#°#°a±&´&Ð9Ñ:Ô:€AÝ‰Œ€AØ�WŠW�a�S˜&¨°eˆWÑ<Ô<€FØ�!Œ9�QŒ<˜8Ò#Ð#Ð#Ð#ð	ð ð �!Œ9�QŒ<˜8Ò#Ð#Ð#Ð#Ð#Ð#r+   c            	      óH  — ddl m}  ddlm}m} t          d¦  «        \  }}}t          d | | ||¦  «        ¦  «         ||¦  «        g¦  «        }t          ¦   «         }|                     |gddd¬¦  «        }|d         d         d	k    sJ ‚d
}	|d         d         |	k    sJ ‚d S )Nr   r
   rÿ   zif, while, zr   r/   Fr‚   r  z®#include "test.h"
#include <math.h>
double foo(double if_, double *while_) {
   (*while_) = sin(if_);
   double foo_result;
   foo_result = cos(if_);
   return foo_result;
}
rR   r  r  s
             r)   Ú test_output_arg_c_reserved_wordsr	  ò  s×   € Ø.Ð.Ð.Ð.Ð.Ð.ØCÐCÐCÐCÐCÐCÐCÐCÝ�nÑ%Ô%�G€A€qˆ!Ý�U˜X˜X a¨¨¨Q©¬Ñ0Ô0°#°#°a±&´&Ð9Ñ:Ô:€AÝ‰Œ€AØ�WŠW�a�S˜&¨°eˆWÑ<Ô<€FØ�!Œ9�QŒ<˜8Ò#Ð#Ð#Ð#ð	ð ð �!Œ9�QŒ<˜8Ò#Ð#Ð#Ð#Ð#Ð#r+   c                  ój  — t          ddd¦  «        } t          ddd¦  «        }t          | ¦  «        }t          |¦  «        }||z  }t          dd¬¦  «        }|                     d|¦  «        }d	|j        d
         _        d	|j        d
         _        t          |j        |gd¬¦  «        }d}||k    sJ ‚d S )NrK   rT   ÚbrR   r/   T)ÚprojectÚcser  Úoutéÿÿÿÿ)r$   zß#include "test.h"
#include <math.h>
void c(double *A, double *b, double *out) {
   out[0] = A[0]*b[0] + A[1]*b[1] + A[2]*b[2];
   out[1] = A[3]*b[0] + A[4]*b[1] + A[5]*b[2];
   out[2] = A[6]*b[0] + A[7]*b[1] + A[8]*b[2];
}
)	r   r   r   ro   rV   Ú
result_varÚ_namer*   r^   )	ÚA_symÚb_symrK   r  r  ÚcgenrZ   râ   rp   s	            r)   Útest_multidim_c_argument_cser    s¿   € Ý˜˜a Ñ#Ô#€EÝ˜˜a Ñ#Ô#€EÝˆu‰Œ€AÝˆu‰Œ€AØ	ˆ!‰€AÝ˜F¨Ð-Ñ-Ô-€DØ�Š�S˜!ÑÔ€AØ!&€A„K�„OÔØ!€A„K�„OÔÝ�d”k A 3¨vÐ6Ñ6Ô6€Dð	ð ð �8ÒÐÐÐÐÐr+   c                  óz  — t          d¦  «        \  } }}t          d¦  «        \  }}t          ddd¦  «        }t          |t          dd| gg¦  «        ¦  «        }t          || |z   |z  ¦  «        }t          |d| z  ¦  «        }d|||gf}	d}
t	          |	d	dd
d
| |||||f¬¦  «        }|d         d         }||
k    sJ ‚d S )Nrk   úB,CrK   rR   rT   rS   r/   z¼#include "test.h"
#include <math.h>
void test(double x, double *C, double z, double y, double *A, double *B) {
   (*C) = z*(x + y);
   A[0] = 1;
   A[1] = 2;
   A[2] = x;
   (*B) = 2*x;
}
r  F©r%   r&   r1   r   ©r   r   r   r   r   )r4   r9   r5   rL   r�   rK   r�   rŽ   Úexpr3rÂ   rp   r„   r(   s                r)   Ú test_ccode_results_named_orderedr    sí   € Ý�gÑÔ�G€A€qˆ!Ý�5‰>Œ>�D€A€qÝ�S˜!˜QÑÔ€AÝ�Q�  A q 	˜{Ñ+Ô+Ñ,Ô,€EÝ�Q˜˜Q™ ™	Ñ"Ô"€EÝ�Q˜˜!™ÑÔ€EØ˜% ¨Ð.Ð/€Ið	ð õ �Y  V°EÀØ()¨1¨a°°A°qÐ'9ð;ñ ;ô ;€Fà�AŒY�qŒ\€FØ�XÒÐÐÐÐÐr+   c            	      ó„  — t          ddd¦  «        } t          ddd¦  «        }t          ddd¦  «        }t          ddd¦  «        }dt          || d	d d …f         ¦  «        t          || dd d …f         ¦  «        t          || d d …d
f         ¦  «        gf}t          |dddd¬¦  «        }|d	         d         }d}||k    sJ ‚d S )NrK   rö   rT   rL   rR   r�   ÚDr/   r   rS   rð   Fr‚   a  #include "test.h"
#include <math.h>
void test(double *A, double *B, double *C, double *D) {
   B[0] = A[0];
   B[1] = A[1];
   B[2] = A[2];
   C[0] = A[3];
   C[1] = A[4];
   C[2] = A[5];
   D[0] = A[2];
   D[1] = A[5];
   D[2] = A[8];
   D[3] = A[11];
   D[4] = A[14];
}
©r   r   r   ©rK   rL   r�   r  rÂ   r„   r(   rp   s           r)   Útest_ccode_matrixsymbol_slicer   8  sé   € Ý�S˜!˜QÑÔ€AÝ�S˜!˜QÑÔ€AÝ�S˜!˜QÑÔ€AÝ�S˜!˜QÑÔ€AØ�( 1 a¨¨1¨1¨1¨¤gÑ.Ô.Ý" 1 a¨¨1¨1¨1¨¤gÑ.Ô.Ý" 1 a¨¨¨¨1¨¤gÑ.Ô.ð0ð 1€Iõ �Y  v°eÀ5ÐIÑIÔI€FØ�AŒY�qŒ\€Fð	ð ð" �XÒÐÐÐÐÐr+   c            
      ó<  — t          d¦  «        \  } }}}t          ddd¦  «        }dt          |t          | |z  g| |z  ||z  z   g| |z  |z  |z  gg¦  «        ¦  «        gf}t	          d¬¦  «        }t          ||dd¬	¦  «        }|d
         d         }d}	||	k    sJ ‚d S )Nza b c dÚerT   rR   r/   T)r  F)r`   r%   r&   r   zË#include "test.h"
#include <math.h>
void test(double a, double b, double c, double d, double *e) {
   const double x0 = a*b;
   const double x1 = c*d;
   e[0] = x0;
   e[1] = x0 + x1;
   e[2] = x0*x1;
}
)r   r   r   r   r   r   )
r8   r  r  Údr"  rÂ   Ú	generatorr„   r(   rp   s
             r)   Útest_ccode_cser%  U  sÆ   € Ý˜Ñ#Ô#�J€A€qˆ!ˆQÝ�S˜!˜QÑÔ€AØ�( 1¥f¨q°©s¨e°a¸±c¸A¸a¹C±i°[À1ÀQÁ3ÀqÁ5ÈÁ7À)Ð-LÑ&MÔ&MÑNÔNÐOÐP€IÝ˜TÐ"Ñ"Ô"€IÝ�Y¨¸5ÈÐNÑNÔN€FØ�AŒY�qŒ\€Fð	ð ð �XÒÐÐÐÐÐr+   c                  ó¢   — t          ddd¦  «        } d}t          ¦   «         }t          ||dd| f¬¦  «        }|d         d         }d}||k    sJ ‚d S )	Nr4   rS   rR   )r/   g      ð?F)r`   r%   r&   r1   r   zƒ#include "test.h"
#include <math.h>
double test(double *x) {
   double test_result;
   test_result = 1.0;
   return test_result;
}
)r   r   r   )r4   rÂ   r$  r„   r(   rp   s         r)   Útest_ccode_unused_array_argr'  i  sm   € Ý�S˜!˜QÑÔ€Aà€IÝ‘
”
€IÝ�Y¨¸5ÈÐbcÐaeÐfÑfÔf€FØ�AŒY�qŒ\€Fð	ð ð �XÒÐÐÐÐÐr+   c            	      óð   — t          ddd¦  «        } t          ddd¦  «        }t          dd¬¦  «        }d| d	         | d         z   f}t          |d
dd| ||f¬¦  «        }|d	         d         }d}||k    sJ ‚d S )NÚXrT   rR   ÚYr5   TrN   ÚtestBugr   r�   F)Úlanguager%   r&   r1   z¬#include "testBug.h"
#include <math.h>
double testBug(double *X, double *Y, int z) {
   double testBug_result;
   testBug_result = X[0] + X[1];
   return testBug_result;
}
)r   r   r   )r)  r*  r5   rÂ   r„   r(   rp   s          r)   Ú test_ccode_unused_array_arg_funcr-  |  sž   € å�S˜˜1ÑÔ€AÝ�S˜˜1ÑÔ€AÝ�˜dÐ#Ñ#Ô#€AØ˜A˜aœD 1 Q¤4™KÐ(€IÝ�Y¨°UÀ%Ð\]Ð_`ÐbcÐ[dÐeÑeÔe€FØ�AŒY�qŒ\€Fð	ð ð �XÒÐÐÐÐÐr+   c                  ó\   — t          ¦   «         } t          | j        g ¦  «        }|dk    sJ ‚d S ©NÚ ©r   r*   Údump_f95r_   s     r)   Útest_empty_f_coder3  �  s.   € Ý‰zŒz€HÝ˜Ô)¨2Ñ.Ô.€FØ�RŠ<ˆ<ˆ<ˆ<ˆ<ˆ<r+   c                  ó�   — t          ¦   «         } t          | j        g d¬¦  «        }|d d…         dk    sJ ‚|dd …         dk    sJ ‚d S )NTrc   rd   zR!******************************************************************************
!*re   a’  *
!*                                                                            *
!*              See http://www.sympy.org/ for more information.               *
!*                                                                            *
!*                       This file is part of 'project'                       *
!******************************************************************************
r1  r_   s     r)   Útest_empty_f_code_with_headerr5  •  sv   € Ý‰zŒz€HÝ˜Ô)¨2°dÐ;Ñ;Ô;€FØ�#�2�#Œ;Ø]òð ð ð ð �#�$�$Œ<ð [`ò ð ð ð ð ð r+   c                  ó\   — t          ¦   «         } t          | j        g ¦  «        }|dk    sJ ‚d S r/  )r   r*   rh   r_   s     r)   Útest_empty_f_headerr7  ¥  s-   € Ý‰zŒz€HÝ˜œ¨Ñ,Ô,€FØ�RŠ<ˆ<ˆ<ˆ<ˆ<ˆ<r+   c                  ó¸   — t          d¦  «        \  } }}| |z   |z  }t          d|¦  «        }t          ¦   «         }t          |j        |g¦  «        }d}||k    sJ ‚d S )Nrk   r/   ú’REAL*8 function test(x, y, z)
implicit none
REAL*8, intent(in) :: x
REAL*8, intent(in) :: y
REAL*8, intent(in) :: z
test = z*(x + y)
end function
©r   r   r   r*   r2  rn   s           r)   Útest_simple_f_coder;  «  sq   € Ý�gÑÔ�G€A€qˆ!Ø�‰E�1‰9€DÝ˜6 4Ñ(Ô(€GÝ‰zŒz€HÝ˜Ô)¨G¨9Ñ5Ô5€Fð	ð ð �XÒÐÐÐÐÐr+   c                  óò   — t          dt          t          z  ¦  «        } t          ¦   «         }t	          |j        | g¦  «        }dt          j        d¦  «        ›dt          j        d¦  «        ›d�}||k    sJ ‚d S )Nr/   zDREAL*8 function test()
implicit none
REAL*8, parameter :: Catalan = ru   zd0
REAL*8, parameter :: pi = z#d0
test = pi**Catalan
end function
)r   r   r   r   r*   r2  rv   rw   s       r)   Útest_numbersymbol_f_coder=  ½  sw   € Ý˜6¥2¥w¡;Ñ/Ô/€GÝ‰zŒz€HÝ˜Ô)¨G¨9Ñ5Ô5€F€Fõ 
Œ�rÑ	Ô	Ð	Ð	�BœH R™LœL˜L˜Lð*€Hð �XÒÐÐÐÐÐr+   c                  óð   — t          d¦  «        } t          dt          | ¦  «        t          d| z  ¦  «        z
  ¦  «        }t          ¦   «         }t	          |j        |g¦  «        }d}||k    s
J |¦   «         ‚d S )Nr4   r/   éþÿÿÿzhREAL*8 function test(x)
implicit none
REAL*8, intent(in) :: x
test = erf(x) + erf(2.0d0*x)
end function
)r   r   r   r   r*   r2  )r4   ro   r`   r(   rp   s        r)   Útest_erf_f_coder@  Ë  sy   € Ý�‰Œ€AÝ˜6¥3 q¡6¤6­C°°Q±©K¬KÑ#7Ñ8Ô8€GÝ‰zŒz€HÝ˜Ô)¨G¨9Ñ5Ô5€Fð	ð ð �XÒÐÐ˜vÑÔÐÐÐr+   c                  ó¼   — t          d¦  «        \  } }}| |z   }t          d||| |g¬¦  «        }t          ¦   «         }t          |j        |g¦  «        }d}||k    sJ ‚d S )Nrk   r/   r0   zŽREAL*8 function test(z, x, y)
implicit none
REAL*8, intent(in) :: z
REAL*8, intent(in) :: x
REAL*8, intent(in) :: y
test = x + y
end function
r:  rn   s           r)   Útest_f_code_argument_orderrB  Ù  sx   € Ý�gÑÔ�G€A€qˆ!Øˆq‰5€DÝ˜6 4¸A¸qÀ!¸9ÐEÑEÔE€GÝ‰zŒz€HÝ˜Ô)¨G¨9Ñ5Ô5€Fð	ð ð �XÒÐÐÐÐÐr+   c                  ó¸   — t          d¦  «        \  } }}| |z   |z  }t          d|¦  «        }t          ¦   «         }t          |j        |g¦  «        }d}||k    sJ ‚d S )Nrk   r/   ú™interface
REAL*8 function test(x, y, z)
implicit none
REAL*8, intent(in) :: x
REAL*8, intent(in) :: y
REAL*8, intent(in) :: z
end function
end interface
)r   r   r   r*   rh   rn   s           r)   Útest_simple_f_headerrE  ë  sp   € Ý�gÑÔ�G€A€qˆ!Ø�‰E�1‰9€DÝ˜6 4Ñ(Ô(€GÝ‰zŒz€HÝ˜œ¨'¨Ñ3Ô3€Fð	ð ð �XÒÐÐÐÐÐr+   c                  ó€   — t          d¦  «        \  } }}| |z   |z  }t          d|fdddd¬¦  «        }ddg}||k    sJ ‚d S )	Nrk   r/   ÚF95r   Fr‚   )úfile.f90r9  )r€   rD  rƒ   )r4   r9   r5   r3   r„   rp   s         r)   Útest_simple_f_codegenrI  þ  sr   € Ý�gÑÔ�G€A€qˆ!Ø�‰E�1‰9€DÝØ	�ˆ˜˜v¨e¸5ðBñ Bô B€Fð	ð	ð€Hð& �XÒÐÐÐÐÐr+   c                  óÂ   ‡‡— t          d¦  «        \  } }}| |z   |z  }| |z
  |z  }t          d||g¦  «        Št          ¦   «         Št          t          ˆˆfd„¦  «         d S )Nrk   r/   c                  ó0   •— t          ‰ j        ‰g¦  «        S rˆ   r‰   rŠ   s   €€r)   r6   z)test_multiple_results_f.<locals>.<lambda>"  r‹   r+   )r   r   r   r   r   rŒ   s        @@r)   Útest_multiple_results_frL    sx   øø€ Ý�gÑÔ�G€A€qˆ!Ø�‰U�A‰I€EØ�‰U�A‰I€EÝØØ	�ˆñô €Gõ ‰zŒz€HÝ
�<ÐGÐGÐGÐGÐGÑHÔHÐHÐHÐHr+   c                  ó2   — t          t          d„ ¦  «         d S )Nc                  ó"   — t          dg ¦  «        S r’   r2   r;   r+   r)   r6   z#test_no_results_f.<locals>.<lambda>&  r“   r+   r”   r;   r+   r)   Útest_no_results_frO  %  r—   r+   c                  óˆ  — ddl m}  ddlm} ddlm}m}m} ddlm	} ddl
m}m}m}m}	m}
m} t#          d¦  «        }d | |¦  «        fd	 ||¦  «        fd
 ||¦  «        fd ||¦  «        fd |	|¦  «        fd ||¦  «        fd ||¦  «        fd ||¦  «        fd |
|¦  «        fd ||¦  «        fd ||¦  «        fd ||¦  «        fd ||¦  «        fg}t%          |dddd¬¦  «        }|d         d         dk    sJ ‚d}|d         d         |k    sJ ‚|d         d         dk    sJ ‚d}|d         d         |k    sJ ‚d S )Nr   r™   r›   r�   r£   r¥   r4   Útest_absr­   r®   r¯   r±   r²   r´   rµ   r¶   r·   r¸   r¹   rº   rG  r   Fr‚   rH  a   REAL*8 function test_abs(x)
implicit none
REAL*8, intent(in) :: x
test_abs = abs(x)
end function
REAL*8 function test_acos(x)
implicit none
REAL*8, intent(in) :: x
test_acos = acos(x)
end function
REAL*8 function test_asin(x)
implicit none
REAL*8, intent(in) :: x
test_asin = asin(x)
end function
REAL*8 function test_atan(x)
implicit none
REAL*8, intent(in) :: x
test_atan = atan(x)
end function
REAL*8 function test_cos(x)
implicit none
REAL*8, intent(in) :: x
test_cos = cos(x)
end function
REAL*8 function test_cosh(x)
implicit none
REAL*8, intent(in) :: x
test_cosh = cosh(x)
end function
REAL*8 function test_log(x)
implicit none
REAL*8, intent(in) :: x
test_log = log(x)
end function
REAL*8 function test_ln(x)
implicit none
REAL*8, intent(in) :: x
test_ln = log(x)
end function
REAL*8 function test_sin(x)
implicit none
REAL*8, intent(in) :: x
test_sin = sin(x)
end function
REAL*8 function test_sinh(x)
implicit none
REAL*8, intent(in) :: x
test_sinh = sinh(x)
end function
REAL*8 function test_sqrt(x)
implicit none
REAL*8, intent(in) :: x
test_sqrt = sqrt(x)
end function
REAL*8 function test_tan(x)
implicit none
REAL*8, intent(in) :: x
test_tan = tan(x)
end function
REAL*8 function test_tanh(x)
implicit none
REAL*8, intent(in) :: x
test_tanh = tanh(x)
end function
rR   r€   aA  interface
REAL*8 function test_abs(x)
implicit none
REAL*8, intent(in) :: x
end function
end interface
interface
REAL*8 function test_acos(x)
implicit none
REAL*8, intent(in) :: x
end function
end interface
interface
REAL*8 function test_asin(x)
implicit none
REAL*8, intent(in) :: x
end function
end interface
interface
REAL*8 function test_atan(x)
implicit none
REAL*8, intent(in) :: x
end function
end interface
interface
REAL*8 function test_cos(x)
implicit none
REAL*8, intent(in) :: x
end function
end interface
interface
REAL*8 function test_cosh(x)
implicit none
REAL*8, intent(in) :: x
end function
end interface
interface
REAL*8 function test_log(x)
implicit none
REAL*8, intent(in) :: x
end function
end interface
interface
REAL*8 function test_ln(x)
implicit none
REAL*8, intent(in) :: x
end function
end interface
interface
REAL*8 function test_sin(x)
implicit none
REAL*8, intent(in) :: x
end function
end interface
interface
REAL*8 function test_sinh(x)
implicit none
REAL*8, intent(in) :: x
end function
end interface
interface
REAL*8 function test_sqrt(x)
implicit none
REAL*8, intent(in) :: x
end function
end interface
interface
REAL*8 function test_tan(x)
implicit none
REAL*8, intent(in) :: x
end function
end interface
interface
REAL*8 function test_tanh(x)
implicit none
REAL*8, intent(in) :: x
end function
end interface
)r¼   rš   r½   rœ   r¾   rž   rŸ   r    rÀ   r¤   rÁ   r¦   r§   r¨   r©   rª   r«   r   r   )rš   rœ   rž   rŸ   r    r¤   r¦   r§   r¨   r©   rª   r«   r4   rÂ   r„   rp   s                   r)   Útest_intrinsic_math_codegenrR  )  s  € à8Ð8Ð8Ð8Ð8Ð8Ø:Ð:Ð:Ð:Ð:Ð:ØHÐHÐHÐHÐHÐHÐHÐHÐHÐHØ=Ð=Ð=Ð=Ð=Ð=ØZÐZÐZÐZÐZÐZÐZÐZÐZÐZÐZÐZÐZÐZÐZÐZÝ�‰Œ€Aà	�S�S˜‘V”VÐØ	�d�d˜1‘g”gÐØ	�d�d˜1‘g”gÐØ	�d�d˜1‘g”gÐØ	�S�S˜‘V”VÐØ	�d�d˜1‘g”gÐØ	�S�S˜‘V”VÐØ	�C�C˜‘F”FÐØ	�S�S˜‘V”VÐØ	�d�d˜1‘g”gÐØ	�d�d˜1‘g”gÐØ	�S�S˜‘V”VÐØ	�d�d˜1‘g”gÐð€Iõ �Y  v°eÀ5ÐIÑIÔI€FØ�!Œ9�QŒ<˜:Ò%Ð%Ð%Ð%ð@	ð ðF �!Œ9�QŒ<˜8Ò#Ð#Ð#Ð#à�!Œ9�QŒ<˜8Ò#Ð#Ð#Ð#ðM	ð ð` �!Œ9�QŒ<˜8Ò#Ð#Ð#Ð#Ð#Ð#r+   c                  ó0  — ddl m}  t          d¦  «        \  }}d | ||¦  «        fd||z  fg}t          |dddd¬	¦  «        }|d         d         d
k    sJ ‚d}|d         d         |k    sJ ‚|d         d         dk    sJ ‚d}|d         d         |k    sJ ‚d S )Nr   rÅ   rÇ   rÈ   rÉ   rG  r   Fr‚   rH  zÿREAL*8 function test_atan2(x, y)
implicit none
REAL*8, intent(in) :: x
REAL*8, intent(in) :: y
test_atan2 = atan2(x, y)
end function
REAL*8 function test_pow(x, y)
implicit none
REAL*8, intent(in) :: x
REAL*8, intent(in) :: y
test_pow = x**y
end function
rR   r€   a  interface
REAL*8 function test_atan2(x, y)
implicit none
REAL*8, intent(in) :: x
REAL*8, intent(in) :: y
end function
end interface
interface
REAL*8 function test_pow(x, y)
implicit none
REAL*8, intent(in) :: x
REAL*8, intent(in) :: y
end function
end interface
rÊ   )rÆ   r4   r9   rÂ   r„   rp   s         r)   Útest_intrinsic_math2_codegenrT  Û  sä   € à>Ð>Ð>Ð>Ð>Ð>Ý�5‰>Œ>�D€A€qà	�u�u˜Q ‘{”{Ð#Ø	�Q˜‘TÐð€Iõ �Y  v°eÀ5ÐIÑIÔI€FØ�!Œ9�QŒ<˜:Ò%Ð%Ð%Ð%ð	ð ð �!Œ9�QŒ<˜8Ò#Ð#Ð#Ð#à�!Œ9�QŒ<˜8Ò#Ð#Ð#Ð#ð	ð ð  �!Œ9�QŒ<˜8Ò#Ð#Ð#Ð#Ð#Ð#r+   c                  ó(  — ddl m} m}m} t	          d¦  «        \  }}}d ||¦  «         | |¦  «        z    ||¦  «        z   dz                       ¦   «         fd |  |  |  |  |  |  |  | ||z   |z   ¦  «        ¦  «        ¦  «        ¦  «        ¦  «        ¦  «        ¦  «        ¦  «        fg}t          |ddd	d	¬
¦  «        }|d         d         dk    sJ ‚d}|d         d         |k    sJ ‚|d         d         dk    sJ ‚d}|d         d         |k    sJ ‚d S )Nr   rÍ   rk   rÎ   rÏ   rÐ   rG  r   Fr‚   rH  a{  REAL*8 function test1(x, y, z)
implicit none
REAL*8, intent(in) :: x
REAL*8, intent(in) :: y
REAL*8, intent(in) :: z
test1 = sin(x)**7 + 7*sin(x)**6*cos(y) + 7*sin(x)**6*tan(z) + 21*sin(x) &
      **5*cos(y)**2 + 42*sin(x)**5*cos(y)*tan(z) + 21*sin(x)**5*tan(z) &
      **2 + 35*sin(x)**4*cos(y)**3 + 105*sin(x)**4*cos(y)**2*tan(z) + &
      105*sin(x)**4*cos(y)*tan(z)**2 + 35*sin(x)**4*tan(z)**3 + 35*sin( &
      x)**3*cos(y)**4 + 140*sin(x)**3*cos(y)**3*tan(z) + 210*sin(x)**3* &
      cos(y)**2*tan(z)**2 + 140*sin(x)**3*cos(y)*tan(z)**3 + 35*sin(x) &
      **3*tan(z)**4 + 21*sin(x)**2*cos(y)**5 + 105*sin(x)**2*cos(y)**4* &
      tan(z) + 210*sin(x)**2*cos(y)**3*tan(z)**2 + 210*sin(x)**2*cos(y) &
      **2*tan(z)**3 + 105*sin(x)**2*cos(y)*tan(z)**4 + 21*sin(x)**2*tan &
      (z)**5 + 7*sin(x)*cos(y)**6 + 42*sin(x)*cos(y)**5*tan(z) + 105* &
      sin(x)*cos(y)**4*tan(z)**2 + 140*sin(x)*cos(y)**3*tan(z)**3 + 105 &
      *sin(x)*cos(y)**2*tan(z)**4 + 42*sin(x)*cos(y)*tan(z)**5 + 7*sin( &
      x)*tan(z)**6 + cos(y)**7 + 7*cos(y)**6*tan(z) + 21*cos(y)**5*tan( &
      z)**2 + 35*cos(y)**4*tan(z)**3 + 35*cos(y)**3*tan(z)**4 + 21*cos( &
      y)**2*tan(z)**5 + 7*cos(y)*tan(z)**6 + tan(z)**7
end function
REAL*8 function test2(x, y, z)
implicit none
REAL*8, intent(in) :: x
REAL*8, intent(in) :: y
REAL*8, intent(in) :: z
test2 = cos(cos(cos(cos(cos(cos(cos(cos(x + y + z))))))))
end function
rR   r€   a4  interface
REAL*8 function test1(x, y, z)
implicit none
REAL*8, intent(in) :: x
REAL*8, intent(in) :: y
REAL*8, intent(in) :: z
end function
end interface
interface
REAL*8 function test2(x, y, z)
implicit none
REAL*8, intent(in) :: x
REAL*8, intent(in) :: y
REAL*8, intent(in) :: z
end function
end interface
rÑ   )	r©   rª   r«   r4   r9   r5   rÂ   r„   rp   s	            r)   Útest_complicated_codegen_f95rV  	  sn  € ØHÐHÐHÐHÐHÐHÐHÐHÐHÐHÝ�gÑÔ�G€A€qˆ!à	�C�C˜‘F”F˜S˜S ™VœV‘O c c¨!¡f¤fÑ,¨qÑ0×8Ò8Ñ:Ô:Ð;Ø	�#�#�c�c˜#˜#˜c˜c # # c c¨#¨#¨c¨c°!°a±%¸!±)©n¬nÑ*=Ô*=Ñ&>Ô&>Ñ"?Ô"?Ñ@Ô@ÑAÔAÑBÔBÑCÔCÐDð€Iõ �Y  v°eÀ5ÐIÑIÔI€FØ�!Œ9�QŒ<˜:Ò%Ð%Ð%Ð%ð	ð ð< �!Œ9�QŒ<˜8Ò#Ð#Ð#Ð#Ø�!Œ9�QŒ<˜8Ò#Ð#Ð#Ð#ð	ð ð$ �!Œ9�QŒ<˜8Ò#Ð#Ð#Ð#Ð#Ð#r+   c            	      ó†  — ddl m} m} ddlm}  |dd¬¦  «        \  }}t          | d¦  «        \  }}} |d|¦  «        } |d	|¦  «        }	t          d
t          ||         |||	f         ||	         z  ¦  «        fdddd¬¦  «        \  \  }
}\  }}|
dk    sJ ‚d}||ddiz  k    s||ddiz  k    sJ ‚|dk    sJ ‚|dk    sJ ‚d S )Nr   rH   rÕ   zn,mTrN   ÚAxyrP   r×   rØ   rG  r   Fr‚   rH  a~  subroutine matrix_vector(A, m, n, x, y)
implicit none
INTEGER*4, intent(in) :: m
INTEGER*4, intent(in) :: n
REAL*8, intent(in), dimension(1:m, 1:n) :: A
REAL*8, intent(in), dimension(1:n) :: x
REAL*8, intent(out), dimension(1:m) :: y
INTEGER*4 :: i
INTEGER*4 :: j
do i = 1, m
   y(i) = 0
end do
do i = 1, m
   do j = 1, n
      y(i) = %(rhs)s + y(i)
   end do
end do
end subroutine
rÚ   úA(i, j)*x(j)úx(j)*A(i, j)r€   a  interface
subroutine matrix_vector(A, m, n, x, y)
implicit none
INTEGER*4, intent(in) :: m
INTEGER*4, intent(in) :: n
REAL*8, intent(in), dimension(1:m, 1:n) :: A
REAL*8, intent(in), dimension(1:n) :: x
REAL*8, intent(out), dimension(1:m) :: y
end subroutine
end interface
)rW   rI   rJ   rÞ   r   rX   r   r   rß   s                  r)   Ú
test_loopsr[  G  sN  € Ø-Ð-Ð-Ð-Ð-Ð-Ð-Ð-Ø)Ð)Ð)Ð)Ð)Ð)àˆ7�5 $Ð'Ñ'Ô'�D€A€qÝ�+˜uÑ%Ô%�G€A€qˆ!ØˆˆC�‰Œ€AØˆˆC�‰Œ€Aå")Ø	�"˜Q˜qœT 1 Q¨ T¤7¨1¨Q¬4¡<Ñ0Ô0Ð1°5¸&ÈÐV[ð#]ñ #]ô #]Ñ�J€Rˆ‘��Yð �ÒÐÐÐð	ð ð* �8˜u nÐ5Ñ5Ò5Ð5Ø�˜E >Ð2Ñ2Ò2Ð2Ð2ð3à�Š>ˆ>ˆ>ˆ>Øð		òð ð ð ð ð r+   c                  óh  — ddl m} m} t          ddt          ¬¦  «        \  }} | d¦  «        } | d¦  «        } |||¦  «        }d|j        j        |j        d	œz  }t          d
t          ||         ||         ¦  «        ¦  «        }t          ¦   «         }t          |j        |g¦  «        }	|	|k    sJ ‚d S )Nr   rH   rç   Trè   r4   r9   a>  subroutine test_dummies(m_%(mcount)i, x, y)
implicit none
INTEGER*4, intent(in) :: m_%(mcount)i
REAL*8, intent(in), dimension(1:m_%(mcount)i) :: x
REAL*8, intent(out), dimension(1:m_%(mcount)i) :: y
INTEGER*4 :: i_%(icount)i
do i_%(icount)i = 1, m_%(mcount)i
   y(i_%(icount)i) = x(i_%(icount)i)
end do
end subroutine
)ÚicountÚmcountrì   )rW   rI   rJ   r   r	   rY   rí   r   r   r   r*   r2  )
rI   rJ   rP   rM   r4   r9   rp   rZ   r  râ   s
             r)   Útest_dummy_loops_f95r_  z  sÔ   € Ø-Ð-Ð-Ð-Ð-Ð-Ð-Ð-Ý�5 $­EÐ2Ñ2Ô2�D€A€qØˆ�CÑÔ€AØˆ�CÑÔ€AØˆˆAˆq‰	Œ	€Að		ð ”7Ô&°!´-Ð@Ð@ñA€Hõ 	�^¥R¨¨!¬¨a°¬d¡^¤^Ñ4Ô4€AÝ‰
Œ
€AÝ�a”j 1 #Ñ&Ô&€DØ�8ÒÐÐÐÐÐr+   c            	      óè  — ddl m} m} ddlm}  |dd¬¦  «        \  }}}} |d¦  «        \  }}}	 | |¦  «         |||¦  «         |||¦  «        f         } | |¦  «         |||¦  «                 } | |	¦  «         |||¦  «                 }	t          dt          |	|	||z  z   ¦  «        fd	d
dd¬¦  «        \  \  }
}\  }}|
dk    sJ ‚d}||ddiz  k    s||ddiz  k    sJ ‚|dk    sJ ‚|dk    sJ ‚d S )Nr   rH   rÕ   zi,j,n,mTrN   zA,x,yrØ   rG  r   Fr‚   rH  aa  subroutine matrix_vector(A, m, n, x, y)
implicit none
INTEGER*4, intent(in) :: m
INTEGER*4, intent(in) :: n
REAL*8, intent(in), dimension(1:m, 1:n) :: A
REAL*8, intent(in), dimension(1:n) :: x
REAL*8, intent(inout), dimension(1:m) :: y
INTEGER*4 :: i
INTEGER*4 :: j
do i = 1, m
   do j = 1, n
      y(i) = %(rhs)s + y(i)
   end do
end do
end subroutine
rÚ   rY  rZ  r€   a  interface
subroutine matrix_vector(A, m, n, x, y)
implicit none
INTEGER*4, intent(in) :: m
INTEGER*4, intent(in) :: n
REAL*8, intent(in), dimension(1:m, 1:n) :: A
REAL*8, intent(in), dimension(1:n) :: x
REAL*8, intent(inout), dimension(1:m) :: y
end subroutine
end interface
rÝ   )rI   rJ   r   rP   r×   rà   rM   rK   r4   r9   rá   râ   rã   rä   rp   s                  r)   Útest_loops_InOutra  ’  sˆ  € Ø-Ð-Ð-Ð-Ð-Ð-Ð-Ð-Ø)Ð)Ð)Ð)Ð)Ð)à�˜¨DÐ1Ñ1Ô1�J€A€qˆ!ˆQØˆg�gÑÔ�G€A€qˆ!Øˆ�A‰Œ�s�s˜1˜a‘y”y # # a¨¡)¤)Ð+Ô,€AØˆ�A‰Œ�s�s˜1˜a‘y”yÔ!€AØˆ�A‰Œ�s�s˜1˜a‘y”yÔ!€Aå")Ø	�"˜Q  A a¡C¡™.œ.Ð)¨5°&ÀÈeð#Uñ #Uô #UÑ�J€Rˆ‘��Yð �ÒÐÐÐð	ð ð$ �H  ~Ð6Ñ6Ò6Ð6Ø�H  ~Ð6Ñ6Ò6Ð6Ð6ð7à�Š>ˆ>ˆ>ˆ>Øð		òð ð ð ð ð r+   c            	      ó   — ddl m} m} ddlm}  |dd¬¦  «        \  }}}} | d||f¬¦  «        } | d	¦  «        } | d
¦  «        }	 |d||dz
  f¦  «        }
 |d|¦  «        }t          dt          |	|
         ||
|f         ||         z  ¦  «        fdddd¬¦  «        \  \  }}\  }}ddt          |dz
  ¦  «        t          d|z   ¦  «        t          |dz
  |z
  ¦  «        dœz  }||ddiz  k    s||ddiz  k    sJ ‚d S d S )Nr   rH   rÕ   ró   TrN   rK   rô   r4   r9   rP   rö   r×   rØ   rG  r   Fr‚   aß  subroutine matrix_vector(A, m, n, o, p, x, y)
implicit none
INTEGER*4, intent(in) :: m
INTEGER*4, intent(in) :: n
INTEGER*4, intent(in) :: o
INTEGER*4, intent(in) :: p
REAL*8, intent(in), dimension(1:m, 1:p) :: A
REAL*8, intent(in), dimension(1:n) :: x
REAL*8, intent(out), dimension(1:%(iup-ilow)s) :: y
INTEGER*4 :: i
INTEGER*4 :: j
do i = %(ilow)s, %(iup)s
   y(i) = 0
end do
do i = %(ilow)s, %(iup)s
   do j = 1, n
      y(i) = %(rhs)s + y(i)
   end do
end do
end subroutine
rø   r÷   rR   )rÚ   ÚiupÚilowziup-ilowrÚ   rY  rZ  )rW   rI   rJ   rÞ   r   r   r   Ústrrú   s                    r)   Útest_partial_loops_frf  Ã  s�  € ð .Ð-Ð-Ð-Ð-Ð-Ð-Ð-Ø)Ð)Ð)Ð)Ð)Ð)Ø�˜¨DÐ1Ñ1Ô1�J€A€qˆ!ˆQØˆ�C  1˜vÐ&Ñ&Ô&€AØˆ�CÑÔ€AØˆ�CÑÔ€AØˆˆC�!�Q˜‘U�ÑÔ€AØˆˆC�‰Œ€Aå")Ø	�"˜Q˜qœT 1 Q¨ T¤7¨1¨Q¬4¡<Ñ0Ô0Ð1°5¸&ÈÐV[ð#]ñ #]ô #]Ñ�J€Rˆ‘��Yð	ð* Ý�1�q‘5‰zŒzÝ�A˜‘E‘
”
Ý˜˜A™ ™	‘N”Nð		ð 	ñ+€Hð8 �8˜u nÐ5Ñ5Ò5Ð5Ø�˜E >Ð2Ñ2Ò2Ð2Ð2ð3Ð5Ð5Ø2Ð2r+   c            	      óD  — ddl m}  ddlm}m} t          d¦  «        \  }}}t          d | | ||¦  «        ¦  «         ||¦  «        g¦  «        }t          ¦   «         }|                     |gddd¬¦  «        }|d         d         d	k    sJ ‚|d         d
         dk    sJ ‚d S )Nr   r
   rÿ   rk   r   r/   Fr‚   ztest.f90rR   z~REAL*8 function foo(x, y)
implicit none
REAL*8, intent(in) :: x
REAL*8, intent(out) :: y
y = sin(x)
foo = cos(x)
end function
)	r  r   rÁ   r©   rª   r   r   r   r  )	r   r©   rª   r4   r9   r5   rZ   r  r„   s	            r)   Útest_output_arg_frh  ò  sÚ   € Ø.Ð.Ð.Ð.Ð.Ð.ØCÐCÐCÐCÐCÐCÐCÐCÝ�gÑÔ�G€A€qˆ!Ý�U˜X˜X a¨¨¨Q©¬Ñ0Ô0°#°#°a±&´&Ð9Ñ:Ô:€AÝ‰
Œ
€AØ�WŠW�a�S˜&¨°eˆWÑ<Ô<€FØ�!Œ9�QŒ<˜:Ò%Ð%Ð%Ð%Ø�!Œ9�QŒ<ð	òð ð ð ð ð r+   c            
      ó¾  — ddl m} m} ddlm}  |dd¬¦  «        \  }}t          | d¦  «        \  }}} |d|¦  «        }t          ¦   «         }	t          d	t          |||d
z   z  ¦  «        ¦  «        }
t          dt          ||          |
||         ¦  «        ¦  «        ¦  «        }t          |	j        |g¦  «        }d}d}|||z  k    s|||d d d…         z  k    sJ ‚d S d S )Nr   rH   rÕ   rÖ   TrN   rX  rP   ÚfuncrR   Útest_inlinezÛsubroutine test_inline(m, x, y)
implicit none
INTEGER*4, intent(in) :: m
REAL*8, intent(in), dimension(1:m) :: x
REAL*8, intent(out), dimension(1:m) :: y
INTEGER*4 :: i
do i = 1, m
   y(i) = %s*%s
end do
end subroutine
)zx(i)z
(x(i) + 1)r  )rW   rI   rJ   rÞ   r   rX   r   r   r   r   r   r*   r2  )rI   rJ   r   rà   rM   rK   r4   r9   rP   rü   rj  ro   râ   rp   Úargss                  r)   Útest_inline_functionrm    s  € Ø-Ð-Ð-Ð-Ð-Ð-Ð-Ð-Ø)Ð)Ð)Ð)Ð)Ð)Øˆ7�5 $Ð'Ñ'Ô'�D€A€qÝ�+˜uÑ%Ô%�G€A€qˆ!ØˆˆC�‰Œ€AÝ‰
Œ
€AÝ ­¨q°!°Q¸±U±)Ñ(<Ô(<Ñ=Ô=€DÝ˜=­"¨Q¨q¬T°4°4¸¸!¼±:´:Ñ*>Ô*>Ñ?Ô?€GÝ�a”j 7 )Ñ,Ô,€Dð		ð ð "€DØ�8˜d‘?Ò"Ð"Ø�˜4   " œ:Ñ%Ò%Ð%Ð%ð&Ð"Ð"Ø%Ð%r+   c                  ó¸   — t          d¦  «        } d}| D ]}||z  }Œt          d|¦  «        }t          ¦   «         }t          |j        |g¦  «        }d}||k    sJ ‚d S )Nzx:20r   r/   a  REAL*8 function test(x0, x1, x10, x11, x12, x13, x14, x15, x16, x17, x18, &
      x19, x2, x3, x4, x5, x6, x7, x8, x9)
implicit none
REAL*8, intent(in) :: x0
REAL*8, intent(in) :: x1
REAL*8, intent(in) :: x10
REAL*8, intent(in) :: x11
REAL*8, intent(in) :: x12
REAL*8, intent(in) :: x13
REAL*8, intent(in) :: x14
REAL*8, intent(in) :: x15
REAL*8, intent(in) :: x16
REAL*8, intent(in) :: x17
REAL*8, intent(in) :: x18
REAL*8, intent(in) :: x19
REAL*8, intent(in) :: x2
REAL*8, intent(in) :: x3
REAL*8, intent(in) :: x4
REAL*8, intent(in) :: x5
REAL*8, intent(in) :: x6
REAL*8, intent(in) :: x7
REAL*8, intent(in) :: x8
REAL*8, intent(in) :: x9
test = x0 + x1 + x10 + x11 + x12 + x13 + x14 + x15 + x16 + x17 + x18 + &
      x19 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9
end function
r:  )r4   r3   Úsymro   r`   r(   rp   s          r)   Útest_f_code_call_signature_wraprp     sx   € å�‰Œ€AØ€DØð ð ˆØ�‰ˆˆÝ˜6 4Ñ(Ô(€GÝ‰zŒz€HÝ˜Ô)¨G¨9Ñ5Ô5€Fð€Hð8 �XÒÐÐÐÐÐr+   c                  ó`   ‡ ‡— t          d¦  «        \  ŠŠ t          t          ˆ ˆfd„¦  «         d S )Nzx,Xc                  ó0   •— t          d‰‰ z  fdd¦  «        S )Nr/   Úf95r$   )r   ©r)  r4   s   €€r)   r6   z!test_check_case.<locals>.<lambda>J  s   ø€ ¥¨&°!°A±#¨¸¸xÑ!HÔ!H€ r+   )r   r   r   rt  s   @@r)   Útest_check_caseru  H  s6   øø€ Ý�5‰>Œ>�D€A€qÝ
�<ÐHÐHÐHÐHÐHÑIÔIÐIÐIÐIr+   c                  ó  — t          d¦  «        } t          dd¬¦  «        }	 t          d| |z  fdd¦  «         d S # t          $ r:}|j        d                              d¦  «        rt          d	¦  «        ‚Y d }~d S d }~ww xY w)
Nr4   T)Úmy_assumptionr/   rs  r$   r   zFortran ignores case.z$This exception should not be raised!)r   r   r   rl  Ú
startswithÚAssertionError)Úx1Úx2r"  s      r)   Útest_check_case_false_positiver|  M  s»   € õ
 
�‰Œ€BÝ	� DÐ	)Ñ	)Ô	)€BðIÝ�˜˜B™� ¨Ñ1Ô1Ð1Ð1Ð1øÝð Ið Ið IØŒ6�!Œ9×ÒÐ 7Ñ8Ô8ð 	IÝ Ð!GÑHÔHÐHð	Ið 	Ið 	Ið 	Ið 	Ið 	IøøøøðIøøøs   ¢: º
A>Á/A9Á9A>c                  ó,  — t          d¦  «        \  } }dd| z  fg}t          |ddd¬¦  «        }t          |dddd¬¦  «        }|d         d         |d         d         k    sJ ‚d| |z  f}t          |ddd¬¦  «        }t          |dddd¬¦  «        }|d         d         |d         d         k    sJ ‚dt          | |g| |z   | |z
  gg¦  «        f}t          |d	dd¬¦  «        }t          |d	ddd¬¦  «        }|d         d         |d         d         k    sJ ‚d S )
NrÇ   r   rS   rG  Fr‚   r   rR   r»   )r   r   r   )r4   r9   rÂ   r„   Ú	expresults        r)   Ú test_c_fortran_omit_routine_namer  [  sG  € Ý�5‰>Œ>�D€A€qØ˜˜1™��€IÝ�Y ¨e¸5ÐAÑAÔA€FÝ˜	 5¨%¸ÀUÐKÑKÔK€IØ�!Œ9�QŒ<˜9 Qœ<¨œ?Ò*Ð*Ð*Ð*à˜˜!™�€IÝ�Y ¨e¸5ÐAÑAÔA€FÝ˜	 5¨%¸ÀUÐKÑKÔK€IØ�!Œ9�QŒ<˜9 Qœ<¨œ?Ò*Ð*Ð*Ð*à�  A ¨¨1©¨a°©c¨
Ð3Ñ4Ô4Ð5€IÝ�Y ¨e¸5ÐAÑAÔA€FÝ˜	 5¨%¸ÀUÐKÑKÔK€IØ�!Œ9�QŒ<˜9 Qœ<¨œ?Ò*Ð*Ð*Ð*Ð*Ð*r+   c                  ó@  — t          d¦  «        \  } }}| |z   }t          | |g|dgg¦  «        }d||ff}t          |dddd¬¦  «        }|d         d         }d	}|                     ¦   «         d
         }	|	                     d¦  «        }
|
d         }|d|iz  }||k    sJ ‚d S )Nrk   é   r/   rs  Fr‚   r   rR   a2  REAL*8 function test(x, y, z, out_%(hash)s)
implicit none
REAL*8, intent(in) :: x
REAL*8, intent(in) :: y
REAL*8, intent(in) :: z
REAL*8, intent(out), dimension(1:2, 1:2) :: out_%(hash)s
out_%(hash)s(1, 1) = x
out_%(hash)s(2, 1) = z
out_%(hash)s(1, 2) = y
out_%(hash)s(2, 2) = 16
test = x + y
end function
rö   Ú_Úhash)r   r   r   Ú
splitlinesÚsplit)r4   r9   r5   Úe1Úe2rÂ   r„   r(   rp   r8   r  r  s               r)   Útest_fcode_matrix_outputrˆ  m  sÊ   € Ý�gÑÔ�G€A€qˆ!Ø	
ˆQ‰€BÝ	�!�Q�˜!˜R˜Ð!Ñ	"Ô	"€BØ˜"˜b˜Ð"€IÝ�Y  v°eÀ5ÐIÑIÔI€FØ�AŒY�qŒ\€Fð	ð ð 	×ÒÑÔ˜AÔ€AØ	�Š�‰Œ€AØ
ˆAŒ$€CØ˜6 3˜-Ñ'€HØ�XÒÐÐÐÐÐr+   c                  óz  — t          d¦  «        \  } }}t          d¦  «        \  }}t          ddd¦  «        }t          |t          dd| gg¦  «        ¦  «        }t          || |z   |z  ¦  «        }t          |d| z  ¦  «        }d|||gf}	t	          |	ddd	d	| |||||f¬
¦  «        }
|
d         d         }d}||k    sJ ‚d S )Nrk   r  rK   rR   rT   rS   r/   rs  Fr  r   a!  subroutine test(x, z, y, C, A, B)
implicit none
REAL*8, intent(in) :: x
REAL*8, intent(in) :: z
REAL*8, intent(in) :: y
REAL*8, intent(out) :: C
REAL*8, intent(out) :: B
REAL*8, intent(out), dimension(1:1, 1:3) :: A
C = z*(x + y)
A(1, 1) = 1
A(1, 2) = 2
A(1, 3) = x
B = 2*x
end subroutine
r  )r4   r9   r5   rL   r�   rK   r�   rŽ   r  rÂ   r„   r(   rp   s                r)   Ú test_fcode_results_named_orderedrŠ  Š  sí   € Ý�gÑÔ�G€A€qˆ!Ý�5‰>Œ>�D€A€qÝ�S˜!˜QÑÔ€AÝ�Q�  A q 	˜{Ñ+Ô+Ñ,Ô,€EÝ�Q˜˜Q™ ™	Ñ"Ô"€EÝ�Q˜˜!™ÑÔ€EØ˜% ¨Ð.Ð/€IÝ�Y  v°eÀ5Ø()¨1¨a°°A°qÐ'9ð;ñ ;ô ;€Fà�AŒY�qŒ\€Fð	ð ð  �XÒÐÐÐÐÐr+   c            	      ó„  — t          ddd¦  «        } t          ddd¦  «        }t          ddd¦  «        }t          ddd¦  «        }dt          || d	d d …f         ¦  «        t          || dd d …f         ¦  «        t          || d d …df         ¦  «        gf}t          |d
ddd¬¦  «        }|d	         d         }d}||k    sJ ‚d S )NrK   rS   rT   rL   rR   r�   r  r/   r   rs  Fr‚   a€  subroutine test(A, B, C, D)
implicit none
REAL*8, intent(in), dimension(1:2, 1:3) :: A
REAL*8, intent(out), dimension(1:1, 1:3) :: B
REAL*8, intent(out), dimension(1:1, 1:3) :: C
REAL*8, intent(out), dimension(1:2, 1:1) :: D
B(1, 1) = A(1, 1)
B(1, 2) = A(1, 2)
B(1, 3) = A(1, 3)
C(1, 1) = A(2, 1)
C(1, 2) = A(2, 2)
C(1, 3) = A(2, 3)
D(1, 1) = A(1, 3)
D(2, 1) = A(2, 3)
end subroutine
r  r  s           r)   Útest_fcode_matrixsymbol_slicerŒ  ¨  sé   € Ý�S˜!˜QÑÔ€AÝ�S˜!˜QÑÔ€AÝ�S˜!˜QÑÔ€AÝ�S˜!˜QÑÔ€AØ�( 1 a¨¨1¨1¨1¨¤gÑ.Ô.Ý" 1 a¨¨1¨1¨1¨¤gÑ.Ô.Ý" 1 a¨¨¨¨1¨¤gÑ.Ô.ð0ð 1€Iõ �Y  v°eÀ5ÐIÑIÔI€FØ�AŒY�qŒ\€Fð	ð ð" �XÒÐÐÐÐÐr+   c                  ó  — t          ddd¦  «        } d| d d …df         f}t          |dddd¬¦  «        }|d	         d         }d
}|                     ¦   «         d         }|                     d¦  «        }|d         }|d|iz  }||k    sJ ‚d S )NrK   rS   rT   r/   rR   rs  Fr‚   r   zÞsubroutine test(A, out_%(hash)s)
implicit none
REAL*8, intent(in), dimension(1:2, 1:3) :: A
REAL*8, intent(out), dimension(1:2, 1:1) :: out_%(hash)s
out_%(hash)s(1, 1) = A(1, 2)
out_%(hash)s(2, 1) = A(2, 2)
end subroutine
r‚  rƒ  )r   r   r„  r…  )rK   rÂ   r„   r(   rp   r8   r  r  s           r)   Ú&test_fcode_matrixsymbol_slice_autonamerŽ  Æ  s­   € å�S˜!˜QÑÔ€AØ˜˜1˜1˜1˜a˜4œÐ!€IÝ�Y  v°eÀ5ÐIÑIÔI€FØ�AŒY�qŒ\€Fð	ð ð 	×ÒÑÔ˜AÔ€AØ	�Š�‰Œ€AØ
ˆAŒ$€CØ˜6 3˜-Ñ'€HØ�XÒÐÐÐÐÐr+   c                  óþ   — t          d¦  «        \  } }}}t          d| |z  fddd|f¬¦  «        }|d         d         }d}||k    sJ ‚d	}t          d| |z  |z   fd
dd||f¬¦  «        }|d         d         }||k    sJ ‚d S )Nzx y z tÚfrG  F)r%   r&   Úglobal_varsr   rR   zPREAL*8 function f(x)
implicit none
REAL*8, intent(in) :: x
f = x*y
end function
z�#include "f.h"
#include <math.h>
double f(double x, double y) {
   double f_result;
   f_result = x*y + z;
   return f_result;
}
r�   rƒ   )r4   r9   r5   Útr„   r(   rp   s          r)   Útest_global_varsr“  Ý  sÉ   € Ý˜Ñ#Ô#�J€A€qˆ!ˆQÝ�c˜1˜Q™3�Z ¨u¸EØ"# ð'ñ 'ô '€Fà�AŒY�qŒ\€Fð	ð ð �XÒÐÐÐð	ð õ �c˜1˜Q™3˜q™5�\ 3¨u¸EØ"# Q ð)ñ )ô )€Fà�AŒY�qŒ\€FØ�XÒÐÐÐÐÐr+   c                  óª  — ddl m}  ddlm}  | dddii¬¦  «        }t	          d¦  «        \  }} |||z   ¦  «        }t          |d	g¬
¦  «        }d}t          d|fdd|¬¦  «        }|d         d         }	|	|k    sJ ‚t          |¬¦  «        }|j                             d	¦  «         d}t          d|fdd|¬¦  «        }|d         d         }	|	|k    sJ ‚d S )Nr   ©ÚC99CodePrinter)ÚexpÚuser_functionsr—  Úfastexp)Úsettingszx yz#include "fastexp.h")ÚprinterÚpreprocessor_statementszš#include "expr.h"
#include "fastexp.h"
double expr(double x, double y) {
   double expr_result;
   expr_result = fastexp(x + y);
   return expr_result;
}
r3   F)r%   r&   r`   rR   )r›  z¬#include "expr.h"
#include <math.h>
#include "fastexp.h"
double expr(double x, double y) {
   double expr_result;
   expr_result = fastexp(x + y);
   return expr_result;
}
)	Úsympy.printing.cr–  r½   r—  r   r   r   rœ  Úappend)
r–  r—  r›  r4   r9   r3   Úgenrp   r„   r(   s
             r)   Útest_custom_codegenr   ù  s<  € Ø/Ð/Ð/Ð/Ð/Ð/Ø:Ð:Ð:Ð:Ð:Ð:àˆnÐ'7¸%ÀÐ9KÐ&LÐMÑMÔM€Gå�5‰>Œ>�D€A€qØˆ3ˆq�1‰u‰:Œ:€Dõ ˜WØ.DÐ-EðGñ Gô G€Cð	ð õ �f˜d�^¨E¸ÈÐMÑMÔM€FØ�AŒY�qŒ\€FØ�XÒÐÐÐõ ˜WÐ
%Ñ
%Ô
%€CØÔ×&Ò&Ð'=Ñ>Ô>Ð>ð	ð õ �f˜d�^¨E¸ÈÐMÑMÔM€FØ�AŒY�qŒ\€FØ�XÒÐÐÐÐÐr+   c            	      ó¬   — ddl m}   G d„ d| ¦  «        }t          d¦  «        }|dz  }ddg}t          d	|fd
ddd |¦   «         ¬¦  «        }||k    sJ ‚d S )Nr   r•  c                   ó   — e Zd Zd„ ZdS )ú*test_c_with_printer.<locals>.CustomPrinterc                 óŽ   — d                      |                      |j        ¦  «        |                      |j        ¦  «        ¦  «        S )Nzfastpow({}, {}))ÚformatÚ_printÚbaser—  )Úselfr3   s     r)   Ú
_print_Powz5test_c_with_printer.<locals>.CustomPrinter._print_Pow+  s>   € Ø$×+Ò+¨D¯KªK¸¼	Ñ,BÔ,BØ,0¯KªK¸¼Ñ,AÔ,AñCô Cð Cr+   N)Ú__name__Ú
__module__Ú__qualname__r©  r;   r+   r)   ÚCustomPrinterr£  *  s(   € € € € € ð	Cð 	Cð 	Cð 	Cð 	Cr+   r­  r4   rT   )r   zŒ#include "file.h"
#include <math.h>
double test(double x) {
   double test_result;
   test_result = fastpow(x, 3);
   return test_result;
}
)r€   zP#ifndef PROJECT__FILE__H
#define PROJECT__FILE__H
double test(double x);
#endif
r/   r�   r   F)r%   r&   r›  )r�  r–  r   r   )r–  r­  r4   r3   rp   r„   s         r)   Útest_c_with_printerr®  '  s®   € à/Ð/Ð/Ð/Ð/Ð/ðCð Cð Cð Cð C˜ñ Cô Cð Cõ
 	�‰Œ€AØˆa‰4€Dð	ð	ð€Hõ �f˜d�^ S¨¸ÀUÐVcÐVcÑVeÔVeÐfÑfÔf€FØ�XÒÐÐÐÐÐr+   c                  óš  — dd l } d| j        j        _        t	          dd¬¦  «        }t	          dd¬¦  «        }t          d||z   fdddd¬	¦  «        }|d         d
         }d}||k    sJ ‚t	          d¦  «        }t	          dd¬¦  «        }t          d||z   fdddd¬	¦  «        }|d         d
         }d}||k    sJ ‚d| j        j        _        d S )Nr   Tr4   )Úrealr9   r/   rs  Fr‚   rR   zsREAL*8 function test(x, y)
implicit none
REAL*8, intent(in) :: x
REAL*8, intent(in) :: y
test = x + y
end function
z{COMPLEX*16 function test(x, y)
implicit none
COMPLEX*16, intent(in) :: x
REAL*8, intent(in) :: y
test = x + y
end function
)Úsympy.utilities.codegenÚ	utilitiesr   ÚCOMPLEX_ALLOWEDr   )Úsympyr4   r9   r„   r(   rp   s         r)   Útest_fcode_complexrµ  D  s  € Ø"Ð"Ð"Ð"Ø.2€E„OÔÔ+Ýˆs˜ÐÑÔ€AÝˆs˜ÐÑÔ€AÝ�f˜Q˜q™S�\ 5¨&¸ÀeÐLÑLÔL€FØ�QŒi˜Œl€Fð	ð ð �XÒÐÐÐÝˆs‰Œ€AÝˆs˜ÐÑÔ€AÝ�f˜Q˜q™S�\ 5¨&¸ÀeÐLÑLÔL€FØ�QŒi˜Œl€Fð	ð ð �8ÒÐÐÐØ.3€E„OÔÔ+Ð+Ð+r+   N)r   FF)_Úior   Ú
sympy.corer   r   r   r   r   r	   r  r   rÞ   r   Ú'sympy.functions.special.error_functionsr   Úsympy.integrals.integralsr   Úsympy.matricesr   r   r±  r   r   r   r   r   r   r   r   r   r   r   Úsympy.testing.pytestr   Úsympy.utilities.lambdifyr   r*   r[   ra   rf   ri   rq   rs   rx   rz   r}   r…   r�   r–   rÃ   rË   rÓ   rå   rñ   rý   r  r	  r  r  r   r%  r'  r-  r3  r5  r7  r;  r=  r@  rB  rE  rI  rL  rO  rR  rT  rV  r[  r_  ra  rf  rh  rm  rp  ru  r|  r  rˆ  rŠ  rŒ  rŽ  r“  r   r®  rµ  r;   r+   r)   ú<module>r½     s÷  ðØ Ð Ð Ð Ð Ð à >Ð >Ð >Ð >Ð >Ð >Ð >Ð >Ð >Ð >Ð >Ð >Ð >Ð >Ð >Ð >Ø *Ð *Ð *Ð *Ð *Ð *Ø $Ð $Ð $Ð $Ð $Ð $Ø 7Ð 7Ð 7Ð 7Ð 7Ð 7Ø .Ð .Ð .Ð .Ð .Ð .Ø /Ð /Ð /Ð /Ð /Ð /Ð /Ð /ðð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð (Ð 'Ð 'Ð 'Ð 'Ð 'Ø 9Ð 9Ð 9Ð 9Ð 9Ð 9ðð ð ð ð?ð ?ð ?ð6@ð @ð @ðð ð ð$Tð Tð Tðð ð ð$ð ð ð$ð ð ð"ð ð ð$ð ð ðð ð ð,	Ið 	Ið 	Ið9ð 9ð 9ð9ð 9ð 9ðxð ð ð0Að Að AðH'ð 'ð 'ðT$ð $ð $ð.)ð )ð )ðX$ð $ð $ð*$ð $ð $ð*ð ð ð.ð ð ð4ð ð ð:ð ð ð(ð ð ð&ð ð ð&ð ð ðð ð ð ð ð ðð ð ð$ð ð ð&ð &ð &ðð ð ð$ð ð ð&ð ð ð6	Ið 	Ið 	Ið9ð 9ð 9ðo$ð o$ð o$ðd+$ð +$ð +$ð\;$ð ;$ð ;$ð|0ð 0ð 0ðfð ð ð0.ð .ð .ðb,3ð ,3ð ,3ð^ð ð ð&&ð &ð &ð6%ð %ð %ðPJð Jð Jð
Ið Ið Ið+ð +ð +ð$ð ð ð:ð ð ð<ð ð ð<ð ð ð.ð ð ð8,ð ,ð ,ð\ð ð ð:4ð 4ð 4ð 4ð 4r+   