On 9/4/10 12:56 PM, andrew ewart wrote:
if a have a matrix M of dimension (m,n)
how do i first check for j columns deep (from left), j<=n
for when the ith row will be all zeros
eg
M=([1,0,1],[0,0,1],[1,1,1])
check j=1 gives output of 1
j=2 gives output of 1 and j=3 gives output of 3
I realize that the matrix documentation is spread out over several
different pages in a rather nonsensical fashion, so it's hard to find
things. Here are parts of the documentation that deal directly with
your questions
For your first, I would probably use a for loop to loop through all the
rows and check each one. You might find nonzero_positions useful:
http://sagemath.org/doc/reference/sage/matrix/matrix0.html?highlight=nonzero_positions#sage.matrix.matrix0.Matrix.nonzero_positions
http://sagemath.org/doc/reference/sage/matrix/matrix0.html?highlight=nonzero_positions#sage.matrix.matrix0.Matrix.nonzero_positions_in_row
also how do i take out a matrix N of dimension (k,l) k<=m,l<=n
out of a the matrix M
http://sagemath.org/doc/reference/sage/matrix/docs.html#indexing
(look at the second example)
And here is the rest of the documentation (spread out over lots of
different pages):
http://sagemath.org/doc/reference/matrices.html
Here is another function that is useful:
http://sagemath.org/doc/reference/sage/matrix/matrix1.html#sage.matrix.matrix1.Matrix.submatrix
To others: is there a way we can at least combine these three pages into
one?
# Base class for matrices, part 0
# Base class for matrices, part 1
# Base class for matrices, part 2
(see http://sagemath.org/doc/reference/matrices.html)
Thanks,
Jason
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org