Matrices.mesa
Last Edited by: Arnon, March 5, 1986 10:49:31 am PST
DIRECTORY
AlgebraClasses;
Rectangular Matrices over a Group. Square matrices over a ring (yielding a ring) or a field (yielding an algebra) are subclasses.
Matrices: CEDAR DEFINITIONS
~ BEGIN OPEN AC: AlgebraClasses;
Matrix Representation
Matrix: TYPE = AC.Object;
MatrixData: TYPE = RowSeq;
RowSeq: TYPE = REF RowSeqRec;
RowSeqRec: TYPE = RECORD[SEQUENCE rowsPlusOne: [1..1000] OF Row];
Row: TYPE = REF RowRec;
RowRec: TYPE = RECORD[SEQUENCE columnsPlusOne: [1..1000] OF AC.Object];
Instance Data for Matrix Rings and Matrix Algebras
MatrixStructureData: TYPE = REF MatrixStructureDataRec;
MatrixStructureDataRec: TYPE = RECORD [
elementStructure: AC.Object,
nRows, nCols: NAT
];
Matrix Structure Ops
MakeMatrixStructure: AC.MatrixStructureConstructor;
A particular matrix structure is defined by its elementStructure and its nRows, nCols. elementStructure can be a ring, field, algebra, or divisionAlgebra.
PrintName: AC.PrintNameProc;
ShortPrintName: AC.PrintNameProc;
ElementStructure: AC.UnaryOp;
NumRows: AC.StructureRankOp;
NumCols: AC.StructureRankOp;
Dimension: AC.StructureRankOp;
For square matrices only
IsMatrixStructure: AC.UnaryPredicate;
Characteristic: AC.StructureRankOp;
Characteristic of elementStructure
Conversion and IO
Recast: AC.BinaryOp;
CanRecast: AC.BinaryPredicate;
ToExpr: AC.ToExprOp;
LegalFirstChar: AC.LegalFirstCharOp;
Read: AC.ReadOp;
FromRope: AC.FromRopeOp;
ToRope: AC.ToRopeOp;
Write: AC.WriteOp;
Constructors
DiagonalMatrix: AC.UnaryImbedOp;
MatrixFromRowTemplate: AC.BinaryOp;
firstArg is a Vector, a row template of size n; secondArg is an Int.Int = m specifying how many of those rows we want. Thus result is an m x n matrix.
MakeMatrix: AC.MatrixImbedOp;
Selection
Element: AC.TernaryOp;
firstArg is a Matrix, secondArg and thirdArg are Ints.Int's specifying (resp.) row and column to select. Returns NIL if can't do.
Arithmetic
Zero: AC.NullaryOp;
One: AC.NullaryOp;
Add: AC.BinaryOp;
Negate: AC.UnaryOp;
Subtract: AC.BinaryOp;
Multiply: AC.BinaryOp;
Power: AC.BinaryOp;
Invert: AC.UnaryOp;
Divide: AC.BinaryOp;
ScalarMultiply: AC.BinaryOp;
firstArg is scalar, secondArg is matrix
Transpose: AC.UnaryOp;
Determinant: AC.StructuredToGroundOp;
Comparison
Equal: AC.BinaryPredicate;
END.