[SciPy-user] Triangular Matrix, Matrix Manipulations

Chris Lasher chris.lasher at gmail.com
Thu Jun 8 16:57:56 CDT 2006

Hi all,

I am unsure whether my question is more appropriate for the SciPy or
NumPy discussion list, but I'm hoping I chose wisely; if not, please
feel free to correct me and I'll redirect the email.

I am interested in learning if a triangular matrix (lower or upper,
does not matter to me) structure exists in SciPy or NumPy. I'd like to
work with DNA or protein distance matrices, which are symmetric about
the central axis ([0][0] to [n][n]) and such a structure might help

The main two things I am looking to do are:
* Tally the number of entries in a matrix that are equal to or
greater/less than a specified value.
* Randomly shuffle the values in a matrix.

I'm interested in using an approach with these libraries to keep
memory usage and execution times lower, as some of these distance
matrices can be thousands x thousands of sequences. A triangular
matrix structure might be nice to halve the amount of iteration and
also make it easier to randomly shuffle the values (since a square
matrix requires the values to be shuffled symmetrically, or to be
built from scratch one value at a time).

My questions and approaches may be really naive, and I apologize in
advance for that. My background is in the biological sciences, but I
am openly ignorant about linear algebra/matrix-based mathematics. I
have been programming in Python for two years now, but have no
experience with SciPy and NumPy/Numeric/NumArray. I have searched
through the NumPy documentation, which I purchased, as well as hunted
through the SciPy API documentation, but I either have not looked in
the right place or did not register what I was reading was what I was
looking for. These aren't excuses for not knowing the proper way to go
about this, I just want to be candid about my level of knowledge.

Thanks very much in advance for your helpful comments and suggestions,
as I do truly appreciate them.

Chris Lasher

More information about the SciPy-user mailing list