nzmath.matrix | (Japanese)

Subspace

The class is for subspace of some vector space over a field. It inherits FieldMatrix

Constructor

Subspace(row[, column, compo, coeff_ring, isbasis])

row and column must be a positive integer. compo must be a list form. coeff_ring must be an instance of ring.Ring. If isbasis is True, we assume column vectors are linearly independent.

>>> A = matrix.Subspace(3, 2, [1,2]+[3,4]+[5,7])
>>> print A
1 2
3 4
5 7

Attribute

isbasis

The attribute indicates the linear independence of column vectors, i.e., if they form a basis of the space then it's True, otherwise False.
(new in 0.90.0)

Methods

fromMatrix(mat [,isbasis])

Create a Subspace instance from a matrix instance mat, whose class can be any of subclasses of Matrix. Please use this method if you want a Subspace instance for sure.

This is a class method.
(new in 0.90.0)

isSubspace(other)

Return True if the subspace instance is a subspace of the other, or False otherwise.
(new in 0.90.0)

>>> A = matrix.Subspace(4, 2, [1,2]+[3,4]+[5,6]+[7,9])
>>> B = matrix.Subspace(4, 3, [1,2,-4]+[5,9,-3]+[9,16,-2]+[12,26,-1])
>>> A.isSubspace(B)
True

toBasis()

Rewrite self so that its column vectors form a basis, and set True to isbasis. The attempt might be avoided if isbasis is already True.
(new in 0.90.0)

>>> A = matrix.Subspace(4, 3, [1,2,3]+[4,5,6]+[7,8,9]+[10,11,12])
>>> A.toBasis()
>>> print A
 1  2
 4  5
 7  8
10 11

supplementBasis()

Return full rank matrix by supplementing basises for self.

>>> A = matrix.Subspace(3, 2, [1,2]+[3,4]+[5,7])
>>> print A
1 2 0
3 4 0
5 7 1

sumOfSubspaces(other)

Given columns span a subspace m x n matrix self and other, return a matrix whose columns form a basis for sum of two subspaces.
(new in 0.90.0. It was provided as a module function in old versions.)

>>> A = matrix.Subspace(4, 1, [1,2,3,4])
>>> B = matrix.Subspace(4, 2, [2,-4]+[4,-3]+[6,-2]+[8,-1])
>>> print A.sumOfSubspaces(B)
1 -4
2 -3
3 -2
4 -1

intersectionOfSubspaces(other)

Given columns span a subspace m × n matrix self and other, return a matrix whose columns form a basis for intersection of two subspaces.
(new in 0.90.0. It was provided as a module function in old versions.)

>>> A = matrix.Subspace(4, 1, [1,2,3,4])
>>> B = matrix.Subspace(4, 2, [2,-4]+[4,-3]+[6,-2]+[8,-1])
>>> print A.sumOfSubspaces(B)
-2/1
-4/1
-6/1
-8/1