Public Member Functions | Private Attributes
tgb_matrix Class Reference

#include <tgbgauss.h>

Public Member Functions

 tgb_matrix (int i, int j)
 
 ~tgb_matrix ()
 
int get_rows ()
 
int get_columns ()
 
void print ()
 
void perm_rows (int i, int j)
 
void set (int i, int j, number n)
 
number get (int i, int j)
 
BOOLEAN is_zero_entry (int i, int j)
 
void free_row (int row, BOOLEAN free_non_zeros=TRUE)
 
int min_col_not_zero_in_row (int row)
 
int next_col_not_zero (int row, int pre)
 
BOOLEAN zero_row (int row)
 
void mult_row (int row, number factor)
 
void add_lambda_times_row (int add_to, int summand, number factor)
 
int non_zero_entries (int row)
 

Private Attributes

number ** n
 
int columns
 
int rows
 
BOOLEAN free_numbers
 

Detailed Description

Definition at line 17 of file tgbgauss.h.

Constructor & Destructor Documentation

tgb_matrix::tgb_matrix ( int  i,
int  j 
)

Definition at line 462 of file tgbgauss.cc.

463 {
464  n=(number**) omAlloc(i*sizeof (number*));;
465  int z;
466  int z2;
467  for(z=0;z<i;z++)
468  {
469  n[z]=(number*)omAlloc(j*sizeof(number));
470  for(z2=0;z2<j;z2++)
471  {
472  n[z][z2]=nInit(0);
473  }
474  }
475  columns=j;
476  rows=i;
478 }
int columns
Definition: tgbgauss.h:20
#define FALSE
Definition: auxiliary.h:140
#define omAlloc(size)
Definition: omAllocDecl.h:210
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
number ** n
Definition: tgbgauss.h:19
BOOLEAN free_numbers
Definition: tgbgauss.h:22
int rows
Definition: tgbgauss.h:21
#define nInit(i)
Definition: numbers.h:24
tgb_matrix::~tgb_matrix ( )

Definition at line 480 of file tgbgauss.cc.

481 {
482  int z;
483  for(z=0;z<rows;z++)
484  {
485  if(n[z])
486  {
487  if(free_numbers)
488  {
489  int z2;
490  for(z2=0;z2<columns;z2++)
491  {
492  nDelete(&(n[z][z2]));
493  }
494  }
495  omFree(n[z]);
496  }
497  }
498  omfree(n);
499 }
int columns
Definition: tgbgauss.h:20
#define omFree(addr)
Definition: omAllocDecl.h:261
#define omfree(addr)
Definition: omAllocDecl.h:237
#define nDelete(n)
Definition: numbers.h:16
number ** n
Definition: tgbgauss.h:19
BOOLEAN free_numbers
Definition: tgbgauss.h:22
int rows
Definition: tgbgauss.h:21

Member Function Documentation

void tgb_matrix::add_lambda_times_row ( int  add_to,
int  summand,
number  factor 
)

Definition at line 606 of file tgbgauss.cc.

607 {
608  int i;
609  for(i=0;i<columns;i++)
610  {
611  if(!(nIsZero(n[summand][i])))
612  {
613  number n1=n[add_to][i];
614  number n2=nMult(factor,n[summand][i]);
615  n[add_to][i]=nAdd(n1,n2);
616  nDelete(&n1);
617  nDelete(&n2);
618  }
619  }
620 }
int columns
Definition: tgbgauss.h:20
#define nMult(n1, n2)
Definition: numbers.h:17
int i
Definition: cfEzgcd.cc:123
CanonicalForm factor
Definition: facAbsFact.cc:101
#define nDelete(n)
Definition: numbers.h:16
number ** n
Definition: tgbgauss.h:19
#define nIsZero(n)
Definition: numbers.h:19
#define nAdd(n1, n2)
Definition: numbers.h:18
void tgb_matrix::free_row ( int  row,
BOOLEAN  free_non_zeros = TRUE 
)

Definition at line 638 of file tgbgauss.cc.

639 {
640  int i;
641  for(i=0;i<columns;i++)
642  if((free_non_zeros)||(!(nIsZero(n[row][i]))))
643  nDelete(&(n[row][i]));
644  omFree(n[row]);
645  n[row]=NULL;
646 }
int columns
Definition: tgbgauss.h:20
#define omFree(addr)
Definition: omAllocDecl.h:261
int i
Definition: cfEzgcd.cc:123
#define nDelete(n)
Definition: numbers.h:16
number ** n
Definition: tgbgauss.h:19
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
number tgb_matrix::get ( int  i,
int  j 
)

Definition at line 540 of file tgbgauss.cc.

541 {
542  assume(i<rows);
543  assume(j<columns);
544  return n[i][j];
545 }
int columns
Definition: tgbgauss.h:20
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
int i
Definition: cfEzgcd.cc:123
number ** n
Definition: tgbgauss.h:19
int rows
Definition: tgbgauss.h:21
int tgb_matrix::get_columns ( )

Definition at line 535 of file tgbgauss.cc.

536 {
537  return columns;
538 }
int columns
Definition: tgbgauss.h:20
int tgb_matrix::get_rows ( )

Definition at line 530 of file tgbgauss.cc.

531 {
532  return rows;
533 }
int rows
Definition: tgbgauss.h:21
BOOLEAN tgb_matrix::is_zero_entry ( int  i,
int  j 
)

Definition at line 547 of file tgbgauss.cc.

