Ë
    7^(hBÛ  ã                   ó   — 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# dGd„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-„ ZFd.„ ZGd/„ ZHd0„ ZId1„ ZJd2„ ZKd3„ ZLd4„ ZMd5„ ZNd6„ ZOd7„ ZPd8„ ZQd9„ ZRd:„ ZSd;„ ZTd<„ ZUd=„ ZVd>„ ZWd?„ ZXd@„ ZYdA„ ZZdB„ Z[dC„ Z\dD„ Z]dE„ Z^yF)Hé    )Ú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_functionc                 ór   — t        «       } | |||||«       |j                  «       }|j                  «        |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/skyplay_api_hub/venv/lib/python3.12/site-packages/sympy/utilities/tests/test_codegen.pyÚ
get_stringr)      s5   € ô ‹Z€FÙˆH�f˜f f¨eÔ4Ø�_‰_Ó€FØ
‡L�L„NØ€Mó    c                  óZ  ‡‡	‡
‡‡— t        d«      \  ŠŠ
ŠŠ‰
‰z   ‰z  Š	t        t        ˆ	ˆ
ˆfd„«       t        t        ˆˆ	ˆ
ˆˆfd„«       t        dt	        ‰‰	«      ‰‰
‰‰g¬«      } | j
                  D �cg c]  }|j                  ‘Œ c}‰‰
‰‰gk(  sJ ‚| j
                  D �cg c]  }t        |«      ‘Œ c}t        t        t        t        gk(  sJ ‚t        dt	        ‰‰	«      ‰‰
‰g¬«      } | j
                  D �cg c]  }t        |«      ‘Œ c}t        t        t        gk(  sJ ‚ddlm}m} t        |dd	g«      \  }}t        d
d¬«      } |d|«      }t        dt	        ||   ||   «      |||g¬«      } | j
                  D �cg c]  }|j                  ‘Œ c}|j                  |j                  |gk(  sJ ‚t!        ‰
‰z  ‰z  ‰
ddf‰ddf«      Š	t        dt	        ‰‰	«      ‰‰
‰‰g¬«      } | j
                  D �cg c]  }|j                  ‘Œ c}‰‰
