params = ('sh','th','la','mu','gamma','kappa')
+def ourccode(*a, **kw):
+ return ccode(*a, user_functions={'sinc':'sinc'}, **kw)
+
+def cprintraw(*s):
+ print(*s)
+
def cprint(s):
- print(s)
+ for l in s.split('\n'):
+ cprintraw(l, '\\')
def cse_prep_cprint(v, tmp_prefix):
# => v, but also having cprint'd the common subexpression assignments
itertools.count())
(defs, vs) = cse(v, symbols=sym_iter)
for defname, defval in defs:
- cprint(ccode(defval, assign_to=defname))
+ cprint('double '+ourccode(defval, assign_to=defname))
return vs[0]
def cassign(v, assign_to, tmp_prefix):
v = cse_prep_cprint(v, tmp_prefix)
- cprint(ccode(v, assign_to=assign_to))
+ cprint(ourccode(v, assign_to=assign_to))
def gen_diff(current, smalls):
global j
dbg('j')
j = cse_prep_cprint(j, 'jtmp')
for ix in range(0, j.cols):
- cprint(ccode(j.col(ix), 'J(%d)' % ix))
+ cprint(ourccode(j.col(ix), 'J(%d)' % ix))
cprint('J_END_COL(%d)' % ix)
else:
small = smalls[0]
smalls = smalls[1:]
- cprint('if (!IS_SMALL(' + ccode(small) + ')) {')
+ cprint('if (!IS_SMALL(' + ourccode(small) + ')) {')
gen_diff(current, smalls)
cprint('} else { /* %s small */' % small)
gen_diff(current.replace(
),
smalls
)
- print('} /* %s small */' % small)
+ cprint('} /* %s small */' % small)
+cprintraw('#define J_POPULATE \\')
gen_diff(result_dirnscaled, (sh*sh*la, th*th*la))
+cprintraw('')
#bad = q_orgcoords[0]
#badd = diff(bad, la)