Home Online Manual
Top
Back: flatten
Forward: is_complex
FastBack: Linear algebra
FastForward: linalg_lib
Up: matrix_lib
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

D.3.1.6 genericmat

Procedure from library matrix.lib (see matrix_lib).

Usage:
genericmat(n,m[,id]); n,m=integers, id=ideal

Return:
nxm matrix, with entries from id.

Note:
if id has less than nxm elements, the matrix is filled with 0's, (default: id=maxideal(1)).
genericmat(n,m); creates the generic nxm matrix

Example:
 
LIB "matrix.lib";
ring R = 0,x(1..16),lp;
print(genericmat(3,3));      // the generic 3x3 matrix
==> x(1),x(2),x(3),
==> x(4),x(5),x(6),
==> x(7),x(8),x(9) 
ring R1 = 0,(a,b,c,d),dp;
matrix A = genericmat(3,4,maxideal(1)^3);
print(A);
==> a3, a2b,a2c,a2d,
==> ab2,abc,abd,ac2,
==> acd,ad2,b3, b2c 
int n,m = 3,2;
ideal i = ideal(randommat(1,n*m,maxideal(1),9));
print(genericmat(n,m,i));    // matrix of generic linear forms
==> 4a-8b-2c-3d,-a+b-4c+5d,
==> -8a-9b+c+7d,a-9b+9c+4d,
==> 6a-5b+9c,   2a+8c+d