I echo with Robert that the contraction can be done with np.einsum().
Also, check out the np.tensordot() as well - it can also be used to
perform contraction.
Shawn
On Fri, Jan 15, 2016 at 12:32 PM, Robert Kern wrote:
> On Fri, Jan 15, 2016 at 5:30 PM, Nathaniel Smith wrote:
>>
>> On Jan 15, 20
Dear Nathaniel,
Gotcha. That's very helpful. Thank you so much!
Shawn
On Thu, Jan 7, 2016 at 10:01 PM, Nathaniel Smith wrote:
> On Thu, Jan 7, 2016 at 6:18 PM, Yuxiang Wang wrote:
>> Dear all,
>>
>> I know that in Windows, we should use either Christoph's
Dear all,
I know that in Windows, we should use either Christoph's package or
Anaconda for MKL-optimized numpy. In Linux, the fortran compiler issue
is solved, so should I directly used pip install numpy to get numpy
with a reasonable BLAS library?
Thanks!
Shawn
--
Yuxiang "Shawn" Wang
Gerling
Too add to Sturla - I think this is what he mentioned but in more details:
http://www.fortran90.org/src/best-practices.html#interfacing-with-python
Shawn
On Tue, Jul 14, 2015 at 9:45 PM, Sturla Molden wrote:
> Eric Firing wrote:
>
>> I'm curious: has anyone been looking into what it would take
I think spyder supports code highlighting in C and that's all...
There's no way to compile in Spyder, is there?
Shawn
On Tue, Apr 7, 2015 at 2:46 AM, Suzen, Mehmet wrote:
>> Spyder supports C.
>
> Thanks for correcting this. I wasn't aware of it.
> How was your experience with it?
>
> Best,
> -m
That would really be hilarious - and "IFortran" probably! :)
Shawn
On Wed, Apr 1, 2015 at 12:07 PM, Benjamin Root wrote:
> mixed C and python development? I would just wait for the Jupyter folks to
> create "IC" and maybe even "IC++"!
>
> On Wed, Apr 1, 2015 at 12:04 PM, Charles R Harris
> wrot
ngco.blogspot.com.au/2013/02/f2py-on-64bit-windows-python27.html
On Mon, Jan 26, 2015 at 10:29 PM, Yuxiang Wang wrote:
> Dear all,
>
> Sorry about being new to both Fortran 90 and f2py.
>
> I have a module in fortran, written as follows,
Dear all,
Sorry about being new to both Fortran 90 and f2py.
I have a module in fortran, written as follows, with a module-scope variable dp:
! testf2py.f90
module testf2py
implicit none
private
public dp, i1
integer, parameter :: dp=kind(
with the legacy code with no
problem. I'll definitely give it a try!
Thanks again for all the help Sturla,
Shawn
On Fri, Jan 2, 2015 at 8:22 AM, Sturla Molden wrote:
> Yuxiang Wang wrote:
>
>> 4) I wanted to say that it seems to me, as the project gradually
>> scales
1) @Strula Sorry about my stupid mistake! That piece of code totally
gave away how green I am in coding C :)
And yes, that piece of code works like a charm now! I am able to run
my model. Thanks a million!
2) @Strula and also thanks for your insight on the limitation of the
method. Currently I am
e **x, double **y)
{
size_t i, j;
y = (** double)malloc(sizeof(double *) * m);
for(i=0; i wrote:
> On Thu, Jan 1, 2015 at 6:00 PM, Yuxiang Wang wrote:
>> Dear all,
>>
>> I am currently using a piece of C code, where one of the input
>> argument of a function is
Dear all,
I am currently using a piece of C code, where one of the input
argument of a function is **double.
So, in numpy, I tried np.ctypeslib.ndpointer(ctypes.c_double), but
obviously this wouldn't work because this is only *double, not
**double.
Then I tried np.ctypeslib.ndpointer(np.ctypesli
;
> On Sun, Dec 28, 2014 at 8:48 PM, Yuxiang Wang wrote:
>>
>> Dear all,
>>
>> I am really glad to find out a very useful function called
>> numpy.ma.extras.clump_masked(), and it is indeed well documented if
>> you look into the source. However, may
Dear all,
I am really glad to find out a very useful function called
numpy.ma.extras.clump_masked(), and it is indeed well documented if
you look into the source. However, may I ask why does it not show up
in the main documentation website
(http://docs.scipy.org/doc/numpy/reference/routines.ma.htm
calculated.
-Shawn
On Tue, Nov 25, 2014 at 11:12 PM, Charles R Harris
wrote:
> Take a look as einsum, it is quite good for such things.
>
> Chuck
>
> On Tue, Nov 25, 2014 at 9:06 PM, Yuxiang Wang wrote:
>>
>> Dear all,
>>
>> I have been doing tensor algebra re
Dear all,
I have been doing tensor algebra recently (for continuum mechanics)
and was looking into two common operations: tensor product & tensor
contraction.
1. Tensor product
One common usage is:
a[i1, i2, i3, ..., iN, j1, j2, j3, ..., jM] = b[i1, i2, i3, ..., iN] *
c[j1, j2, j3, ..., jM]
I l
Hi Alexander,
In my opinion - because they don't do the same thing, especially when
you think in terms in lower-level.
ndarray.flat returns an iterator; ndarray.flatten() returns a copy;
ndarray.ravel() only makes copies when necessary; ndarray.reshape() is
more general purpose, even though you c
Dear all,
I was wondering is there a convenient inverse function of
np.polyval(), where I give the y value and it solves for x?
I know one way I could do this is:
import numpy as np
# Set up the question
p = np.array([1, 1, -10])
y = 100
# Solve
p_temp = p
p_temp[-1] -= y
x = np.roots(p_temp)
:42 PM, Christian K. wrote:
> Am 01.05.14 18:45, schrieb Yuxiang Wang:
>> Hi all,
>>
>> I am trying to calculate the 2nd-order gradient numerically of an
>> array in numpy.
>>
>> import numpy as np
>> a = np.sin(np.arange(0, 10, .01))
>>
Hi Chris,
Thank you! This is useful information. Unfortunately, I am doing this
on data from a sensor and would be hard to fit to a simple polynomial
while avoiding overfitting.
Thanks again!
Shawn
On Thu, May 1, 2014 at 7:01 PM, Chris Barker wrote:
> On Thu, May 1, 2014 at 3:42 PM, Christian
Hi all,
I am trying to calculate the 2nd-order gradient numerically of an
array in numpy.
import numpy as np
a = np.sin(np.arange(0, 10, .01))
da = np.gradient(a)
dda = np.gradient(da)
This is what I come up. Is the the way it should be done?
I am asking this, because in numpy t
Hi Alan,
If you are only dealing with 1d array, What about:
np.nonzero(your_array)[0][:k]
?
-Shawn
On Tue, Feb 25, 2014 at 2:20 PM, Alan G Isaac wrote:
> Is there a shortcut version for finding the first (k) instance(s) of
> nonzero entries?
> I'm thinking of Matlab's `find(X,k)`:
> http://
22 matches
Mail list logo