Re: [Numpy-discussion] FFT and reconstruct

2016-05-20 Thread Vasco Gervasi
Maybe I found the problems;

1. t0=1.0, t1=3.0, y['1'] = cos(1.0*omega*t): I have to reconstruct the
signal using

>  yRec += a * cos(omega*i*(t-t0) + f)

not

>  yRec += a * cos(omega*i*t + f)


2.  t0=2, t1=3, y['Signal'] = 1.0*cos(1.0*omega*t) + ... +
5.0*cos(5.0*omega*t) + 1.0: starting point and end point must not be the
same, so to generate the signal I have to use

> t = linspace(t0, t1, 1000, endpoint=False)

not

> t = linspace(t0, t1, 1000)


Thanks
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
https://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] f2py: ram usage

2016-04-11 Thread Vasco Gervasi
Using order='F' solved the problem.

Thanks for reply.
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
https://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] f2py: ram usage

2016-04-10 Thread Vasco Gervasi
Hi all,
I am trying to write some code to do calculation onto an array: for each
row I need to do some computation and have a number as return.
To speed up the process I wrote a fortran subroutine that is called from
python [using f2py] for each row of the array, so the input of this
subroutine is a row and the output is a number.
This method works but I saw some speed advantage if I pass the entire array
to fortran and then, inside fortran, call the subroutine that does the
math; so in this case I pass an array and return a vector.
But I noticed that when python pass the array to fortran, the array is
copied and the RAM usage double.
Is there a way to "move" the array to fortran, I don't care if the array is
lost after the call to fortran.
The pyd module is generated using: python f2py.py -c --opt="-ffree-form
-Ofast" -m F2PYMOD F2PYMOD.f90

Thanks
Vasco
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
https://mail.scipy.org/mailman/listinfo/numpy-discussion