Top
Back: 4.9.2 matrix expressions
Forward: 4.9.4 matrix operations
FastBack: 4. Data types
FastForward: 5. Functions and system variables
Up: 4.9 matrix
Top: Singular 2-0-4 Manual
Contents: Table of Contents
Index: F. Index
About: About This Document

4.9.3 matrix type cast

Syntax:

matrix ( expression )
matrix ( expression, int_n, int_m )

Type:

matrix

Purpose:

Converts expression to a matrix, where expression must be of type int, intmat, intvec, number, poly, ideal, vector, module, or matrix. If int_n and int_m are supplied, then they specify the dimension of the matrix. Otherwise, the size (resp. dimensions) of the matrix are determined by the size (resp. dimensions) of the expression.

Example:
 
  ring r=32003,(x,y,z),dp;
  matrix(x);
→ _[1,1]=x
  matrix(x, 1, 2);
→ _[1,1]=x
→ _[1,2]=0
  matrix(intmat(intvec(1,2,3,4), 2, 2));
→ _[1,1]=1
→ _[1,2]=2
→ _[2,1]=3
→ _[2,2]=4
  matrix(_, 2, 3);
→ _[1,1]=1
→ _[1,2]=2
→ _[1,3]=0
→ _[2,1]=3
→ _[2,2]=4
→ _[2,3]=0
  matrix(_, 2, 1);
→ _[1,1]=1
→ _[2,1]=3

See Type conversion and casting; intmat type cast; matrix.


Top Back: 4.9.2 matrix expressions Forward: 4.9.4 matrix operations FastBack: 4. Data types FastForward: 5. Functions and system variables Up: 4.9 matrix Top: Singular 2-0-4 Manual Contents: Table of Contents Index: F. Index About: About This Document
            User manual for Singular version 2-0-4, October 2002, generated by texi2html.