548 {
549  return (nIsZero(n[i][j]));
550 }
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
number ** n
Definition: tgbgauss.h:19
#define nIsZero(n)
Definition: numbers.h:19
int tgb_matrix::min_col_not_zero_in_row ( int  row)

Definition at line 560 of file tgbgauss.cc.

561 {
562  int i;
563  for(i=0;i<columns;i++)
564  {
565  if(!(nIsZero(n[row][i])))
566  return i;
567  }
568  return columns;//error code
569 }
int columns
Definition: tgbgauss.h:20
int i
Definition: cfEzgcd.cc:123
number ** n
Definition: tgbgauss.h:19
#define nIsZero(n)
Definition: numbers.h:19
void tgb_matrix::mult_row ( int  row,
number  factor 
)

Definition at line 622 of file tgbgauss.cc.

623 {
624  if (nIsOne(factor))
625  return;
626  int i;
627  for(i=0;i<columns;i++)
628  {
629  if(!(nIsZero(n[row][i])))
630  {
631  number n1=n[row][i];
632  n[row][i]=nMult(n1,factor);
633  nDelete(&n1);
634  }
635  }
636 }
int columns
Definition: tgbgauss.h:20
#define nIsOne(n)
Definition: numbers.h:25
#define nMult(n1, n2)
Definition: numbers.h:17
int i
Definition: cfEzgcd.cc:123
CanonicalForm factor
Definition: facAbsFact.cc:101
#define nDelete(n)
Definition: numbers.h:16
number ** n
Definition: tgbgauss.h:19
#define nIsZero(n)
Definition: numbers.h:19
int tgb_matrix::next_col_not_zero ( int  row,
int  pre 
)

Definition at line 571 of file tgbgauss.cc.

572 {
573  int i;
574  for(i=pre+1;i<columns;i++)
575  {
576  if(!(nIsZero(n[row][i])))
577  return i;
578  }
579  return columns;//error code
580 }
int columns
Definition: tgbgauss.h:20
int i
Definition: cfEzgcd.cc:123
number ** n
Definition: tgbgauss.h:19
#define nIsZero(n)
Definition: numbers.h:19
int tgb_matrix::non_zero_entries ( int  row)

Definition at line 593 of file tgbgauss.cc.

594 {
595  int i;
596  int z=0;
597  for(i=0;i<columns;i++)
598  {
599  if(!(nIsZero(n[row][i])))
600  z++;
601  }
602  return z;
603 }
int columns
Definition: tgbgauss.h:20
int i
Definition: cfEzgcd.cc:123
number ** n
Definition: tgbgauss.h:19
#define nIsZero(n)
Definition: numbers.h:19
void tgb_matrix::perm_rows ( int  i,
int  j 
)

Definition at line 552 of file tgbgauss.cc.

553 {
554  number* h;
555  h=n[i];
556  n[i]=n[j];
557  n[j]=h;
558 }
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
number ** n
Definition: tgbgauss.h:19
static Poly * h
Definition: janet.cc:978
void tgb_matrix::print ( )

Definition at line 501 of file tgbgauss.cc.

502 {
503  int i;
504  int j;
505  PrintLn();
506  for(i=0;i<rows;i++)
507  {
508  PrintS("(");
509  for(j=0;j<columns;j++)
510  {
511  StringSetS("");
512  n_Write(n[i][j],currRing);
513  char *s=StringEndS();
514  PrintS(s);
515  omFree(s);
516  PrintS("\t");
517  }
518  PrintS(")\n");
519  }
520 }
int columns
Definition: tgbgauss.h:20
const CanonicalForm int s
Definition: facAbsFact.cc:55
void PrintLn()
Definition: reporter.cc:322
char * StringEndS()
Definition: reporter.cc:151
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int j
Definition: myNF.cc:70
#define omFree(addr)
Definition: omAllocDecl.h:261
void StringSetS(const char *st)
Definition: reporter.cc:128
static FORCE_INLINE void n_Write(number &n, const coeffs r, const BOOLEAN bShortOut=TRUE)
Definition: coeffs.h:592
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
number ** n
Definition: tgbgauss.h:19
int rows
Definition: tgbgauss.h:21
void tgb_matrix::set ( int  i,
int  j,
number  n 
)

Definition at line 523 of file tgbgauss.cc.

524 {
525  assume(i<rows);
526  assume(j<columns);
527  n[i][j]=nn;
528 }
int columns
Definition: tgbgauss.h:20
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
int i
Definition: cfEzgcd.cc:123
number ** n
Definition: tgbgauss.h:19
int rows
Definition: tgbgauss.h:21
BOOLEAN tgb_matrix::zero_row ( int  row)

Definition at line 582 of file tgbgauss.cc.

583 {
584  int i;
585  for(i=0;i<columns;i++)
586  {
587  if(!(nIsZero(n[row][i])))
588  return FALSE;
589  }
590  return TRUE;
591 }
int columns
Definition: tgbgauss.h:20
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
int i
Definition: cfEzgcd.cc:123
number ** n
Definition: tgbgauss.h:19
#define nIsZero(n)
Definition: numbers.h:19

Field Documentation

int tgb_matrix::columns
private

Definition at line 20 of file tgbgauss.h.

BOOLEAN tgb_matrix::free_numbers
private

Definition at line 22 of file tgbgauss.h.

number** tgb_matrix::n
private

Definition at line 19 of file tgbgauss.h.

int tgb_matrix::rows
private

Definition at line 21 of file tgbgauss.h.


The documentation for this class was generated from the following files: