> Well what about A*(B*C)?
Point taken...
Johannes
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSp
Hi,
in extension to the previous answers, I'd like to say that it is strongly
preferable to use dot(A,dot(B,C)) or dot(dot(A,B),C) instead of A*B*C.
The reason is that with dot(), you can control of which operation is performed
first, which can *massively* influence the time needed, depending o
On Thursday 26 October 2006 11:39, Vincent Schut wrote:
> > Of course I can easily loop over that axis, but if possible I'd like to
> > prevent array loops...
Depending on the problem's size, this could actually be the best solution --
if each particular sum is over enough elements, the overhead
Hi,
I absolutely do not know perl, so I do not know what the expression you posted
does.
However, the key is just to understand indexing in numpy:
if you have a matrix mat and index arrays index1, index2 with, lets say,
index1 = array([ 17, 19, 29])
index2 = array([ 12, 3, 9])
then the entri
> I'm just wondering if there is a way that i can increment all the values
> along a diagonal?
Assume you want to change mat.
# min() only necessary for non-square matrices
index = arange(min(mat.shape[0], mat.shape[1]))
# add 1 to each diagonal element
matrix[index, index] += 1
# add some other
Hi,
> > This seems like a rather common operation - I know I've needed it on
> > at least two occasions - is it worth creating some sort of C
> > implementation? What is the appropriate generalization?
>
> Some sort of indirect addressing infrastructure. But it looks like this
> could be tricky to
Hi,
one word in advance, instead of optimizing it is advisable to seek for a way
to refactorize the algorithm using smaller arrays, since this kind of
optimization almost certainly reduces readability. If you do it, comment
well. ;-)
If you have very large arrays and want to do some arithmetic
Am Mittwoch, 30. August 2006 19:20 schrieb Ghalib Suleiman:
> I'm somewhat new to both libraries...is there any way to create a 2D
> array of pixel values from an image object from the Python Image
> Library? I'd like to do some arithmetic on the values.
Yes.
To transport the data:
>>> import num
On Wednesday 19 July 2006 14:41,
[EMAIL PROTECTED] wrote:
> Your membership in the mailing list Numpy-discussion has been disabled
> due to excessive bounces The last bounce received from you was dated
> 19-Jul-2006. You will not get any more messages from this list until
> you re-enable your mem
On Wednesday 12 July 2006 02:07, Michael Sorich wrote:
> On 7/12/06, JJ <[EMAIL PROTECTED]> wrote:
> > 2) It would be very convienient to have some simple way to delete
> > selected columns of a matrix. For example, in matlab the command is
> > X[:,[3,5,7]]=[] to delete the three selected columns.
Hi,
> Opteron 64-bit, r2631 SVN.
>
> In [4]: depths_s2 = empty(shape=(5,),dtype=float)
> In [5]: depths_s2.fill(2.e5)
> In [6]: depths_s2
> Out[6]: array([ 20., 20., 20., 20., 20.])
>
> In [11]: depths_s2 = (empty(shape=(5,),dtype=float)).fill(2.e5)
> In [12]: print depths_
Hi,
> I'm not sure why bool arrays cannot be used as indices.
> The "natural" solution to the original problem seemed to be:
> M[:,V>0]
> but this is not allowed.
I started a thread on this earlier this year. Try searching the archive for
"boolean indexing" (if it comes back online somewhen).
T
Hi,
> ## Output:
> numpy.__version__: 0.9.8
> y: [ 0. 1. 2. 3. 4. 5. 6. 7. 8. 9.]
> y**2: [ 0. 1. 4. 9. 16. 25. 36. 49. 64. 81.]
> z: [ 0. 1. 2. 3. 4. 5. 6. 7. 8. 9.]
> z**2: [ 0.e+00 1.e+00 1.6000e+01 8.1000e+01
>2.5600e+0
Hi,
> def d4():
> d = zeros([4, 1000], dtype=float)
> for i in range(4):
> xy = A[i] - B
> d[i] = sqrt( sum(xy**2, axis=1) )
> return d
>
> Maybe there's another alternative to d4?
> Thanks again,
I think this is the fastest you can get. Maybe it would be nicer to use
Hi,
def dtest():
A = random( [4,2])
B = random( [1000,2])
# drawback: memory usage temporarily doubled
# solution see below
d = A[:, newaxis, :] - B[newaxis, :, :]
# written as 3 expressions for more clarity
d = sqrt((d**2).sum(axis=2))
return d
def dtest_lowmem(
> I've tried to send a message twice to scipy-user since friday without
> success (messages don't come back to me but I don't receive any message
> from scipy-user too and they don't appear in archives).
> Note that since friday there are no new messages from that list.
>
> Is scipy-user working?
Hi,
> I'm just starting with numpy (via scipy) and I'm wanting to perform
> adaptive thresholding
> (http://www.cee.hw.ac.uk/hipr/html/adpthrsh.html) on an image.
> Basically that means that I need to get a threshold for each pixel by
> examining the pixels around it. In numpy this translates to f
17 matches
Mail list logo