‰‰gk(  sJ ‚y c c}w c c}w c c}w c c}w c c}w )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                  ó:   •— t        dt        ‰ ‰«      ‰‰‰g¬«      S r-   )r   r   )Úar2   r3   Úyr4   s   €€€€€r(   r5   z-test_Routine_argument_order.<locals>.<lambda>(   s$   ø€ ¬\¸&Ä"ÀQØóCØ%&¨¨1 Iô./€ r*   r.   r/   r   ©ÚIndexedBaseÚIdxÚAÚBÚmT©ÚintegerÚié   é   é   )r   r   r   r   r   Ú	argumentsÚnameÚtyper   r   r   Úsympy.tensorr:   r;   ÚmapÚlabelr   )ÚrÚargr:   r;   r<   r=   r>   rA   r7   r2   r3   r8   r4   s           @@@@@r(   Útest_Routine_argument_orderrM   #   s	  ü€ Ü˜Ó#�J€A€qˆ!ˆQØ�‰E�1‰9€DÜ
Ô#õ &%ô &ä
Ô#÷ &/ô 0ä�VœR  4›[¸QÀÀ1Àa¸LÔI€AØ!"§¡Ö.˜#ˆS�X‹XÒ.°1°a¸¸A°,Ò>Ð>Ð>Ø"#§+¡+Ö/˜3ŒT�#�YÒ/Ü”}¤n´mð4Gò Gð Gð Gä�VœR  4›[¸QÀÀ1¸IÔF€AØ"#§+¡+Ö/˜3ŒT�#�YÒ/Ü”}¤mð46ò 6ð 6ð 6÷ .Üˆ{˜S #˜JÓ'�D€A€qÜ�˜TÔ"€AÙˆC�‹€AÜ�VœR  !¡ a¨¡d›^ÀÀ1Àa¸yÔI€AØ!"§¡Ö.˜#ˆS�X‹XÒ.°1·7±7¸A¿G¹GÀQÐ2GÒGÐGÐGä�A�a‘C˜‘E˜A˜q !˜9 q¨!¨Q iÓ0€DÜ�VœR  4›[¸QÀÀ1Àa¸LÔI€AØ!"§¡Ö.˜#ˆS�X‹XÒ.°1°a¸¸A°,Ò>Ð>Ñ>ùò! /ùÚ/ùò 0ùò /ùò /s   Á4HÂ!HÃ8HÅ?H#Ç4H(c                  óR   — t        «       } t        | j                  g «      }|dk(  sJ ‚y )Nz$#include "file.h"
#include <math.h>
©r   r)   Údump_c©Úcode_genr'   s     r(   Útest_empty_c_coderS   >   s(   € Ü‹|€HÜ˜Ÿ™¨Ó,€FØÐ?Ò?Ð?Ñ?r*   c                  óp   — t        «       } t        | j                  g d¬«      }|d d dk(  sJ ‚|dd  dk(  sJ ‚y )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>
rO   rQ   s     r(   Útest_empty_c_code_with_commentrX   D   sV   € Ü‹|€HÜ˜Ÿ™¨°DÔ9€FØ�#�2ˆ;Ø]òð ð ð �#�$ˆ<ð ["ò ð ñ r*   c                  óR   — t        «       } t        | j                  g «      }|dk(  sJ ‚y )Nz9#ifndef PROJECT__FILE__H
#define PROJECT__FILE__H
#endif
)r   r)   Údump_hrQ   s     r(   Útest_empty_c_headerr[   V   s(   € Ü‹|€HÜ˜Ÿ™¨Ó,€FØÐSÒSÐSÑSr*   c                  óž   — t        d«      \  } }}| |z   |z  }t        d|«      }t        «       }t        |j                  |g«      }d}||k(  sJ ‚y )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)   rP   ©r3   r8   r4   r2   ÚroutinerR   r'   Úexpecteds           r(   Útest_simple_c_coderc   \   s^   € Ü�gÓ�G€A€qˆ!Ø�‰E�1‰9€DÜ˜6 4Ó(€GÜ‹|€HÜ˜Ÿ™¨'¨Ó3€Fð	ð ð �XÒÐÑr*   c                  óž   — t        d«      \  } }}| |z   |z  }t        d|«      }t        «       }t        |j                  |g«      }d}||k(  sJ ‚y )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)   rP   r`   s           r(   Útest_c_code_reserved_wordsre   n   s_   € ÜÐ*Ó+�G€A€qˆ!Ø�‰E�Q‰;€DÜ˜6 4Ó(€GÜ‹|€HÜ˜Ÿ™¨'¨Ó3€Fð	ð ð �XÒÐÑr*   c                  ó²   — t        dt        t        z  «      } t        «       }t	        |j
                  | g«      }dt        j                  d«      z  }||k(  sJ ‚y )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)   rP   Úevalf©ra   rR   r'   rb   s       r(   Útest_numbersymbol_c_coderj   €   sU   € Ü˜6¤2¤w¡;Ó/€GÜ‹|€HÜ˜Ÿ™¨'¨Ó3€Fð	ô 	�‰�bÓñ	€Hð �XÒÐÑr*   c                  ó¢   — t        d«      \  } }}| |z   }t        d||| |g¬«      }t        «       }t        |j                  |g«      }d}||k(  sJ ‚y )Nr]   r.   r/   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;
}
r_   r`   s           r(   Útest_c_code_argument_orderrl   ‘   sb   € Ü�gÓ�G€A€qˆ!Øˆq‰5€DÜ˜6 4¸A¸qÀ!¸9ÔE€GÜ‹|€HÜ˜Ÿ™¨'¨Ó3€Fð	ð ð �XÒÐÑr*   c                  óž   — t        d«      \  } }}| |z   |z  }t        d|«      }t        «       }t        |j                  |g«      }d}||k(  sJ ‚y )Nr]   r.   úd#ifndef PROJECT__FILE__H
#define PROJECT__FILE__H
double test(double x, double y, double z);
#endif
)r   r   r   r)   rZ   r`   s           r(   Útest_simple_c_headerro   £   s^   € Ü�gÓ�G€A€qˆ!Ø�‰E�1‰9€DÜ˜6 4Ó(€GÜ‹|€HÜ˜Ÿ™¨'¨Ó3€Fð	ð ð �XÒÐÑr*   c                  ól   — t        d«      \  } }}| |z   |z  }ddg}t        d|fdddd¬«      }||k(  sJ ‚y )	Nr]   )úfile.cr^   )úfile.hrn   r.   ÚCÚfileF©r$   r%   ©r   r   )r3   r8   r4   r2   rb   Úresults         r(   Útest_simple_c_codegenrx   ²   sV   € Ü�gÓ�G€A€qˆ!Ø�‰E�1‰9€Dð	ð	ð€Hô �f˜d�^ S¨&¸ÀeÔL€FØ�XÒÐÑr*   c                  óž   ‡‡— t        d«      \  } }}| |z   |z  }| |z
  |z  }t        d||g«      Št        «       Št        t        ˆˆfd„«       y )Nr]   r.   c                  ó2   •— t        ‰ j                  ‰g«      S ©N©r)   rZ   ©rR   ra   s   €€r(   r5   z)test_multiple_results_c.<locals>.<lambda>Ñ   ó   ø€ ¤¨H¯O©O¸g¸YÓ!G€ r*   )r   r   r   r   r   ©r3   r8   r4   Úexpr1Úexpr2rR   ra   s        @@r(   Útest_multiple_results_cr‚   È   sU   ù€ Ü�gÓ�G€A€qˆ!Ø�‰U�A‰I€EØ�‰U�A‰I€EÜØØ	�ˆó€Gô ‹|€HÜ
Œ<ÔGÕHr*   c                  ó&   — t        t        d„ «       y )Nc                  ó   — t        dg «      S ©Nr.   r1   © r*   r(   r5   z#test_no_results_c.<locals>.<lambda>Õ   ó   € œ|¨F°BÓ7€ r*   ©r   Ú
ValueErrorr†   r*   r(   Útest_no_results_crŠ   Ô   ó   € Ü
Œ:Ñ7Õ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 ‚y )!Nr   ©ÚAbs©Úlog©ÚcoshÚsinhÚtanh)ÚceilingÚfloor©Úsqrt©ÚacosÚasinÚatanÚcosÚsinÚtanr3   Ú	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ÚC89rt   Fru   rq   rB   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;
}
rr   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Ÿ   r3   Ú	name_exprrw   s                    r(   Útest_ansi_math1_codegenr·   Ø   s_  € å8Ý:ßHÑHßDÝ=ßZ×ZÜ�‹€Aà	‘c˜!“fÐØ	‘d˜1“gÐØ	‘d˜1“gÐØ	‘d˜1“gÐØ	‘g˜a“jÐ!Ø	‘S˜“VÐØ	‘d˜1“gÐØ	‘u˜Q“xÐ Ø	‘S˜“VÐØ	‘C˜“FÐØ	‘S˜“VÐØ	‘d˜1“gÐØ	‘d˜1“gÐØ	‘S˜“VÐØ	‘d˜1“gÐð€Iô" �Y  v°eÀ5Ô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 ‚y )Nr   ©Úatan2úx,yÚ
test_atan2Útest_powr¯   rt   Fru   rq   rB   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;
}
rr   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º   r3   r8   r¶   rw   s        r(   Útest_ansi_math2_codegenr¿     s´   € å>Ü�5‹>�D€A€qà	‘u˜Q “{Ð#Ø	�Q˜‘TÐð€Iô �Y  v°eÀ5Ô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  j                  «       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 ‚y )Nr   ©r�   rž   rŸ   r]   Útest1é   Útest2r¯   rt   Fru   rq   rB   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;
}
rr   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Ÿ   r3   r8   r4   r¶   rw   s           r(   Útest_complicated_codegenrÇ   ,  s  € ßHÑHÜ�gÓ�G€A€qˆ!à	‘C˜“F™S ›V‘O¡c¨!£fÑ,¨qÑ0×8Ñ8Ó:Ð;Ø	‘#‘c™#™c¡#¡c©#©c°!°a±%¸!±)«nÓ*=Ó&>Ó"?Ó@ÓAÓBÓCÐDð€Iô �Y  v°eÀ5ÔI€FØ�!‰9�Q‰<˜8Ò#Ð#Ð#Ø�!‰9�Q‰<ð.	ò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 ‚y )Nr   r9   ©r   ún mTr?   r<   r3   r8   rA   ÚjÚmatrix_vectorÚC99rt   Fru   rq   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]rr   z|#ifndef PROJECT__FILE__H
#define PROJECT__FILE__H
void matrix_vector(double *A, int m, int n, double *x, double *y);
#endif
©rH   r:   r;   Úsympy.core.symbolr   r   r   ©r:   r;   r   Únr>   r<   r3   r8   rA   rË   Úf1ÚcodeÚf2Ú	interfacerb   s                  r(   Útest_loops_crÙ   p  sW  € ß-Ý)Ù�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Ð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Ñ'?Ð@Ñ@Ò@ðBð 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 «       y # 1 sw Y   y xY w)Nr   r9   úi mT©r@   Úclsr3   r8   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)rH   r:   r;   r   r	   rJ   Údummy_indexr   r   r   r   r)   rP   r   ÚNotImplementedError)r:   r;   rA   r>   r3   r8   rb   rK   Úc89Úc99rÖ   s              r(   Útest_dummy_loops_crå   š  sÒ   € ß-Ü�5 $¬EÔ2�D€A€qÙ�CÓ€AÙ�CÓ€AÙˆAˆq‹	€Að	ð —‘×#Ñ#¨A¯M©MÑ:ñ;€Hô 	�^¤R¨¨!©¨a°©d£^Ó4€AÜ
‹,€CÜ
‹,€CÜ�c—j‘j 1 #Ó&€DØ�8ÒÐÐÜ	Ô#Ó	$ñ $Ü�3—:‘: ˜sÔ#÷$÷ $ñ $ús   Â: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 ‚y )Nr   r9   rÉ   ún m o pTr?   r<   ©Úshaper3   r8   rA   é   rË   rÌ   rÍ   rt   Fru   rq   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Ð   rr   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Ñ   ©r:   r;   r   rÔ   r>   ÚoÚpr<   r3   r8   rA   rË   rÕ   rÖ   r×   rØ   rb   s                    r(   Útest_partial_loops_crñ   ±  s|  € ÷ .Ý)Ù˜¨DÔ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Ð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Ñ'?Ð@Ñ@Ò@ðBð Að �Š>Ðˆ>Øð	òð ñ r*   c            	      óø   — ddl m}  ddlm}m} t        d«      \  }}}t        d | | ||«      «       ||«      g«      }t        «       }|j                  |gddd¬«      }|d   d   d	k(  sJ ‚d
}	|d   d   |	k(  sJ ‚y )Nr   r
   ©r�   rž   r]   Úfoor.   Fru   ú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;
}
rB   ©	Úsympy.core.relationalr   rµ   r�   rž   r   r   r   Úwrite©
r   r�   rž   r3   r8   r4   rK   Úcrw   rb   s
             r(   Útest_output_arg_crû   Ý  s�   € Ý.ßCÜ�gÓ�G€A€qˆ!Ü�U™X a©¨Q«Ó0±#°a³&Ð9Ó:€AÜ‹€AØ�W‰W�a�S˜&¨°eˆWÓ<€FØ�!‰9�Q‰<˜8Ò#Ð#Ð#ð	ð ð �!‰9�Q‰<˜8Ò#Ð#Ñ#r*   c            	      óø   — ddl m}  ddlm}m} t        d«      \  }}}t        d | | ||«      «       ||«      g«      }t        «       }|j                  |gddd¬«      }|d   d   d	k(  sJ ‚d
}	|d   d   |	k(  sJ ‚y )Nr   r
   ró   zif, while, zrô   r.   Fru   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;
}
rB   rö   rù   s
             r(   Ú test_output_arg_c_reserved_wordsrý   ò  s�   € Ý.ßCÜ�nÓ%�G€A€qˆ!Ü�U™X a©¨Q«Ó0±#°a³&Ð9Ó:€AÜ‹€AØ�W‰W�a�S˜&¨°eˆWÓ<€FØ�!‰9�Q‰<˜8Ò#Ð#Ð#ð	ð ð �!‰9�Q‰<˜8Ò#Ð#Ñ#r*   c                  ó@  — t        ddd«      } t        ddd«      }t        | «      }t        |«      }||z  }t        dd¬«      }|j                  d|«      }d	|j                  d
   _        d	|j                  d
   _        t        |j                  |gd¬«      }d}||k(  sJ ‚y )Nr<   rD   ÚbrB   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   ra   rE   Ú
result_varÚ_namer)   rP   )	ÚA_symÚb_symr<   rÿ   rú   ÚcgenrK   rÖ   rb   s	            r(   Útest_multidim_c_argument_cser	    s£   € Ü˜˜a Ó#€EÜ˜˜a Ó#€EÜˆu‹€AÜˆu‹€AØ	ˆ!‰€AÜ˜F¨Ô-€DØ�‰�S˜!Ó€AØ!&€A‡K�K��OÔØ!€A‡K�K��OÔÜ�d—k‘k A 3¨vÔ6€Dð	ð ð �8ÒÐÑr*   c                  ó*  — 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 ‚y )Nr]   úB,Cr<   rB   rD   rC   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%   r0   r   ©r   r   r   r   r   )r3   r8   r4   r=   rs   r<   r€   r�   Úexpr3r¶   rb   rw   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 ‚y )Nr<   rê   rD   r=   rB   rs   ÚDr.   r   rC   rä   Fru   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   ©r<   r=   rs   r  r¶   rw   r'   rb   s           r(   Útest_ccode_matrixsymbol_slicer  8  s¹   € Ü�S˜!˜QÓ€AÜ�S˜!˜QÓ€AÜ�S˜!˜QÓ€AÜ�S˜!˜QÓ€AØœ( 1 a¨ª1¨¡gÓ.Ü" 1 a¨ª1¨¡gÓ.Ü" 1 aª¨1¨¡gÓ.ð0ð 1€Iô �Y  v°eÀ5Ô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 ‚y )Nza b c dÚerD   rB   r.   T)r  F)rR   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   )
r7   rÿ   rú   Údr  r¶   Ú	generatorrw   r'   rb   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ÓNÐOÐP€IÜ˜TÔ"€IÜ�Y¨¸5ÈÔN€FØ�A‰Y�q‰\€Fð	ð ð �XÒÐÑr*   c                  óz   — t        ddd«      } d}t        «       }t        ||dd| f¬«      }|d   d   }d}||k(  sJ ‚y )	Nr3   rC   rB   )r.   g      ð?F)rR   r$   r%   r0   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   )r3   r¶   r  rw   r'   rb   s         r(   Útest_ccode_unused_array_argr  i  sY   € Ü�S˜!˜QÓ€Aà€IÜ“
€IÜ�Y¨¸5ÈÐbcÐaeÔ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 ‚y )NÚXrD   rB   ÚYr4   Tr?   ÚtestBugr   rs   F)Úlanguager$   r%   r0   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  r4   r¶   rw   r'   rb   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€FØ�A‰Y�q‰\€Fð	ð ð �XÒÐÑr*   c                  óR   — t        «       } t        | j                  g «      }|dk(  sJ ‚y ©NÚ ©r   r)   Údump_f95rQ   s     r(   Útest_empty_f_coder'  �  s'   € Ü‹z€HÜ˜×)Ñ)¨2Ó.€FØ�RŠ<Ð‰<r*   c                  óp   — t        «       } t        | j                  g d¬«      }|d d dk(  sJ ‚|dd  dk(  sJ ‚y )NTrU   rV   zR!******************************************************************************
!*rW   a’  *
!*                                                                            *
!*              See http://www.sympy.org/ for more information.               *
!*                                                                            *
!*                       This file is part of 'project'                       *
!******************************************************************************
r%  rQ   s     r(   Útest_empty_f_code_with_headerr)  •  sY   € Ü‹z€HÜ˜×)Ñ)¨2°dÔ;€FØ�#�2ˆ;Ø]òð ð ð �#�$ˆ<ð [`ò ð ñ r*   c                  óR   — t        «       } t        | j                  g «      }|dk(  sJ ‚y r#  )r   r)   rZ   rQ   s     r(   Útest_empty_f_headerr+  ¥  s%   € Ü‹z€HÜ˜Ÿ™¨Ó,€FØ�RŠ<Ð‰<r*   c                  óž   — t        d«      \  } }}| |z   |z  }t        d|«      }t        «       }t        |j                  |g«      }d}||k(  sJ ‚y )Nr]   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)   r&  r`   s           r(   Útest_simple_f_coder/  «  s`   € Ü�gÓ�G€A€qˆ!Ø�‰E�1‰9€DÜ˜6 4Ó(€GÜ‹z€HÜ˜×)Ñ)¨G¨9Ó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 ‚y )Nr.   zDREAL*8 function test()
implicit none
REAL*8, parameter :: Catalan = rg   zd0
REAL*8, parameter :: pi = z#d0
test = pi**Catalan
end function
)r   r   r   r   r)   r&  rh   ri   s       r(   Útest_numbersymbol_f_coder1  ½  s\   € Ü˜6¤2¤w¡;Ó/€GÜ‹z€HÜ˜×)Ñ)¨G¨9Ó5�Fô 
�‰�rÕ	œBŸH™H R�Lð*€Hð �XÒÐÑr*   c                  óÀ   — t        d«      } t        dt        | «      t        d| z  «      z
  «      }t        «       }t	        |j
                  |g«      }d}||k(  sJ |«       ‚y )Nr3   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)   r&  )r3   ra   rR   r'   rb   s        r(   Útest_erf_f_coder4  Ë  sb   € Ü�‹€AÜ˜6¤3 q£6¬C°°Q±«KÑ#7Ó8€GÜ‹z€HÜ˜×)Ñ)¨G¨9Ó5€Fð	ð ð �XÒÐ%˜vÓ%Ñr*   c                  ó¢   — t        d«      \  } }}| |z   }t        d||| |g¬«      }t        «       }t        |j                  |g«      }d}||k(  sJ ‚y )Nr]   r.   r/   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.  r`   s           r(   Útest_f_code_argument_orderr6  Ù  sd   € Ü�gÓ�G€A€qˆ!Øˆq‰5€DÜ˜6 4¸A¸qÀ!¸9ÔE€GÜ‹z€HÜ˜×)Ñ)¨G¨9Ó5€Fð	ð ð �XÒÐÑr*   c                  óž   — t        d«      \  } }}| |z   |z  }t        d|«      }t        «       }t        |j                  |g«      }d}||k(  sJ ‚y )Nr]   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)   rZ   r`   s           r(   Útest_simple_f_headerr9  ë  s^   € Ü�gÓ�G€A€qˆ!Ø�‰E�1‰9€DÜ˜6 4Ó(€GÜ‹z€HÜ˜Ÿ™¨'¨Ó3€Fð	ð ð �XÒÐÑr*   c                  ól   — t        d«      \  } }}| |z   |z  }t        d|fdddd¬«      }ddg}||k(  sJ ‚y )	Nr]   r.   ÚF95rt   Fru   )úfile.f90r-  )rr   r8  rv   )r3   r8   r4   r2   rw   rb   s         r(   Útest_simple_f_codegenr=  þ  sZ   € Ü�gÓ�G€A€qˆ!Ø�‰E�1‰9€DÜØ	�ˆ˜˜v¨e¸5ôB€Fð	ð	ð€Hð& �XÒÐÑr*   c                  óž   ‡‡— t        d«      \  } }}| |z   |z  }| |z
  |z  }t        d||g«      Št        «       Št        t        ˆˆfd„«       y )Nr]   r.   c                  ó2   •— t        ‰ j                  ‰g«      S r{   r|   r}   s   €€r(   r5   z)test_multiple_results_f.<locals>.<lambda>"  r~   r*   )r   r   r   r   r   r   s        @@r(   Útest_multiple_results_fr@    sU   ù€ Ü�gÓ�G€A€qˆ!Ø�‰U�A‰I€EØ�‰U�A‰I€EÜØØ	�ˆó€Gô ‹z€HÜ
