Hello,
For scipy.sparse.csc_matrices, is there an equivalent for the
following dense array operation?
Example:
tempA = scipy.empty((10,0))
tempB = scipy.random.random((10,1))
scipy.hstack((tempA, tempB))
i.e - you concatenate an empty n x 0 sparse matrix with a n x 1 sparse
matrix to yield a n
Hello,
I am trying to translate some Matlab code to NumPy. I started reading the
NumPy book and, yeah it's a very long read :-/ One thing I am completely
confused about are the concpets of "basic" vs. "advanced" indexing. Are
there some good examples out there where for the same piece of code - M
Thank you everybody for your replies.
Completely off-topic:
I just read your sig Christoper:
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R
Do you work with tsunami early-warning systems? I once had to give a
presentation at Uni about the type of buoy
Hi,
so one thing I came across now is the following, very simple:
Matlab:
A = []
while
A = [A some_scalar_value]
end
In Python, I tried:
A = empty((0,0))
while
A = concatenate((A, array([someScalarValue])), 1)
end
which returns an error since the shape of the empty A does not
On 3/14/07, Sven Schreiber <[EMAIL PROTECTED]> wrote:
If you want a 1d-array in the end you could try empty(0) to start with,
and then do hstack((A, your_scalar)) or something like that.
Yeah, that works - odd, I thought concatenate((a,b),0) == hstack((a,b))
Thanks
/David
___
On 3/14/07, Gael Varoquaux <[EMAIL PROTECTED]> wrote:
I definitely second this comment. Using arrays when you are trying to
append a lot of data is using the wrong data format. And the code is so
much more readable with lists.
Thank you,
I will consider it,
Next thing, I have
A_Idx = arr
On 3/15/07, David Koch <[EMAIL PROTECTED]> wrote:
... NumPy equiv for Matlab B(A_idx, A_Idx)
Ok, I did like this:
A_Idx = array([1, 0])
B = random.randn(3,3)
rowInd = kron(ones((1, len(A_Idx)), int), A_Idx[:, newaxis])
colInd = kron(ones((len(A_Idx), 1), int), A_Idx)
B[rowInd,
Hi,
naive question - how do I get an overview over everything to do with "sparse
functionality" in SciPy 0.5.2 ... I can't find any documentation anywhere.
/David
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/ma
I will consider it Sven, I thought it was a good idea to collect everything
which had to do with Matlab -> Python in one thread.
Anyway,
Specifically, I was looking for an equivalent to Matlab's "sprand" which
allows one to create sparse normally distributed matrices. The function also
accepts
Hi,
I implemented an algorithm in NumPy which assumes that the input is of type
ndarray, so elementwise multiplication is done as dot(x,y), equation solving
using linalg.solve etc. I now want to modify the whole thing to accept
scipy.sparse matrices (which for instance has linsolve.spsolve instea
Ok, I will bump this once ...
The "worst" problem I encountered is that sparse matrices do not seem to
support the kind of indexing I need. At least I get "NotImplementedError:
sequence indexing not yet fully supported" and "
supports slices only of a single row" errors all the time.
Any advice
Ah! So much ado about nothing. What I was looking for was in fact:
B[A_idx][:,A_idx] ... it's even explained in the the NumPy for Matlab Users
doc on scipy.org
/Thank you
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.sci
Alright, may all the trickery rest until that day.
One thing I need to do however is patch a column of "ones" onto a sparse
matrix of format n * d with n >> d. I tried "concatenate" and it didn't work
so I did like this:
def spInsCol(X):
"insert doc string"
n, d = shape(X)
X = X.tocsc(
Hi,
Ok, I got it to work now but - damn, it's ugly. I thought I'd have to watch
the differences between ndarray and matrix type but it turns out
sparseMatrix is yet again different from matrix in several respects when it
comes to certain operations. Is this intended or something that will be
mend
Hi again,
I want to select/access several columns from a sparse csc_matrix. The only
way I could think of is the following enormously inefficient algorithm which
basically initalizes a new lil_matrix (for assigments) and loops over all
the specified columns and does sparse -> dense -> sparse. All
Hi,
I ran some tests on the very same matrices in Matlab/Numpy and it seems that
for sparse matrix multipilcation to be faster than dense multiplication -
the degree of sparsity has to be much higher in Numpy than in Matlab. Is
there anything I can tune in the underlying routines? I need good
per
On 3/26/07, Robert Cimrman <[EMAIL PROTECTED]> wrote:
Could you be more specific on which type of the sparse matrix storage
did you use?
Hi Robert,
I used csc_matrix.
/David
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://pro
make the whole operation faster. It's still about 1000 times
slower than Matlab but 4 times faster than before.
Note, that .transpose already switches the matrix
On 3/26/07, Robert Cimrman <[EMAIL PROTECTED]> wrote:
David Koch wrote:
> On 3/26/07, Robert Cimrman <[EMAIL
On 3/27/07, Robert Cimrman <[EMAIL PROTECTED]> wrote:
ok. now which version of scipy (scipy.__version__) do you use (you may
have posted it, but I missed it)? Not so long ago, there was an effort
by Nathan Bell and others reimplementing sparsetools + scipy.sparse to
get better usability and per
19 matches
Mail list logo