On Thu, Aug 30, 2012 at 12:49 PM, Neal Becker wrote:
> I think this should be simple, but I'm drawing a blank
>
> I have 2 2d matrixes
>
> Matrix A has indexes (i, symbol)
> Matrix B has indexes (state, symbol)
>
> I combined them into a 3d matrix:
>
> C = A[:,newaxis,:] + B[newaxis,:,:]
> where C
On Thursday, August 30, 2012, Neal Becker wrote:
> I think this should be simple, but I'm drawing a blank
>
> I have 2 2d matrixes
>
> Matrix A has indexes (i, symbol)
> Matrix B has indexes (state, symbol)
>
> I combined them into a 3d matrix:
>
> C = A[:,newaxis,:] + B[newaxis,:,:]
> where C has
I think this should be simple, but I'm drawing a blank
I have 2 2d matrixes
Matrix A has indexes (i, symbol)
Matrix B has indexes (state, symbol)
I combined them into a 3d matrix:
C = A[:,newaxis,:] + B[newaxis,:,:]
where C has indexes (i, state, symbol)
That works fine.
Now suppose I want to
2008/12/4 Charles R Harris <[EMAIL PROTECTED]>:
>
>
> On Thu, Dec 4, 2008 at 8:26 AM, Olivier Grisel <[EMAIL PROTECTED]>
> wrote:
>>
>> Hi list,
>>
>> Suppose I have array a with dimensions (d1, d3) and array b with
>> dimensions (d2, d3). I want to compute array c with dimensions (d1,
>> d2) holdi
On Thu, Dec 4, 2008 at 8:26 AM, Olivier Grisel <[EMAIL PROTECTED]>wrote:
> Hi list,
>
> Suppose I have array a with dimensions (d1, d3) and array b with
> dimensions (d2, d3). I want to compute array c with dimensions (d1,
> d2) holding the squared euclidian norms of vectors in a and b with
> size
2008/12/4 Stéfan van der Walt <[EMAIL PROTECTED]>:
> Hi Olivier
>
> 2008/12/4 Olivier Grisel <[EMAIL PROTECTED]>:
>> To avoid the python level loop I then tried to use broadcasting as follows:
>>
> c = sum((a[:,newaxis,:] - b) ** 2, axis=2)
>>
>> But this build a useless and huge (d1, d2, d3) t
Hi Olivier
2008/12/4 Olivier Grisel <[EMAIL PROTECTED]>:
> To avoid the python level loop I then tried to use broadcasting as follows:
>
c = sum((a[:,newaxis,:] - b) ** 2, axis=2)
>
> But this build a useless and huge (d1, d2, d3) temporary array that
> does not fit in memory for large values
Hi list,
Suppose I have array a with dimensions (d1, d3) and array b with
dimensions (d2, d3). I want to compute array c with dimensions (d1,
d2) holding the squared euclidian norms of vectors in a and b with
size d3.
My first take was to use a python level loop:
>>> from numpy import *
>>> c =
Charles R Harris wrote:
> A1 += A2[:,:,newaxis] is one way.
Exactly what I was looking for -- thanks Charles (and Ann)
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R(206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Se
2008/5/2 Chris.Barker <[EMAIL PROTECTED]>:
> Hi all,
>
> I have a n X m X 3 array, and I a n X M array. I want to assign the
> values in the n X m to all three of the slices in the bigger array:
>
> A1 = np.zeros((5,4,3))
> A2 = np.ones((5,4))
> A1[:,:,0] = A2
> A1[:,:,1] = A2
> A1[:,:,2] =
On Thu, May 1, 2008 at 10:58 PM, Chris.Barker <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have a n X m X 3 array, and I a n X M array. I want to assign the
> values in the n X m to all three of the slices in the bigger array:
>
> A1 = np.zeros((5,4,3))
> A2 = np.ones((5,4))
> A1[:,:,0] = A2
> A1[:,
Hi all,
I have a n X m X 3 array, and I a n X M array. I want to assign the
values in the n X m to all three of the slices in the bigger array:
A1 = np.zeros((5,4,3))
A2 = np.ones((5,4))
A1[:,:,0] = A2
A1[:,:,1] = A2
A1[:,:,2] = A2
However,it seems I should be able to broadcast that, so I don't
12 matches
Mail list logo