Re: [Numpy-discussion] Tensor contraction

2010-06-17 Thread Alan Bromborsky
Friedrich Romstedt wrote: > 2010/6/13 Alan Bromborsky : > >> Friedrich Romstedt wrote: >> I am writing symbolic tensor package for general relativity. In making symbolic tensors concrete I generate numpy arrays stuffed with sympy functions and symbols. >>> That

Re: [Numpy-discussion] Tensor contraction

2010-06-15 Thread Dag Sverre Seljebotn
Alan Bromborsky wrote: > Dag Sverre Seljebotn wrote: > >> Did you have a look at the tensors in Theano? They seem to merge tensor >> algebra, SymPy, NumPy and (optional) GPU computing etc. Even if it >> doesn't fill your needs it could perhaps be a better starting point? >> >> http://deeplearn

Re: [Numpy-discussion] Tensor contraction

2010-06-14 Thread Alan Bromborsky
Dag Sverre Seljebotn wrote: > Did you have a look at the tensors in Theano? They seem to merge tensor > algebra, SymPy, NumPy and (optional) GPU computing etc. Even if it > doesn't fill your needs it could perhaps be a better starting point? > > http://deeplearning.net/software/theano/library/ten

Re: [Numpy-discussion] Tensor contraction

2010-06-14 Thread Dag Sverre Seljebotn
Did you have a look at the tensors in Theano? They seem to merge tensor algebra, SymPy, NumPy and (optional) GPU computing etc. Even if it doesn't fill your needs it could perhaps be a better starting point? http://deeplearning.net/software/theano/library/tensor/basic.html Dag Sverre Alan Brom

Re: [Numpy-discussion] Tensor contraction

2010-06-14 Thread Friedrich Romstedt
2010/6/13 Alan Bromborsky : > Friedrich Romstedt wrote: >>> I am writing symbolic tensor package for general relativity.  In making >>> symbolic tensors concrete >>> I generate numpy arrays stuffed with sympy functions and symbols. >> >> That sound's interesting. Now, after I read the Wikipedia ar

Re: [Numpy-discussion] Tensor contraction

2010-06-14 Thread Alan Bromborsky
Sebastian Walter wrote: > On Sun, Jun 13, 2010 at 8:11 PM, Alan Bromborsky wrote: > >> Friedrich Romstedt wrote: >> >>> 2010/6/13 Pauli Virtanen : >>> >>> def tensor_contraction_single(tensor, dimensions): """Perform a single tensor contraction over the dimensions given

Re: [Numpy-discussion] Tensor contraction

2010-06-14 Thread Sebastian Walter
On Sun, Jun 13, 2010 at 8:11 PM, Alan Bromborsky wrote: > Friedrich Romstedt wrote: >> 2010/6/13 Pauli Virtanen : >> >>> def tensor_contraction_single(tensor, dimensions): >>>    """Perform a single tensor contraction over the dimensions given""" >>>    swap = [x for x in range(tensor.ndim) >>>  

Re: [Numpy-discussion] Tensor contraction

2010-06-13 Thread Alan Bromborsky
Friedrich Romstedt wrote: > 2010/6/13 Alan Bromborsky : > >> I am writing symbolic tensor package for general relativity. In making >> symbolic tensors concrete >> I generate numpy arrays stuffed with sympy functions and symbols. >> > > That sound's interesting. > > >> The >> operations

Re: [Numpy-discussion] Tensor contraction

2010-06-13 Thread David Goldsmith
Is this not what core.numeric.tensordotdoes? DG On Sun, Jun 13, 2010 at 12:37 PM, Friedrich Romstedt < friedrichromst...@gmail.com> wrote: > 2010/6/13 Alan Bromborsky : > > I am writing symbolic tensor package for general relativity

Re: [Numpy-discussion] Tensor contraction

2010-06-13 Thread Friedrich Romstedt
2010/6/13 Alan Bromborsky : > I am writing symbolic tensor package for general relativity.  In making > symbolic tensors concrete > I generate numpy arrays stuffed with sympy functions and symbols. That sound's interesting. > The > operations are tensor product > (numpy.multiply.outer), permutati

Re: [Numpy-discussion] Tensor contraction

2010-06-13 Thread Alan Bromborsky
Friedrich Romstedt wrote: > 2010/6/13 Pauli Virtanen : > >> def tensor_contraction_single(tensor, dimensions): >>"""Perform a single tensor contraction over the dimensions given""" >>swap = [x for x in range(tensor.ndim) >>if x not in dimensions] + list(dimensions) >>x =

Re: [Numpy-discussion] Tensor contraction

2010-06-13 Thread Friedrich Romstedt
2010/6/13 Pauli Virtanen : > def tensor_contraction_single(tensor, dimensions): >    """Perform a single tensor contraction over the dimensions given""" >    swap = [x for x in range(tensor.ndim) >            if x not in dimensions] + list(dimensions) >    x = tensor.transpose(swap) >    for k in r

Re: [Numpy-discussion] Tensor contraction

2010-06-12 Thread Pauli Virtanen
Sat, 12 Jun 2010 16:30:14 -0400, Alan Bromborsky wrote: > If I have a single numpy array, for example with 3 indices T_{ijk} and I > want to sum over two them in the sense of tensor contraction - > > T_{k} = \sum_{i=0}^{n-1} T_{iik}. Is there an easy way to do this with > numpy? HTH, (not really

Re: [Numpy-discussion] Tensor contraction

2010-06-12 Thread Pauli Virtanen
Sat, 12 Jun 2010 23:15:16 +0200, Friedrich Romstedt wrote: [clip] > But note that for: > T[:, I, I] > the shape is reversed with respect to that of: > T[I, :, I] and T[I, I, :] . > > I think it should be written in the docs how the shape is derived. It's explained there in detail (although mayb

Re: [Numpy-discussion] Tensor contraction

2010-06-12 Thread Alan Bromborsky
Friedrich Romstedt wrote: > 2010/6/12 Alan Bromborsky : > >> If I have a single numpy array, for example with 3 indices T_{ijk} and I >> want to sum over two them in the sense of tensor contraction - >> >> T_{k} = \sum_{i=0}^{n-1} T_{iik}. Is there an easy way to do this with >> numpy? >>

Re: [Numpy-discussion] Tensor contraction

2010-06-12 Thread Friedrich Romstedt
2010/6/12 Alan Bromborsky : > If I have a single numpy array, for example with 3 indices T_{ijk} and I > want to sum over two them in the sense of tensor contraction - > > T_{k} = \sum_{i=0}^{n-1} T_{iik}.  Is there an easy way to do this with > numpy? Also you can give: T[I, I, :].sum(axis=0) a

Re: [Numpy-discussion] Tensor contraction

2010-06-12 Thread josef . pktd
On Sat, Jun 12, 2010 at 4:30 PM, Alan Bromborsky wrote: > If I have a single numpy array, for example with 3 indices T_{ijk} and I > want to sum over two them in the sense of tensor contraction - > > T_{k} = \sum_{i=0}^{n-1} T_{iik}.  Is there an easy way to do this with > numpy? looking at numpy

[Numpy-discussion] Tensor contraction

2010-06-12 Thread Alan Bromborsky
If I have a single numpy array, for example with 3 indices T_{ijk} and I want to sum over two them in the sense of tensor contraction - T_{k} = \sum_{i=0}^{n-1} T_{iik}. Is there an easy way to do this with numpy? ___ NumPy-Discussion mailing list Num