Module ImportFrom alias ImportFrom alias alias alias ImportFrom alias ImportFrom alias alias alias Import alias Import alias Import alias Import alias Assign NameStore Dict Assign SubscriptStore NameLoad Index Str Str Assign SubscriptStore NameLoad Index Str Str Assign NameStore Dict Assign SubscriptStore NameLoad Index Str Str Assign SubscriptStore NameLoad Index Str Str Assign NameStore Dict Assign SubscriptStore NameLoad Index Str ListLoad Str Str Str Assign SubscriptStore NameLoad Index Str ListLoad Str Str Str Assign SubscriptStore NameLoad Index Str ListLoad Str Str Str Assign SubscriptStore NameLoad Index Str ListLoad Str Str Str Assign NameStore ListLoad TupleLoad Str Str TupleLoad Str Str TupleLoad Str Str TupleLoad Str Str FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad AttributeLoad NameLoad attr Str For NameStore NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword NameLoad keyword NameLoad keyword AttributeLoad NameLoad attr If CompareNotEq NameLoad Num body Return NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Assert CompareIn NameLoad NameLoad Assert CompareIn NameLoad NameLoad Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr Str Str attr If CompareNotIn NameLoad TupleLoad Str Str Str body Raise Call NameLoad Str Assign NameStore Call AttributeLoad NameLoad attr BinOpMod Str NameLoad BinOpMod Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad If NameLoad body Expr Call NameLoad NameLoad NameLoad Str keyword NameLoad orelse Assign NameStore Call NameLoad NameLoad Str Expr Call AttributeLoad NameLoad attr NameLoad Str keyword NameLoad Assign NameStore ListLoad For TupleStore NameStore NameStore NameStore NameStore NameLoad body Assign NameStore BinOpMod Str TupleLoad NameLoad Call AttributeLoad Str attr GeneratorExp Call NameLoad NameLoad comprehension NameStore NameLoad NameLoad If CompareEq NameLoad Str body Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr BinOpMod SubscriptLoad NameLoad Index NameLoad Dict Str Str NameLoad NameLoad If CompareEq NameLoad Str body Assign NameStore Str orelse If CompareEq NameLoad Str body Assign NameStore Str orelse Raise Call NameLoad BinOpMod Str NameLoad With Call NameLoad NameLoad Str NameStore body Expr Call AttributeLoad NameLoad attr BinOpMod SubscriptLoad NameLoad Index NameLoad Dict Str Call AttributeLoad Str attr NameLoad Assign NameStore Call NameLoad NameLoad If NameLoad body Assign NameStore Call NameLoad ListLoad Str orelse Assign NameStore NameLoad If BoolOpOr CompareEq NameLoad Str BoolOpAnd CompareEq NameLoad Str NameLoad NameLoad body FunctionDef arguments args NameParam defaults body If Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad decorator_list Expr Call NameLoad Str Expr Call NameLoad Str Expr Call NameLoad Str Expr Call NameLoad Str Expr Call NameLoad Str Expr Call NameLoad Str Expr Call NameLoad Str Expr Call NameLoad Str Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad orelse Expr Call NameLoad BinOpMod Str NameLoad keyword AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad Assert NameLoad BinOpMod Str TupleLoad NameLoad Call AttributeLoad Str attr NameLoad Assert NameLoad BinOpMod Str TupleLoad NameLoad Call AttributeLoad Str attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Import alias Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr Str FunctionDef arguments args NameParam defaults body Return Call AttributeLoad NameLoad attr Str Str Call AttributeLoad NameLoad attr Num decorator_list FunctionDef arguments args NameParam defaults body Return BinOpMod Str Call AttributeLoad NameLoad attr Num decorator_list Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call NameLoad Str NameLoad Assign NameStore ListLoad TupleLoad Str TupleLoad Num Num Num TupleLoad Str TupleLoad Num Num Num TryExcept body Expr Call NameLoad Str ListLoad NameLoad NameLoad NameLoad NameLoad keyword NameLoad Return NameLoad handlers ExceptHandler type NameLoad body Return NameLoad decorator_list Assign NameStore ListLoad Assign NameStore ListLoad For TupleStore NameStore NameStore NameLoad body Assign NameStore SubscriptLoad NameLoad Index NameLoad If Call NameLoad NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad orelse Expr Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad FunctionDef arguments args defaults body If CompareIn TupleLoad Str Str NameLoad body Expr Call NameLoad Str decorator_list FunctionDef arguments args defaults body If CompareIn TupleLoad Str Str NameLoad body Expr Call NameLoad Str decorator_list FunctionDef arguments args defaults body If CompareIn TupleLoad Str Str NameLoad body Expr Call NameLoad Str decorator_list FunctionDef arguments args defaults body If CompareIn TupleLoad Str Str NameLoad body Expr Call NameLoad Str decorator_list FunctionDef arguments args defaults body Assign NameStore ListLoad TupleLoad Str TupleLoad Num Num Num Num Num TupleLoad Str TupleLoad Num Num Num Num Num Assign NameStore ListLoad TupleLoad Str BinOpMult BinOpAdd NameLoad NameLoad NameLoad For TupleStore NameStore NameStore NameLoad body Expr Call NameLoad Str NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args defaults body ImportFrom alias alias alias alias alias alias alias alias alias alias alias alias alias alias alias Assign NameStore ListLoad TupleLoad Str Call NameLoad NameLoad TupleLoad Str Call NameLoad NameLoad TupleLoad Str Call NameLoad NameLoad TupleLoad Str Call NameLoad NameLoad TupleLoad Str Call NameLoad NameLoad TupleLoad Str Call NameLoad NameLoad TupleLoad Str Call NameLoad NameLoad TupleLoad Str Call NameLoad NameLoad TupleLoad Str Call NameLoad NameLoad TupleLoad Str Call NameLoad NameLoad TupleLoad Str Call NameLoad NameLoad TupleLoad Str Call NameLoad NameLoad TupleLoad Str Call NameLoad NameLoad Assign NameStore ListLoad For TupleStore NameStore NameStore NameLoad body For NameStore TupleLoad Num Num Num body Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr TupleLoad NameLoad TupleLoad NameLoad NameLoad Num For TupleStore NameStore NameStore NameLoad body If CompareEq NameLoad Str body Assign NameStore ListLoad TupleLoad Str Call NameLoad NameLoad TupleLoad Str Call NameLoad NameLoad orelse Assign NameStore ListLoad Expr Call NameLoad Str BinOpAdd NameLoad NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args defaults body ImportFrom alias alias Assign NameStore ListLoad TupleLoad Str Call NameLoad NameLoad NameLoad TupleLoad Str BinOpPow NameLoad NameLoad Assign NameStore ListLoad For TupleStore NameStore NameStore NameLoad body For TupleStore NameStore NameStore TupleLoad TupleLoad Num Num TupleLoad Num Num TupleLoad Num Num body Assign NameStore Call NameLoad Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr TupleLoad NameLoad TupleLoad NameLoad NameLoad NameLoad Num For TupleStore NameStore NameStore NameLoad body Expr Call NameLoad Str NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args defaults body ImportFrom alias alias alias alias Assign NameStore ListLoad TupleLoad Str Call AttributeLoad BinOpPow BinOpAdd BinOpAdd Call NameLoad NameLoad Call NameLoad NameLoad Call NameLoad NameLoad Num attr TupleLoad Str Call NameLoad Call NameLoad Call NameLoad Call NameLoad Call NameLoad Call NameLoad Call NameLoad Call NameLoad BinOpAdd BinOpAdd NameLoad NameLoad NameLoad Assign NameStore ListLoad For TupleStore NameStore NameStore NameLoad body For TupleStore NameStore NameStore NameStore TupleLoad TupleLoad Num Num Num TupleLoad Num Num Num TupleLoad Num Num Num body Assign NameStore Call NameLoad Call AttributeLoad Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad NameLoad attr NameLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr TupleLoad NameLoad TupleLoad NameLoad NameLoad NameLoad NameLoad Num For TupleStore NameStore NameStore NameLoad body Expr Call NameLoad Str NameLoad NameLoad NameLoad NameLoad decorator_list
N/A __future__ print_function sympy.abc x y z sympy.utilities.pytest skip sympy.utilities.codegen codegen make_routine get_code_generator N/A sys N/A os N/A tempfile N/A subprocess N/A main_template N/A N/A N/A main_template N/A F95 
program main
  include "codegen.h"
  integer :: result;
  result = 0

  %(statements)s

  call exit(result)
