UserManual | (Japanese)

matrix

matrix module provides matrices.

Functions

createMatrix(row[, column, compo*1, coeff_ring])

A factory function to create an instance of RingMatrix, RingSquareMatrix, FieldMatrix or FieldSquareMatrix.
Your input determines the class automatically by examining the matrix size and the coefficient ring.
row and column must be interger, and coeff_ring must be an instance of ring.Ring.

compo must be one of these forms below.

  1. concatenated row lists*2, such as:
    matrix.createMatrix(3, 2, [1,2]+[3,4]+[5,6])
  2. list of row lists, such as:
    matrix.createMatrix(3, 2, [[1,2], [3,4], [5,6]])
  3. list of column tuples, such as:
    matrix.createMatrix(3, 2, [(1,3,5), (2,4,6)])
  4. list of the vectors whose dimension equals column, such as:
    matrix.createMatrix(3, 2, [vector.Vector([1,3,5]), vector.Vector([2,4,6])])
    
    The examples above represent the same matrix form as follows:
    1 2
    3 4
    5 6

If you abbreviate compo, it will be deemed to all zero list.

Ex.

>>> print matrix.createMatrix(3, [1,2,3]+[4,5,6]+[7,8,9])
1 2 3
4 5 6
7 8 9

identityMatrix(size [,coeff])

unitMatrix(size [,coeff])

return unit matrix of size. coeff enables us to create matrix not in integer but in coefficient ring which is determined by coeff. coeff must be an instance of ring.Ring or a multiplication unit(one).

zeroMatrix(row [,column, coeff]

return zero matrix whose row is row and column is column. coeff enables us to create matrix not in integer but in coefficient ring which is determined by coeff. coeff must be an instance of ring.Ring or an addition unit(zero).

Classes

Matrix

SquareMatrix

RingMatrix

RingSquareMatrix

FieldMatrix

FieldSquareMatrix

MatrixRing

Subspace

Exception Classes

MatrixSizeError

VectorsNotIndependent

NoInverseImage

NoInverse


*1 Of cource, compo means component.
*2 or you can pass straight list, i.e. [1, 2, 3, 4, 5, 6].