diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-01-22 05:35:21 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-01-22 05:35:21 +0000 |
commit | 34b8ce671b12e9ee6740dc4df32fafc2eae44f64 (patch) | |
tree | fcbde7a6e44eac6f52cc2cddf1bb7ea3ac1453d4 /numpy/f2py/src/fortranobject.c | |
parent | beb7e7c80b325df0c16419ce63d87cc2c6ea5ada (diff) | |
download | numpy-34b8ce671b12e9ee6740dc4df32fafc2eae44f64.tar.gz |
Added LICENSE.txt to distribution. Fixed f2py check_and_fix_dimensions to not reverse dimensions.
Diffstat (limited to 'numpy/f2py/src/fortranobject.c')
-rw-r--r-- | numpy/f2py/src/fortranobject.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/numpy/f2py/src/fortranobject.c b/numpy/f2py/src/fortranobject.c index 139fe40e8..0717f9ce5 100644 --- a/numpy/f2py/src/fortranobject.c +++ b/numpy/f2py/src/fortranobject.c @@ -703,6 +703,7 @@ int check_and_fix_dimensions(const PyArrayObject* arr,const int rank,intp *dims) arr->nd,effrank,rank); return 1; } + /* for (i=0,j=0;i<rank;++i) { while (j<arr->nd && arr->dimensions[j]<2) ++j; if (j>=arr->nd) d = 1; @@ -718,6 +719,19 @@ int check_and_fix_dimensions(const PyArrayObject* arr,const int rank,intp *dims) } else dims[i] = d; } + */ + for (i=0; i<rank; ++i) { + d = arr->dimensions[i]; + if (dims[i]>=0) { + if (d > 1 && d!=dims[i]) { + fprintf(stderr,"%d-th dimension must be fixed to %" INTP_FMT + " but got %" INTP_FMT "\n", + i,dims[i],d); + return 1; + } + if (!dims[i]) dims[i] = 1; + } else dims[i] = d; + } for (i=rank;i<arr->nd;++i) { /* [[1,2],[3,4]] -> [1,2,3,4] */ while (j<arr->nd && arr->dimensions[j]<2) ++j; if (j>=arr->nd) d = 1; |