Loading...
Searching...
No Matches
matpol.h
Go to the documentation of this file.
#ifndef MATPOL_H
#define MATPOL_H
/****************************************
* Computer Algebra System SINGULAR *
****************************************/
/*
* ABSTRACT
*/
#include "polys/monomials/ring.h"
// THIS IS REALLY DIRTY: ip_smatrix HAS TO BE IDENTICAL TO ip_sideal
// SO, DON'T CHANGE THE DECLARATION OF ip_smatrix
class ip_smatrix
{
public:
poly *m;
long rank;
int nrows;
int ncols;
inline int& rows() { return nrows; }
inline int& cols() { return ncols; }
#define MATROWS(i) ((i)->nrows)
#define MATCOLS(i) ((i)->ncols)
/// 1-based access to matrix
#define MATELEM(mat,i,j) ((mat)->m)[(long)MATCOLS((mat)) * (long)((i)-1) + (long)(j)-1]
/// 0-based access to matrix
#define MATELEM0(mat,i,j) ((mat)->m)[(long)MATCOLS((mat)) * (long)(i) + (long)(j)]
};
enum DetVariant
{
DetDefault=0,
DetBareiss,
DetSBareiss,
DetMu,
DetFactory
};
typedef ip_smatrix * matrix;
matrix mpNew(int r, int c);
#define mp_New(r,c,R) mpNew(r,c)
void mp_Delete(matrix* a, const ring r);
matrix mp_Copy(const matrix a, const ring rSrc, const ring rDst);
matrix mp_Copy(matrix a, const ring r);
matrix mp_InitP(int r, int c, poly p, const ring R);
matrix mp_InitI(int r, int c, int v, const ring R);
matrix mp_MultI(matrix a, long f, const ring r);
matrix mp_MultP(matrix a, poly p, const ring r);
matrix pMultMp(poly p, matrix a, const ring r);
matrix mp_Add(matrix a, matrix b, const ring r);
matrix mp_Sub(matrix a, matrix b, const ring r);
matrix mp_Mult(matrix a, matrix b, const ring r);
matrix mp_Transp(matrix a, const ring r);
BOOLEAN mp_Equal(matrix a, matrix b, const ring r);
poly mp_Trace ( matrix a, const ring r);
poly TraceOfProd ( matrix a, matrix b, int n, const ring r);
matrix mp_Wedge(matrix a, int ar, const ring r);
// BOOLEAN mpJacobi(leftv res,leftv a);
// BOOLEAN mpKoszul(leftv res,leftv b/*in*/, leftv c/*ip*/, leftv id=NULL);
poly mp_Det(matrix a, const ring r, DetVariant d=DetDefault);
poly mp_DetBareiss (matrix a, const ring r);
poly mp_DetMu(matrix A, const ring R);
//matrix mp_Homogen(matrix a, int v, const ring r);
void mp_Monomials(matrix c, int r, int var, matrix m, const ring R);
/// corresponds to Maple's coeffs:
/// var has to be the number of a variable
matrix mp_Coeffs(ideal I, int var, const ring r);
matrix mp_CoeffProc (poly f, poly vars, const ring r);
matrix mp_CoeffProcId (ideal I, poly vars, const ring R);
/// corresponds to Macauley's coef:
/// the exponent vector of vars has to contain the variables, eg 'xy';
/// then the poly f is searched for monomials in x and y, these monomials
/// are written to the first row of the matrix co.
/// the second row of co contains the respective factors in f.
/// Thus f = sum co[1,i]*co[2,i], i = 1..cols, rows equals 2.
void mp_Coef2(poly v, poly vars, matrix *c, matrix *m, const ring r);
/// for minors with Bareiss
void mp_RecMin(int, ideal, int &, matrix, int, int, poly, ideal, const ring);
void mp_MinorToResult(ideal, int &, matrix, int, int, ideal, const ring);
BOOLEAN mp_IsDiagUnit(matrix U, const ring r);
/// set spaces to zero by default
void iiWriteMatrix(matrix im, const char *n, int dim, const ring r, int spaces);
char * iiStringMatrix(matrix im, int dim, const ring r, char ch=',');
EXTERN_VAR omBin ip_smatrix_bin;
int mp_Compare(matrix a, matrix b, const ring r);
// -------------------------------------------------------
ideal sm_Add(ideal a, ideal b, const ring R);
ideal sm_Sub(ideal a, ideal b, const ring R);
ideal sm_Mult(ideal a, ideal b, const ring R);
ideal sm_Flatten(ideal a, const ring R);
ideal sm_UnFlatten(ideal a, int col, const ring R);
poly sm_Trace ( ideal a, const ring R);
int sm_Compare(ideal a, ideal b, const ring R);
BOOLEAN sm_Equal(ideal a, ideal b, const ring R);
ideal sm_Tensor(ideal A, ideal B, const ring r);
poly sm_Det(ideal I, const ring, DetVariant d=DetDefault);
DetVariant mp_GetAlgorithmDet(matrix m, const ring r);
DetVariant mp_GetAlgorithmDet(const char *s);
#define SMATELEM(A,i,j,R) p_Vec2Poly(A->m[j],i+1,R)
#endif/* MATPOL_H */
BOOLEAN
int BOOLEAN
Definition auxiliary.h:88
m
int m
Definition cfEzgcd.cc:128
p
int p
Definition cfModGcd.cc:4086
b
CanonicalForm b
Definition cfModGcd.cc:4111
f
FILE * f
Definition checklibs.c:9
ip_smatrix
Definition matpol.h:15
ip_smatrix::nrows
int nrows
Definition matpol.h:20
ip_smatrix::rank
long rank
Definition matpol.h:19
ip_smatrix::ncols
int ncols
Definition matpol.h:21
ip_smatrix::m
poly * m
Definition matpol.h:18
ip_smatrix::cols
int & cols()
Definition matpol.h:24
ip_smatrix::rows
int & rows()
Definition matpol.h:23
s
const CanonicalForm int s
Definition facAbsFact.cc:51
B
b *CanonicalForm B
Definition facBivar.cc:52
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
EXTERN_VAR
#define EXTERN_VAR
Definition globaldefs.h:6
ip_smatrix_bin
EXTERN_VAR omBin ip_smatrix_bin
Definition matpol.h:105
matrix
ip_smatrix * matrix
Definition matpol.h:43
pMultMp
matrix pMultMp(poly p, matrix a, const ring r)
Definition matpol.cc:158
sm_Tensor
ideal sm_Tensor(ideal A, ideal B, const ring r)
Definition matpol.cc:1827
sm_UnFlatten
ideal sm_UnFlatten(ideal a, int col, const ring R)
Definition matpol.cc:1942
sm_Compare
int sm_Compare(ideal a, ideal b, const ring R)
Definition matpol.cc:1980
sm_Add
ideal sm_Add(ideal a, ideal b, const ring R)
Definition matpol.cc:1867
sm_Trace
poly sm_Trace(ideal a, const ring R)
Definition matpol.cc:1969
mp_MultP
matrix mp_MultP(matrix a, poly p, const ring r)
multiply a matrix 'a' by a poly 'p', destroy the args
Definition matpol.cc:141
mp_Copy
matrix mp_Copy(const matrix a, const ring rSrc, const ring rDst)
copies matrix a from rSrc into rDst
Definition matpol.cc:78
mp_IsDiagUnit
BOOLEAN mp_IsDiagUnit(matrix U, const ring r)
Definition matpol.cc:810
mp_MultI
matrix mp_MultI(matrix a, long f, const ring r)
c = f*a
Definition matpol.cc:128
mp_Delete
void mp_Delete(matrix *a, const ring r)
Definition matpol.cc:874
mp_CoeffProc
matrix mp_CoeffProc(poly f, poly vars, const ring r)
Definition matpol.cc:392
mp_Monomials
void mp_Monomials(matrix c, int r, int var, matrix m, const ring R)
Definition matpol.cc:355
mp_Coeffs
matrix mp_Coeffs(ideal I, int var, const ring r)
corresponds to Maple's coeffs: var has to be the number of a variable
Definition matpol.cc:306
mp_GetAlgorithmDet
DetVariant mp_GetAlgorithmDet(matrix m, const ring r)
Definition matpol.cc:2108
mp_Add
matrix mp_Add(matrix a, matrix b, const ring r)
Definition matpol.cc:172
mp_Compare
int mp_Compare(matrix a, matrix b, const ring r)
Definition matpol.cc:637
mp_RecMin
void mp_RecMin(int, ideal, int &, matrix, int, int, poly, ideal, const ring)
for minors with Bareiss
Definition matpol.cc:1597
mp_InitI
matrix mp_InitI(int r, int c, int v, const ring R)
make it a v * unit matrix
Definition matpol.cc:122
mp_CoeffProcId
matrix mp_CoeffProcId(ideal I, poly vars, const ring R)
Definition matpol.cc:469
mp_Transp
matrix mp_Transp(matrix a, const ring r)
Definition matpol.cc:247
sm_Sub
ideal sm_Sub(ideal a, ideal b, const ring R)
Definition matpol.cc:1877
sm_Mult
ideal sm_Mult(ideal a, ideal b, const ring R)
Definition matpol.cc:1887
mp_Trace
poly mp_Trace(matrix a, const ring r)
Definition matpol.cc:268
mp_Det
poly mp_Det(matrix a, const ring r, DetVariant d=DetDefault)
Definition matpol.cc:2139
sm_Det
poly sm_Det(ideal I, const ring, DetVariant d=DetDefault)
Definition matpol.cc:2163
mp_Mult
matrix mp_Mult(matrix a, matrix b, const ring r)
Definition matpol.cc:206
mp_Sub
matrix mp_Sub(matrix a, matrix b, const ring r)
Definition matpol.cc:189
mpNew
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition matpol.cc:37
mp_MinorToResult
void mp_MinorToResult(ideal, int &, matrix, int, int, ideal, const ring)
entries of a are minors and go to result (only if not in R)
Definition matpol.cc:1501
sm_Equal
BOOLEAN sm_Equal(ideal a, ideal b, const ring R)
Definition matpol.cc:1999
mp_Equal
BOOLEAN mp_Equal(matrix a, matrix b, const ring r)
Definition matpol.cc:656
mp_Coef2
void mp_Coef2(poly v, poly vars, matrix *c, matrix *m, const ring r)
corresponds to Macauley's coef: the exponent vector of vars has to contain the variables,...
Definition matpol.cc:574
iiStringMatrix
char * iiStringMatrix(matrix im, int dim, const ring r, char ch=',')
Definition matpol.cc:849
mp_InitP
matrix mp_InitP(int r, int c, poly p, const ring R)
make it a p * unit matrix
Definition matpol.cc:106
TraceOfProd
poly TraceOfProd(matrix a, matrix b, int n, const ring r)
Definition matpol.cc:282
DetVariant
DetVariant
Definition matpol.h:35
DetFactory
@ DetFactory
Definition matpol.h:40
DetBareiss
@ DetBareiss
Definition matpol.h:37
DetDefault
@ DetDefault
Definition matpol.h:36
DetSBareiss
@ DetSBareiss
Definition matpol.h:38
DetMu
@ DetMu
Definition matpol.h:39
iiWriteMatrix
void iiWriteMatrix(matrix im, const char *n, int dim, const ring r, int spaces)
set spaces to zero by default
Definition matpol.cc:828
mp_DetMu
poly mp_DetMu(matrix A, const ring R)
Definition matpol.cc:2066
sm_Flatten
ideal sm_Flatten(ideal a, const ring R)
Definition matpol.cc:1922
mp_Wedge
matrix mp_Wedge(matrix a, int ar, const ring r)
Definition matpol.cc:1745
mp_DetBareiss
poly mp_DetBareiss(matrix a, const ring r)
returns the determinant of the matrix m; uses Bareiss algorithm
Definition matpol.cc:1670
omBin
omBin_t * omBin
Definition omStructs.h:12
ring.h
R
#define R
Definition sirandom.c:27
A
#define A
Definition sirandom.c:24
dim
int dim(ideal I, ring r)
Definition tropicalStrategy.cc:23