Œ<ÔGÕHr*   c                  ó&   — t        t        d„ «       y )Nc                  ó   — t        dg «      S r…   r1   r†   r*   r(   r5   z#test_no_results_f.<locals>.<lambda>&  r‡   r*   rˆ   r†   r*   r(   Útest_no_results_frC  %  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 ‚y )Nr   r�   r�   r‘   r—   r™   r3   Útest_absr¡   r¢   r£   r¥   r¦   r¨   r©   rª   r«   r¬   r­   r®   r;  rt   Fru   r<  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
rB   rr   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Ÿ   r3   r¶   rw   rb   s                   r(   Útest_intrinsic_math_codegenrF  )  sK  € å8Ý:ßHÑHÝ=ßZ×ZÜ�‹€Aà	‘S˜“VÐØ	‘d˜1“gÐØ	‘d˜1“gÐØ	‘d˜1“gÐØ	‘S˜“VÐØ	‘d˜1“gÐØ	‘S˜“VÐØ	‘C˜“FÐØ	‘S˜“VÐØ	‘d˜1“gÐØ	‘d˜1“gÐØ	‘S˜“VÐØ	‘d˜1“gÐð€Iô �Y  v°eÀ5ÔI€FØ�!‰9�Q‰<˜:Ò%Ð%Ð%ð@	ð ðF �!‰9�Q‰<˜8Ò#Ð#Ð#à�!‰9�Q‰<˜8Ò#Ð#Ð#ðM	ð ð` �!‰9�Q‰<˜8Ò#Ð#Ñ#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 ‚y )Nr   r¹   r»   r¼   r½   r;  rt   Fru   r<  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
rB   rr   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º   r3   r8   r¶   rw   rb   s         r(   Útest_intrinsic_math2_codegenrH  Û  s·   € å>Ü�5‹>�D€A€qà	‘u˜Q “{Ð#Ø	�Q˜‘TÐð€Iô �Y  v°eÀ5Ô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  j                  «       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 ‚y )Nr   rÁ   r]   rÂ   rÃ   rÄ   r;  rt   Fru   r<  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
rB   rr   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Ÿ   r3   r8   r4   r¶   rw   rb   s	            r(   Útest_complicated_codegen_f95rJ  	  s  € ßHÑHÜ�gÓ�G€A€qˆ!à	‘C˜“F™S ›V‘O¡c¨!£fÑ,¨qÑ0×8Ñ8Ó:Ð;Ø	‘#‘c™#™c¡#¡c©#©c°!°a±%¸!±)«nÓ*=Ó&>Ó"?Ó@ÓAÓBÓCÐDð€Iô �Y  v°eÀ5Ô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 ‚y )Nr   r9   rÉ   zn,mTr?   ÚAxyrA   rË   rÌ   r;  rt   Fru   r<  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)rr   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
)rH   r:   r;   rÒ   r   rI   r   r   rÓ   s                  r(   Ú
test_loopsrO  G  sñ   € ß-Ý)á�5 $Ô'�D€A€qÜ�+˜uÓ%�G€A€qˆ!ÙˆC�‹€AÙˆC�‹€Aä")Ø	œ"˜Q˜q™T 1 Q¨ T¡7¨1¨Q©4¡<Ó0Ð1°5¸&ÈÐV[ô#]Ñ�J€Rˆ‘��Yð �ÒÐÐð	ð ð* �8˜u nÐ5Ñ5Ò5Ø�˜E >Ð2Ñ2Ò2ð3ð 3à�Š>Ðˆ>Øð		òð ñ r*   c                  óD  — 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 ‚y )Nr   r9   rÛ   TrÜ   r3   r8   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à   )rH   r:   r;   r   r	   rJ   rá   r   r   r   r)   r&  )
r:   r;   rA   r>   r3   r8   rb   rK   rú   rÖ   s
             r(   Útest_dummy_loops_f95rS  z  sž   € ß-Ü�5 $¬EÔ2�D€A€qÙ�CÓ€AÙ�CÓ€AÙˆAˆq‹	€Að		ð —7‘7×&Ñ&°!·-±-Ñ@ñA€Hô 	�^¤R¨¨!©¨a°©d£^Ó4€AÜ‹
€AÜ�a—j‘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 ‚y )Nr   r9   rÉ   zi,j,n,mTr?   zA,x,yrÌ   r;  rt   Fru   r<  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Î   rM  rN  rr   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Ñ   )r:   r;   r   rA   rË   rÔ   r>   r<   r3   r8   rÕ   rÖ   r×   rØ   rb   s                  r(   Útest_loops_InOutrU  ’  s  € ß-Ý)á˜¨DÔ1�J€A€qˆ!ˆQÙ�gÓ�G€A€qˆ!Ù�A‹‘s˜1˜a“y¡# a¨£)Ð+Ñ,€AÙ�A‹‘s˜1˜a“yÑ!€AÙ�A‹‘s˜1˜a“yÑ!€Aä")Ø	œ"˜Q  A a¡C¡›.Ð)¨5°&ÀÈeô#UÑ�J€Rˆ‘��Yð �ÒÐÐð	ð ð$ �H  ~Ð6Ñ6Ò6Ø�H  ~Ð6Ñ6Ò6ð8ð 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 ‚y y )Nr   r9   rÉ   rç   Tr?   r<   rè   r3   r8   rA   rê   rË   rÌ   r;  rt   Fru   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ë   rB   )rÎ   ÚiupÚilowziup-ilowrÎ   rM  rN  )rH   r:   r;   rÒ   r   r   r   Ústrrî   s                    r(   Útest_partial_loops_frZ  Ã  s  € ÷ .Ý)Ù˜¨DÔ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Ð1°5¸&ÈÐV[ô#]Ñ�J€Rˆ‘��Yð	ð* Ü�1�q‘5‹zÜ�A˜‘E“
Ü˜˜A™ ™	“Nñ		ñ+€Hð8 �8˜u nÐ5Ñ5Ò5Ø�˜E >Ð2Ñ2Ò2ð3ð 3Ø2ð 6r*   c            	      óô   — ddl m}  ddlm}m} t        d«      \  }}}t        d | | ||«      «       ||«      g«      }t        «       }|j                  |gddd¬«      }|d   d   d	k(  sJ ‚|d   d
   dk(  sJ ‚y )Nr   r
   ró   r]   rô   r.   Fru   ztest.f90rB   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ž   r3   r8   r4   rK   rú   rw   s	            r(   Útest_output_arg_fr\  ò  sŒ   € Ý.ßCÜ�gÓ�G€A€qˆ!Ü�U™X a©¨Q«Ó0±#°a³&Ð9Ó:€AÜ‹
€AØ�W‰W�a�S˜&¨°eˆWÓ<€FØ�!‰9�Q‰<˜:Ò%Ð%Ð%Ø�!‰9�Q‰<ð	òð ñ r*   c            
      ód  — 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 ‚y y )Nr   r9   rÉ   rÊ   Tr?   rL  rA   ÚfuncrB   Ú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  )rH   r:   r;   rÒ   r   rI   r   r   r   r   r   r)   r&  )r:   r;   r   rÔ   r>   r<   r3   r8   rA   rð   r^  ra   rÖ   rb   Úargss                  r(   Útest_inline_functionra    sÌ   € ß-Ý)Ù�5 $Ô'�D€A€qÜ�+˜uÓ%�G€A€qˆ!ÙˆC�‹€AÜ‹
