summaryrefslogtreecommitdiff
path: root/numpy/core/src/umathmodule.c.src
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-01-30 07:49:07 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-01-30 07:49:07 +0000
commitf097ed4fa79aca45adf867a3f01bf677679559d7 (patch)
treee0e45a4e22ca3b4ed080499c25ab718285511f2b /numpy/core/src/umathmodule.c.src
parent0245ddea0b3a7ccf8dfc1a8366cbacb2232cefb8 (diff)
downloadnumpy-f097ed4fa79aca45adf867a3f01bf677679559d7.tar.gz
Fix bugs relating to adding hasobject. Add scalar-loops for some operations to see if they are faster on some platforms.
Diffstat (limited to 'numpy/core/src/umathmodule.c.src')
-rw-r--r--numpy/core/src/umathmodule.c.src20
1 files changed, 17 insertions, 3 deletions
diff --git a/numpy/core/src/umathmodule.c.src b/numpy/core/src/umathmodule.c.src
index a3e6d346e..78690dead 100644
--- a/numpy/core/src/umathmodule.c.src
+++ b/numpy/core/src/umathmodule.c.src
@@ -1616,9 +1616,23 @@ static void
{
register intp i;
intp is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((@typ@ *)op)=*((@typ@ *)i1) @OP@ *((@typ@ *)i2);
+ register char *i1=args[0], *i2=args[1], *op=args[2];
+ if (is1 == 0) {
+ register @typ@ t1 = *((@typ@ *)i1);
+ for (i=0; i<n; i++, i2+=is2, op+=os) {
+ *((@typ@ *)op) = t1 @OP@ *((@typ@ *)i2);
+ }
+ }
+ else if (is2 == 0) {
+ register @typ@ t2 = *((@typ@ *)i2);
+ for (i=0; i<n; i++, i1+=is1, op+=os) {
+ *((@typ@ *)op) = *((@typ@ *)i1) @OP@ t2;
+ }
+ }
+ else {
+ for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
+ *((@typ@ *)op)=*((@typ@ *)i1) @OP@ *((@typ@ *)i2);
+ }
}
}
/**end repeat**/