[Next] [Prev] [Right] [Left] [Up] [Index] [Root]
Accessing and Modifying a Matrix
Accessing and Modifying a Matrix
Subsections
Indexing
a[i] : MatHomElt, RngIntElt -> ModTupRngElt
Given an element a belonging to the module Hom_R(M, N),
return the i-th row of a as an element of the module N.
a[i] := u : ModMatRngElt, RngIntElt, RngElt -> ModMatRngElt
Given an element a belonging to the module Hom_R(M, N), an integer
i lying in the range [1, n], and an element u belonging to N,
replace the i-th row of a by the vector u.
a[i, j] : ModMatRngElt, RngIntElt, RngIntElt -> RngElt
Given an element a belonging to a submodule to the module Hom_R(M, N),
where Rank(M) = m and Rank(N) = n, and positive integers i and j
such that 1 <= i, j <= n, return
the (i, j)-th component of a (as an element of the ring R).
a[i, j] := t : ModMatRngElt, RngIntElt, RngIntElt, RngElt -> ModMatRngElt
Given an element a belonging to a submodule to the module Hom_R(M, N),
where Rank(M) = m and Rank(N) = n, and positive integers i and j
such that 1 <= i, j <= n, replace
the (i, j)-th component of a by t.
ElementToSequence(a) : ModMatRngElt -> [ RngElt ]
Eltseq(a) : ModMatRngElt -> [ RngElt ]
Given an element a = (a_(ij)), 1 <= i, j <= n, belonging to a
submodule to the module Hom_R(M, N), return a as the sequence of
elements of S:
[a_(11), ..., a_(1n), a_(21), ..., a_(2n), ..., a_(n1), ..., a_(nn)].
Example HMod_Indexing (H43E8)
We illustrate the use of the indexing operations on a module of
Z-module homomorphisms.
> Z := Integers();
> Z5 := RSpace(Z, 5);
> Z6 := RSpace(Z, 6);
> M := Hom(Z5, Z6);
> A := M ! [ 3, 1, 0, -4, 2, -12,
> 2, -4, -5, 5, 23, 6,
> 8, 0, 0, 1, 5, 12,
> -2, -6, 3, 8, 9, 17,
> 11, 12, -6, 4, 2, 27 ];
> A;
[ 3 1 0 -4 2 -12]
[ 2 -4 -5 5 23 6]
[ 8 0 0 1 5 12]
[ -2 -6 3 8 9 17]
[ 11 12 -6 4 2 27]
> A[3];
( 8 0 0 1 5 12)
> A[3, 4];
1
> A[2] := Z6 ! [ 5, -3, 0, 1, 0, 2 ];
> A;
[ 3 1 0 -4 2 -12]
[ 5 -3 0 1 0 2]
[ 8 0 0 1 5 12]
[ -2 -6 3 8 9 17]
[ 11 12 -6 4 2 27]
> A[2, 3] := -6;
> A;
[ 3 1 0 -4 2 -12]
[ 5 -3 -6 1 0 2]
[ 8 0 0 1 5 12]
[ -2 -6 3 8 9 17]
[ 11 12 -6 4 2 27]
Extracting and Inserting Blocks
Submatrix(a, i, j, p, q) : ModMatRngElt, RngIntElt, RngIntElt, RngIntElt, RngIntElt -> ModMatRngElt
ExtractBlock(a, i, j, p, q) : ModMatRngElt, RngIntElt, RngIntElt, RngIntElt, RngIntElt -> ModMatRngElt
Given a homomorphism a belonging to the module Hom_R(M, N), where
Rank(M) = m, Rank(N) = n, and integers i, j, p and q satisfying
the conditions 1 <= i + p <= m, 1 <= j + q <= n, create the element
of Hom(P, Q), where Rank(P) = p, Rank(Q) = q, consisting of the
p x q submatrix of a whose first entry is the (i, j)-th entry of a.
InsertBlock(~a, b, i, j) : ModMatRngElt, AlgMatElt, RngIntElt, RngIntElt -> ModMatRngElt
Let a be a homomorphism belonging to a submodule Hom_R(M, N), with
Rank(M) = m, and Rank(N) = n, and let b be a homomorphism belonging
to a submodule of Hom_R(P, Q), with Rank(P) = p, and Rank(Q) = q.
Let i and j be integers satisfying the conditions 1 <= i + p <= m,
1 <= j + q <= n. This procedure modifies a so that the p x q
block beginning at the (i, j)-th entry is replaced by b.
Joining Matrices
HorizontalJoin(X, Y) : ModMatRngElt, ModMatRngElt -> ModMatRngElt
Given matrices X with r rows and c columns, and Y
with r rows and d columns, both over the same coefficient ring R,
return the matrix over R with r rows and
(c + d) columns obtained by joining X and Y horizontally (placing
Y to the right of X).
HorizontalJoin(Q) : [ ModMatRngElt ] -> ModMatRngElt
Given a sequence Q of matrices, each having the same number of rows and
being over the same coefficient ring R,
return the matrix over R
obtained by joining the elements of Q horizontally in order.
VerticalJoin(X, Y) : ModMatRngElt, ModMatRngElt -> ModMatRngElt
Given matrices X with r rows and c columns and Y
with s rows and c columns, both over the same coefficient ring R,
return the matrix with (r + s) rows and c columns over R obtained
by joining X and Y vertically (placing Y underneath X).
VerticalJoin(Q) : [ ModMatRngElt ] -> ModMatRngElt
Given a sequence Q of matrices, each having the same number of columns and
being over the same coefficient ring R,
return the matrix over R
obtained by joining the elements of Q vertically in order.
DiagonalJoin(X, Y) : ModMatRngElt, ModMatRngElt -> ModMatRngElt
Given matrices X with a rows and b columns and Y
with c rows and d columns, both over the same coefficient ring R,
return the matrix with (a + c) rows and (b + d) columns over R obtained
by joining X and Y diagonally (placing Y diagonally to the right
of and underneath X, with zero blocks above and below the diagonal).
DiagonalJoin(Q) : [ ModMatRngElt ] -> ModMatRngElt
Given a sequence Q of matrices, each being over the same coefficient ring R,
return the matrix over R
obtained by joining the elements of Q diagonally in order.
[Next] [Prev] [Right] [Left] [Up] [Index] [Root]