€AÜ ¬¨q°!°Q¸±U±)Ó(<Ó=€DÜ˜=¬"¨Q¨q©T±4¸¸!¹³:Ó*>Ó?€GÜ�a—j‘j 7 )Ó,€Dð		ð ð "€DØ�8˜d‘?Ò"Ø�˜4¡ " ™:Ñ%Ò%ð&ð &Ø%ð #r*   c                  ó¢   — t        d«      } d}| D ]  }||z  }Œ	 t        d|«      }t        «       }t        |j                  |g«      }d}||k(  sJ ‚y )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.  )r3   r2   Úsymra   rR   r'   rb   s          r(   Útest_f_code_call_signature_wraprd     sf   € ä�‹€AØ€DØò ˆØ�‰‰ðä˜6 4Ó(€GÜ‹z€HÜ˜×)Ñ)¨G¨9Ó5€Fð€Hð8 �XÒÐÑr*   c                  óL   ‡ ‡— t        d«      \  ŠŠ t        t        ˆ ˆfd„«       y )Nzx,Xc                  ó(   •— t        d‰‰ z  fdd«      S )Nr.   Úf95r#   )r   ©r  r3   s   €€r(   r5   z!test_check_case.<locals>.<lambda>J  s   ø€ ¤¨&°!°A±#¨¸¸xÓ!H€ r*   )r   r   r   rh  s   @@r(   Útest_check_caseri  H  s   ù€ Ü�5‹>�D€A€qÜ
Œ<ÔHÕIr*   c                  óØ   — t        d«      } t        dd¬«      }	 t        d| |z  fdd«       y # t        $ r3}|j                  d   j	                  d«      rt        d	«      ‚Y d }~y d }~ww xY w)
Nr3   T)Úmy_assumptionr.   rg  r#   r   zFortran ignores case.z$This exception should not be raised!)r   r   r   r`  Ú
startswithÚAssertionError)Úx1Úx2r  s      r(   Útest_check_case_false_positiverp  M  sm   € ô
 
�‹€BÜ	� DÔ	)€BðIÜ�˜˜B™� ¨Õ1øÜò IØ�6‰6�!‰9×ÑÐ 7Ô8Ü Ð!GÓHÐHô 9ûðIús   š- ­	A)¶)A$Á$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 ‚y )
Nr»   rô   rC   r;  Fru   r   rB   r¯   )r   r   r   )r3   r8   r¶   rw   Ú	expresults        r(   Ú test_c_fortran_omit_routine_namers  [  s  € Ü�5‹>�D€A€qØ˜˜1™��€IÜ�Y ¨e¸5ÔA€FÜ˜	 5¨%¸ÀUÔK€IØ�!‰9�Q‰<˜9 Q™<¨™?Ò*Ð*Ð*à˜˜!™�€IÜ�Y ¨e¸5ÔA€FÜ˜	 5¨%¸ÀUÔK€IØ�!‰9�Q‰<˜9 Q™<¨™?Ò*Ð*Ð*àœ  A ¨¨1©¨a°©c¨
Ð3Ó4Ð5€IÜ�Y ¨e¸5ÔA€FÜ˜	 5¨%¸ÀUÔ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	}|j                  «       d
   }	|	j	                  d«      }
