[Scipy-svn] r2934 - trunk/Lib/sandbox/numexpr

scipy-svn@scip... scipy-svn@scip...
Thu Apr 19 14:49:54 CDT 2007


Author: cookedm
Date: 2007-04-19 14:49:51 -0500 (Thu, 19 Apr 2007)
New Revision: 2934

Modified:
   trunk/Lib/sandbox/numexpr/expressions.py
   trunk/Lib/sandbox/numexpr/interpreter.c
Log:
[numexpr] include arcsin, arccos, and arctan functions

Modified: trunk/Lib/sandbox/numexpr/expressions.py
===================================================================
--- trunk/Lib/sandbox/numexpr/expressions.py	2007-04-19 03:19:14 UTC (rev 2933)
+++ trunk/Lib/sandbox/numexpr/expressions.py	2007-04-19 19:49:51 UTC (rev 2934)
@@ -198,10 +198,13 @@
 functions = {
     'copy' : func(numpy.copy),
     'ones_like' : func(numpy.ones_like),
+    'sqrt' : func(numpy.sqrt, 'float'),
     'sin' : func(numpy.sin, 'float'),
     'cos' : func(numpy.cos, 'float'),
     'tan' : func(numpy.tan, 'float'),
-    'sqrt' : func(numpy.sqrt, 'float'),
+    'arcsin' : func(numpy.arcsin, 'float'),
+    'arccos' : func(numpy.arccos, 'float'),
+    'arctan' : func(numpy.arctan, 'float'),
 
     'sinh' : func(numpy.sinh, 'float'),
     'cosh' : func(numpy.cosh, 'float'),

Modified: trunk/Lib/sandbox/numexpr/interpreter.c
===================================================================
--- trunk/Lib/sandbox/numexpr/interpreter.c	2007-04-19 03:19:14 UTC (rev 2933)
+++ trunk/Lib/sandbox/numexpr/interpreter.c	2007-04-19 19:49:51 UTC (rev 2934)
@@ -277,6 +277,9 @@
 
    To add a function opcode, just copy OP_SIN or OP_ARCTAN2.
 
+   Some functions are repeated in this table that are opcodes, but there's
+   no problem with that as the compiler selects opcodes over functions,
+   and this makes it easier to compare opcode vs. function speeds.
 */
 
 enum FuncFFCodes {
@@ -296,6 +299,7 @@
 
 typedef double (*FuncFFPtr)(double);
 
+/* The order of this array must match the FuncFFCodes enum above */
 FuncFFPtr functions_f[] = {
     sqrt,
     sin,
@@ -339,6 +343,7 @@
 
 typedef void (*FuncCCPtr)(cdouble*, cdouble*);
 
+/* The order of this array must match the FuncCCCodes enum above */
 FuncCCPtr functions_cc[] = {
     nc_sqrt,
     nc_sin,



More information about the Scipy-svn mailing list