[Numpy-discussion] set operation

2010-08-17 Thread gerardob
I would like to create a set composed of the numbers 2,3,4,...49,50,51. How do i do? Thanks. -- View this message in context: http://old.nabble.com/set-operation-tp29449267p29449267.html Sent from the Numpy-discussion mailing list archive at Nabble.com. _

[Numpy-discussion] basic question about numpy arrays

2010-08-16 Thread gerardob
I have a numpy array A , such that when i print A it appears: [[ 10.] [ 20.]] I would like to have a one dimensional array B (obtained from A) such that B[0] = 10 and B[1]=20. It could be seen as the transpose of A. How can i obtain B = [10,20] from A? I tried transpose(1,0) but it doesn't se

Re: [Numpy-discussion] two dimensional array of sets

2010-08-12 Thread gerardob
As i wrote, the elements of each A[i][j] are sets and not numbers. David Warde-Farley-2 wrote: > > On 2010-08-12, at 3:59 PM, gerardob wrote: > >> >> Hello, this is a very basic question but i don't know the answer. >> >> I would like to construct a two

[Numpy-discussion] two dimensional array of sets

2010-08-12 Thread gerardob
Hello, this is a very basic question but i don't know the answer. I would like to construct a two dimensional array A, such that A[i][j] contains a set of numbers associated to the pair (i,j). For example, A[i][j] can be all the numbers that are written as i^n*j*5-n for some all n=1,..,5 Is nump

[Numpy-discussion] check for inequalities on a list

2010-05-10 Thread gerardob
I have three lists of floats of equal lenght: upper_bound, lower_bound and x. I would like to check whether lower_bound[i]<= x[i] <= upper_bound[i] for all i in range(len(x)) Which is the best way to do this? Thanks. -- View this message in context: http://old.nabble.com/check-for-inequalit

[Numpy-discussion] Improvement of performance

2010-05-04 Thread gerardob
Hello, I have written a very simple code that computes the gradient by finite differences of any general function. Keeping the same idea, I would like modify the code using numpy to make it faster. Any ideas? Thanks. def grad_finite_dif(self,x,user_data = None):

[Numpy-discussion] scipy error undefined symbol: lsame_

2010-04-20 Thread gerardob
I installed scipy (and all the required libraries) and the following error appears when i tried run a simple example which uses the optimize package of scipy. I tried also numpy alone and it works ( at least for printing numpy.array([10,20,10])) error: Traceback (most recent call last): File "

[Numpy-discussion] Matrix operation.

2010-04-02 Thread gerardob
Let A be a square matrix of 0's and 1's, and let X be a one dimesional vector. The length of X is equal to the number of 1's that A has. I would like to produce a new matrix B by traversing the matrix A row by row and: 1- whenever i find a 0, set B in that position to zero. 2- whenever i find a 1,

[Numpy-discussion] lists of zeros and ones

2010-03-19 Thread gerardob
Hello, i would like to produce lists of lists 1's and 0's. For example, to produce the list composed of: L = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]] I just need to do the following: n=4 numpy.eye(n,dtype=int).tolist() I would like to know a simple way to generate a list containing all the l

[Numpy-discussion] matrix operation

2010-03-17 Thread gerardob
Let A and B be two n x n matrices. I would like to have another n x n matrix C such that C_ij = min {A_ij, B_ij} Example: A = numpy.array([[2,3],[10,12]]) B = numpy.array([[1,4],[9,13]]) Output C = [[1,3],[9,12]] The function min(axis) of numpy seems to be only unary. Thanks. -- View thi

[Numpy-discussion] Setting small numbers to zero.

2010-03-17 Thread gerardob
How can i modified all the values of a numpy array whose value is smaller than a given epsilon to zero? Example epsilon=0.01 a = [[0.003,2][23,0.0001]] output: [[0,2][23,0]] -- View this message in context: http://old.nabble.com/Setting-small-numbers-to-zero.-tp27933569p27933569.html Sent f