end program
 N/A N/A main_template N/A C 
#include "codegen.h"
#include <stdio.h>
#include <math.h>

int main() {
  int result = 0;

  %(statements)s

  return result;
}
 N/A numerical_test_template N/A N/A N/A numerical_test_template N/A C 
  if (fabs(%(call)s)>%(threshold)s) {
    printf("Numerical validation failed: %(call)s=%%e threshold=%(threshold)s\n", %(call)s);
    result = -1;
  }
 N/A N/A numerical_test_template N/A F95 
  if (abs(%(call)s)>%(threshold)s) then
    write(6,"('Numerical validation failed:')")
    write(6,"('%(call)s=',e15.5,'threshold=',e15.5)") %(call)s, %(threshold)s
    result = -1;
  end if
 N/A compile_commands N/A N/A N/A compile_commands N/A cc N/A cc -c codegen.c -o codegen.o cc -c main.c -o main.o cc main.o codegen.o -lm -o test.exe N/A N/A compile_commands N/A gfortran N/A gfortran -c codegen.f90 -o codegen.o gfortran -ffree-line-length-none -c main.f90 -o main.o gfortran main.o codegen.o -o test.exe N/A N/A compile_commands N/A g95 N/A g95 -c codegen.f90 -o codegen.o g95 -ffree-line-length-huge -c main.f90 -o main.o g95 main.o codegen.o -o test.exe N/A N/A compile_commands N/A ifort N/A ifort -c codegen.f90 -o codegen.o ifort -c main.f90 -o main.o ifort main.o codegen.o -o test.exe N/A combinations_lang_compiler N/A N/A C cc N/A F95 ifort N/A F95 gfortran N/A F95 g95 try_run N/A N/A commands N/A N/A N/A Run a series of commands and only return True if all ran fine. N/A null N/A open N/A os devnull w N/A command commands N/A N/A retcode N/A N/A subprocess call command stdout null shell True stderr N/A subprocess STDOUT N/A N/A retcode 0 N/A N/A False N/A True N/A run_test N/A N/A label routines numerical_tests language commands friendly N/A True N/A N/A A driver for the codegen tests.

       This driver assumes that a compiler ifort is present in the PATH and that
       ifort is (at least) a Fortran 90 compiler. The generated code is written in
       a temporary directory, together with a main program that validates the
       generated code. The test passes when the compilation and the validation
       run correctly.
     N/A language N/A N/A language upper N/A N/A language main_template N/A N/A language numerical_test_template N/A clean N/A N/A N/A N/A os getenv SYMPY_TEST_CLEAN_TEMP always lower N/A N/A clean N/A always success never N/A N/A N/A ValueError SYMPY_TEST_CLEAN_TEMP must be one of the following: 'always', 'success' or 'never'. N/A work N/A N/A tempfile mkdtemp N/A _sympy_%s_test language N/A %s_ label N/A oldwork N/A N/A os getcwd N/A N/A N/A os chdir work N/A friendly N/A N/A N/A codegen routines language codegen to_files True N/A N/A code_gen N/A get_code_generator language codegen N/A N/A N/A code_gen write routines codegen to_files True N/A test_strings N/A N/A N/A fn_name args expected threshold numerical_tests N/A N/A call_string N/A %s(%s)-(%s) N/A fn_name N/A N/A , join N/A N/A str arg N/A arg args expected N/A N/A language F95 N/A N/A call_string N/A fortranize_double_constants call_string N/A threshold N/A fortranize_double_constants N/A str threshold N/A N/A N/A test_strings append N/A N/A numerical_test_template N/A language N/A call threshold call_string threshold N/A N/A language F95 N/A N/A f_name main.f90 N/A N/A N/A language C N/A N/A f_name main.c N/A N/A N/A NotImplementedError N/A FIXME: filename extension unknown for language: %s language N/A N/A open f_name w f N/A N/A N/A N/A f write N/A N/A main_template N/A language N/A statements N/A N/A join test_strings N/A compiled N/A try_run commands N/A compiled N/A N/A executed N/A try_run N/A ./test.exe N/A N/A executed False N/A N/A N/A clean always N/A N/A clean success compiled executed N/A safe_remove N/A N/A filename N/A N/A N/A N/A N/A N/A os path isfile filename N/A N/A N/A N/A os remove filename N/A N/A N/A safe_remove codegen.f90 N/A N/A safe_remove codegen.c N/A N/A safe_remove codegen.h N/A N/A safe_remove codegen.o N/A N/A safe_remove main.f90 N/A N/A safe_remove main.c N/A N/A safe_remove main.o N/A N/A safe_remove test.exe N/A N/A N/A os chdir oldwork N/A N/A N/A os rmdir work N/A N/A N/A print N/A TEST NOT REMOVED: %s work file N/A sys stderr N/A N/A N/A os chdir oldwork N/A compiled N/A failed to compile %s code with:
