diff options
Diffstat (limited to 'doc/source/f2py')
-rw-r--r-- | doc/source/f2py/array_session.dat | 4 | ||||
-rw-r--r-- | doc/source/f2py/getting-started.rst | 14 | ||||
-rw-r--r-- | doc/source/f2py/python-usage.rst | 14 | ||||
-rw-r--r-- | doc/source/f2py/scalar_session.dat | 8 | ||||
-rw-r--r-- | doc/source/f2py/signature-file.rst | 8 | ||||
-rw-r--r-- | doc/source/f2py/string_session.dat | 12 |
6 files changed, 30 insertions, 30 deletions
diff --git a/doc/source/f2py/array_session.dat b/doc/source/f2py/array_session.dat index f64933482..fa2d1db14 100644 --- a/doc/source/f2py/array_session.dat +++ b/doc/source/f2py/array_session.dat @@ -1,5 +1,5 @@ >>> import arr ->>> from Numeric import array +>>> from numpy import array >>> print arr.foo.__doc__ foo - Function signature: a = foo(a,[overwrite_a]) @@ -62,4 +62,4 @@ copied an array using copy_ND_array: size=6, elsize=4 >>> s2 = arr.as_column_major_storage(s) >>> s2 is s # an array with column major storage order # is returned immediately -1
\ No newline at end of file +1 diff --git a/doc/source/f2py/getting-started.rst b/doc/source/f2py/getting-started.rst index 20c10b378..fca02307b 100644 --- a/doc/source/f2py/getting-started.rst +++ b/doc/source/f2py/getting-started.rst @@ -52,7 +52,7 @@ arguments to see the explanation of command line options) an extension module ``fib1.so`` (see ``-m`` flag) to the current directory. Now, in Python the Fortran subroutine ``FIB`` is accessible via ``fib1.fib``:: - >>> import Numeric + >>> import numpy >>> import fib1 >>> print fib1.fib.__doc__ fib - Function signature: @@ -62,7 +62,7 @@ Python the Fortran subroutine ``FIB`` is accessible via ``fib1.fib``:: Optional arguments: n := len(a) input int - >>> a=Numeric.zeros(8,'d') + >>> a = numpy.zeros(8,'d') >>> fib1.fib(a) >>> print a [ 0. 1. 1. 2. 3. 5. 8. 13.] @@ -76,7 +76,7 @@ Python the Fortran subroutine ``FIB`` is accessible via ``fib1.fib``:: * One can use different values for optional ``n``:: - >>> a1=Numeric.zeros(8,'d') + >>> a1 = numpy.zeros(8,'d') >>> fib1.fib(a1,6) >>> print a1 [ 0. 1. 1. 2. 3. 5. 0. 0.] @@ -95,7 +95,7 @@ Python the Fortran subroutine ``FIB`` is accessible via ``fib1.fib``:: F2PY implements basic compatibility checks between related arguments in order to avoid any unexpected crashes. - * When a Numeric array, that is Fortran contiguous and has a typecode + * When a Numpy array, that is Fortran contiguous and has a typecode corresponding to presumed Fortran type, is used as an input array argument, then its C pointer is directly passed to Fortran. @@ -105,7 +105,7 @@ Python the Fortran subroutine ``FIB`` is accessible via ``fib1.fib``:: input array have no effect to the original argument, as demonstrated below:: - >>> a=Numeric.ones(8,'i') + >>> a = numpy.ones(8,'i') >>> fib1.fib(a) >>> print a [1 1 1 1 1 1 1 1] @@ -120,7 +120,7 @@ Python the Fortran subroutine ``FIB`` is accessible via ``fib1.fib``:: if one specifies ``intent(inplace) a`` (see below, how), then the example above would read: - >>> a=Numeric.ones(8,'i') + >>> a = numpy.ones(8,'i') >>> fib1.fib(a) >>> print a [ 0. 1. 1. 2. 3. 5. 8. 13.] @@ -209,7 +209,7 @@ In Python:: * Clearly, the signature of ``fib2.fib`` now corresponds to the intention of Fortran subroutine ``FIB`` more closely: given the number ``n``, ``fib2.fib`` returns the first ``n`` Fibonacci numbers - as a Numeric array. Also, the new Python signature ``fib2.fib`` + as a Numpy array. Also, the new Python signature ``fib2.fib`` rules out any surprises that we experienced with ``fib1.fib``. * Note that by default using single ``intent(out)`` also implies diff --git a/doc/source/f2py/python-usage.rst b/doc/source/f2py/python-usage.rst index 24ec3f15d..809634b40 100644 --- a/doc/source/f2py/python-usage.rst +++ b/doc/source/f2py/python-usage.rst @@ -76,7 +76,7 @@ String arguments F2PY generated wrapper functions accept (almost) any Python object as a string argument, ``str`` is applied for non-string objects. -Exceptions are Numeric arrays that must have type code ``'c'`` or +Exceptions are Numpy arrays that must have type code ``'c'`` or ``'1'`` when used as string arguments. A string can have arbitrary length when using it as a string argument @@ -109,7 +109,7 @@ Array arguments ================ In general, array arguments of F2PY generated wrapper functions accept -arbitrary sequences that can be transformed to Numeric array objects. +arbitrary sequences that can be transformed to Numpy array objects. An exception is ``intent(inout)`` array arguments that always must be proper-contiguous and have proper type, otherwise an exception is raised. Another exception is ``intent(inplace)`` array arguments that @@ -117,13 +117,13 @@ attributes will be changed in-situ if the argument has different type than expected (see ``intent(inplace)`` attribute for more information). -In general, if a Numeric array is proper-contiguous and has a proper +In general, if a Numpy array is proper-contiguous and has a proper type then it is directly passed to wrapped Fortran/C function. Otherwise, an element-wise copy of an input array is made and the copy, being proper-contiguous and with proper type, is used as an array argument. -There are two types of proper-contiguous Numeric arrays: +There are two types of proper-contiguous Numpy arrays: * Fortran-contiguous arrays when data is stored column-wise, i.e. indexing of data as stored in memory starts from the lowest @@ -144,10 +144,10 @@ and C-contiguous if the order is as follows:: A[0,0] A[0,1] A[1,0] A[1,1] To test whether an array is C-contiguous, use ``.iscontiguous()`` -method of Numeric arrays. To test for Fortran-contiguousness, all +method of Numpy arrays. To test for Fortran-contiguousness, all F2PY generated extension modules provide a function ``has_column_major_storage(<array>)``. This function is equivalent to -``Numeric.transpose(<array>).iscontiguous()`` but more efficient. +``<array>.flags.f_contiguous`` but more efficient. Usually there is no need to worry about how the arrays are stored in memory and whether the wrapped functions, being either Fortran or C @@ -353,7 +353,7 @@ with the current extension module, but not to other extension modules (this restriction is due to how Python imports shared libraries). In Python, the F2PY wrappers to ``common`` blocks are ``fortran`` type objects that have (dynamic) attributes related to data members of -common blocks. When accessed, these attributes return as Numeric array +common blocks. When accessed, these attributes return as Numpy array objects (multi-dimensional arrays are Fortran-contiguous) that directly link to data members in common blocks. Data members can be changed by direct assignment or by in-place changes to the diff --git a/doc/source/f2py/scalar_session.dat b/doc/source/f2py/scalar_session.dat index 4fe8c03b1..8aff097c2 100644 --- a/doc/source/f2py/scalar_session.dat +++ b/doc/source/f2py/scalar_session.dat @@ -10,12 +10,12 @@ Required arguments: A= 2. B= 3. INCREMENT A AND B NEW A= 3. B= 4. ->>> import Numeric ->>> a=Numeric.array(2) # these are integer rank-0 arrays ->>> b=Numeric.array(3) +>>> import numpy +>>> a=numpy.array(2) # these are integer rank-0 arrays +>>> b=numpy.array(3) >>> scalar.foo(a,b) A= 2. B= 3. INCREMENT A AND B NEW A= 3. B= 4. >>> print a,b # note that only b is changed in situ -2 4
\ No newline at end of file +2 4 diff --git a/doc/source/f2py/signature-file.rst b/doc/source/f2py/signature-file.rst index f81ee9311..a293f0d4c 100644 --- a/doc/source/f2py/signature-file.rst +++ b/doc/source/f2py/signature-file.rst @@ -347,9 +347,9 @@ The following attributes are used by F2PY: + ``inout`` The argument is considered as an input/output or *in situ* output argument. ``intent(inout)`` arguments can be only - "contiguous" Numeric arrays with proper type and size. Here + "contiguous" Numpy arrays with proper type and size. Here "contiguous" can be either in Fortran or C sense. The latter one - coincides with the contiguous concept used in Numeric and is + coincides with the contiguous concept used in Numpy and is effective only if ``intent(c)`` is used. Fortran-contiguousness is assumed by default. @@ -359,7 +359,7 @@ The following attributes are used by F2PY: + ``inplace`` The argument is considered as an input/output or *in situ* output argument. ``intent(inplace)`` arguments must be - Numeric arrays with proper size. If the type of an array is + Numpy arrays with proper size. If the type of an array is not "proper" or the array is non-contiguous then the array will be changed in-place to fix the type and make it contiguous. @@ -622,7 +622,7 @@ signature real*8 intent(c,out),dimension(n),depend(n) :: a = _i[0] end subroutine myrange -is equivalent to ``Numeric.arange(n,typecode='d')``. +is equivalent to ``numpy.arange(n,typecode='d')``. .. warning:: diff --git a/doc/source/f2py/string_session.dat b/doc/source/f2py/string_session.dat index 64ebcb3f4..cbae6b784 100644 --- a/doc/source/f2py/string_session.dat +++ b/doc/source/f2py/string_session.dat @@ -8,11 +8,11 @@ Required arguments: c : input string(len=-1) d : in/output rank-0 array(string(len=-1),'c') ->>> import Numeric ->>> a=Numeric.array('123') ->>> b=Numeric.array('123') ->>> c=Numeric.array('123') ->>> d=Numeric.array('123') +>>> import numpy +>>> a=numpy.array('123') +>>> b=numpy.array('123') +>>> c=numpy.array('123') +>>> d=numpy.array('123') >>> mystring.foo(a,b,c,d) A=123 B=123 @@ -24,4 +24,4 @@ Required arguments: C=C23 D=D23 >>> a.tostring(),b.tostring(),c.tostring(),d.tostring() -('123', 'B23', '123', 'D23')
\ No newline at end of file +('123', 'B23', '123', 'D23') |