|
d   }|d|iz  }||k(  sJ ‚y )Nr]   é   r.   rg  Fru   r   rB   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)r3   r8   r4   Úe1Úe2r¶   rw   r'   rb   r7   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€FØ�A‰Y�q‰\€Fð	ð ð 	×ÑÓ˜AÑ€AØ	�‰�‹€AØ
ˆA‰$€CØ˜6 3˜-Ñ'€HØ�XÒÐÑr*   c                  ó*  — 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 ‚y )Nr]   r  r<   rB   rD   rC   r.   rg  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  )r3   r8   r4   r=   rs   r<   r€   r�   r  r¶   rw   r'   rb   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 ‚y )Nr<   rC   rD   r=   rB   rs   r  r.   r   rg  Fru   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¨¡gÓ.Ü" 1 a¨ª1¨¡gÓ.Ü" 1 aª¨1¨¡gÓ.ð0ð 1€Iô �Y  v°eÀ5Ô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
}|j                  «       d   }|j                  d«      }|d   }|d|iz  }||k(  sJ ‚y )Nr<   rC   rD   r.   rB   rg  Fru   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
rv  rw  )r   r   rx  ry  )r<   r¶   rw   r'   rb   r7   rÿ   r  s           r(   Ú&test_fcode_matrixsymbol_slice_autonamer‚  Æ  s’   € ä�S˜!˜QÓ€AØ˜š1˜a˜4™Ð!€IÜ�Y  v°eÀ5Ô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 ‚y )Nzx y z tÚfr;  F)r$   r%   Úglobal_varsr   rB   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;
}
rs   rv   )r3   r8   r4   Útrw   r'   rb   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                  óZ  — 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                  j                  d	«       d}t        d|fdd|¬«      }|d   d   }	|	|k(  sJ ‚y )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;
}
r2   F)r$   r%   rR   rB   )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�  r3   r8   r2   Úgenrb   rw   r'   s
             r(   Útest_custom_codegenr”  ù  sã   € Ý/Ý:áÐ'7¸%ÀÐ9KÐ&LÔM€Gä�5‹>�D€A€qÙˆq�1‰u‹:€Dô ˜WØ.DÐ-EôG€Cð	ð ô �f˜d�^¨E¸ÈÔM€FØ�A‰Y�q‰\€FØ�XÒÐÐô ˜WÔ
%€CØ×Ñ×&Ñ&Ð'=Ô>ð	ð ô �f˜d�^¨E¸ÈÔ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 ‚y )Nr   r‰  c                   ó   — e Zd Zd„ Zy)ú*test_c_with_printer.<locals>.CustomPrinterc                 óŠ   — dj                  | j                  |j                  «      | j                  |j                  «      «      S )Nzfastpow({}, {}))ÚformatÚ_printÚbaser‹  )Úselfr2   s     r(   Ú
_print_Powz5test_c_with_printer.<locals>.CustomPrinter._print_Pow+  s6   € Ø$×+Ñ+¨D¯K©K¸¿	¹	Ó,BØ,0¯K©K¸¿¹Ó,AóCð Cr*   N)Ú__name__Ú
__module__Ú__qualname__r�  r†   r*   r(   ÚCustomPrinterr—  *  s   „ ó	Cr*   r¡  r3   rD   )rq   zŒ#include "file.h"
#include <math.h>
double test(double x) {
   double test_result;
   test_result = fastpow(x, 3);
   return test_result;
}
)rr   zP#ifndef PROJECT__FILE__H
#define PROJECT__FILE__H
double test(double x);
#endif
r.   rs   rt   F)r$   r%   r�  )r‘  rŠ  r   r   )rŠ  r¡  r3   r2   rb   rw   s         r(   Útest_c_with_printerr¢  '  sd   € å/ôC˜ô Cô
 	�‹€AØˆa‰4€Dð	ð	ð€Hô �f˜d�^ S¨¸ÀUÑVcÓVeÔf€FØ�XÒÐÑr*   c                  ót  — 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                  _        y )Nr   Tr3   )Úrealr8   r.   rg  Fru   rB   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   )Úsympyr3   r8   rw   r'   rb   s         r(   Útest_fcode_complexr©  D  sØ   € Û"Ø.2€E‡O�O×ÑÔ+Üˆs˜Ô€AÜˆs˜Ô€AÜ�f˜Q˜q™S�\ 5¨&¸ÀeÔL€FØ�Q‰i˜‰l€Fð	ð ð �XÒÐÐÜˆs‹€AÜˆs˜Ô€AÜ�f˜Q˜q™S�\ 5¨&¸ÀeÔL€FØ�Q‰i˜‰l€Fð	ð ð �8ÒÐÐØ.3€E‡O�O×ÑÕ+r*   N)rt   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)   rM   rS   rX   r[   rc   re   rj   rl   ro   rx   r‚   rŠ   r·   r¿   rÇ   rÙ   rå   rñ   rû   rý   r	  r  r  r  r  r!  r'  r)  r+  r/  r1  r4  r6  r9  r=  r@  rC  rF  rH  rJ  rO  rS  rU  rZ  r\  ra  rd  ri  rp  rs  r|  r~  r€  r‚  r‡  r”  r¢  r©  r†   r*   r(   ú<module>r±     st  ðÝ ç >× >Ý *Ý $Ý 7Ý .ß /÷÷ ÷ ñ õ (Ý 9óò?ò6@òò$Tòò$ò$ò"ò$òò,	Iò9ò9òxò0AòH'òT$ò.)òX$ò*$ò*ò.ò4ò:ò(ò&ò&òò òò$ò&òò$ò&ò6	Iò9òo$òd+$ò\;$ò|0òfò0.òb,3ò^ò&&ò6%òPJò
Iò+ò$ò:ò<ò<ò.ò8,ò\ó:4r*   