%s N/A language N/A N/A join commands N/A executed N/A failed to execute %s code from:
%s N/A language N/A N/A join commands N/A fortranize_double_constants N/A N/A code_string N/A N/A N/A 
    Replaces every literal float with literal doubles
     N/A re N/A pattern_exp N/A N/A re compile \d+(\.)?\d*[eE]-?\d+ N/A pattern_float N/A N/A re compile \d+\.\d*(?!\d*d) subs_exp N/A N/A matchobj N/A N/A N/A N/A N/A re sub [eE] d N/A N/A matchobj group 0 N/A subs_float N/A N/A matchobj N/A N/A N/A N/A %sd0 N/A N/A matchobj group 0 N/A N/A code_string N/A N/A pattern_exp sub subs_exp code_string N/A code_string N/A N/A pattern_float sub subs_float code_string N/A code_string N/A is_feasible N/A N/A language commands N/A N/A N/A routine N/A make_routine test x N/A numerical_tests N/A N/A test N/A 1.0 1.0 1e-15 N/A test N/A -1.0 -1.0 1e-15 N/A N/A N/A N/A run_test is_feasible N/A routine numerical_tests language commands friendly False N/A True N/A N/A N/A AssertionError N/A N/A False N/A N/A valid_lang_commands N/A N/A invalid_lang_compilers N/A N/A N/A lang compiler combinations_lang_compiler N/A N/A commands N/A compile_commands N/A compiler N/A N/A is_feasible lang commands N/A N/A N/A N/A valid_lang_commands append N/A lang commands N/A N/A N/A N/A invalid_lang_compilers append N/A lang compiler test_C_cc N/A N/A N/A N/A N/A N/A N/A C cc invalid_lang_compilers N/A N/A N/A skip `cc' command didn't work as expected N/A test_F95_ifort N/A N/A N/A N/A N/A N/A N/A F95 ifort invalid_lang_compilers N/A N/A N/A skip `ifort' command didn't work as expected N/A test_F95_gfortran N/A N/A N/A N/A N/A N/A N/A F95 gfortran invalid_lang_compilers N/A N/A N/A skip `gfortran' command didn't work as expected N/A test_F95_g95 N/A N/A N/A N/A N/A N/A N/A F95 g95 invalid_lang_compilers N/A N/A N/A skip `g95' command didn't work as expected N/A test_basic_codegen N/A N/A N/A N/A N/A numerical_tests N/A N/A test N/A 1.0 6.0 3.0 21.0 1e-15 N/A test N/A -1.0 2.0 -2.5 -2.5 1e-15 N/A name_expr N/A N/A test N/A N/A x y z N/A N/A lang commands valid_lang_commands N/A N/A N/A run_test basic_codegen name_expr numerical_tests lang commands N/A test_intrinsic_math1_codegen N/A N/A N/A N/A sympy acos asin atan ceiling cos cosh floor log ln sin sinh sqrt tan tanh N N/A name_expr N/A N/A test_fabs N/A abs x N/A test_acos N/A acos x N/A test_asin N/A asin x N/A test_atan N/A atan x N/A test_cos N/A cos x N/A test_cosh N/A cosh x N/A test_log N/A log x N/A test_ln N/A ln x N/A test_sin N/A sin x N/A test_sinh N/A sinh x N/A test_sqrt N/A sqrt x N/A test_tan N/A tan x N/A test_tanh N/A tanh x N/A numerical_tests N/A N/A N/A name expr name_expr N/A N/A xval N/A 0.2 0.5 0.8 N/A N/A expected N/A N N/A N/A expr subs x xval N/A N/A N/A numerical_tests append N/A name N/A xval expected 1e-14 N/A N/A lang commands valid_lang_commands N/A N/A N/A lang C N/A N/A name_expr_C N/A N/A test_floor N/A floor x N/A test_ceil N/A ceiling x N/A N/A name_expr_C N/A N/A N/A run_test intrinsic_math1 N/A name_expr name_expr_C numerical_tests lang commands N/A test_instrinsic_math2_codegen N/A N/A N/A N/A sympy atan2 N N/A name_expr N/A N/A test_atan2 N/A atan2 x y N/A test_pow N/A x y N/A numerical_tests N/A N/A N/A name expr name_expr N/A N/A N/A xval yval N/A N/A 0.2 1.3 N/A 0.5 -0.2 N/A 0.8 0.8 N/A N/A expected N/A N N/A N/A N/A N/A expr subs x xval subs y yval N/A N/A N/A numerical_tests append N/A name N/A xval yval expected 1e-14 N/A N/A lang commands valid_lang_commands N/A N/A N/A run_test intrinsic_math2 name_expr numerical_tests lang commands N/A test_complicated_codegen N/A N/A N/A N/A sympy sin cos tan N N/A name_expr N/A N/A test1 N/A N/A N/A N/A N/A N/A sin x N/A cos y N/A tan z 7 expand N/A test2 N/A cos N/A cos N/A cos N/A cos N/A cos N/A cos N/A cos N/A cos N/A N/A x y z N/A numerical_tests N/A N/A N/A name expr name_expr N/A N/A N/A xval yval zval N/A N/A 0.2 1.3 -0.3 N/A 0.5 -0.2 0.0 N/A 0.8 2.1 0.8 N/A N/A expected N/A N N/A N/A N/A N/A N/A N/A expr subs x xval subs y yval subs z zval N/A N/A N/A numerical_tests append N/A name N/A xval yval zval expected 1e-12 N/A N/A lang commands valid_lang_commands N/A N/A N/A run_test complicated_codegen name_expr numerical_tests lang commands N/A