My Project  debian-1:4.1.1-p2+ds-4build1
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::tgb_matrix ( int  i,
int  j 
)

Definition at line 459 of file tgbgauss.cc.

461 {
462  n=(number**) omAlloc(i*sizeof (number*));;
463  int z;
464  int z2;
465  for(z=0;z<i;z++)
466  {
467  n[z]=(number*)omAlloc(j*sizeof(number));
468  for(z2=0;z2<j;z2++)
469  {
470  n[z][z2]=nInit(0);
471  }
472  }
473  columns=j;
474  rows=i;

◆ ~tgb_matrix()

tgb_matrix::~tgb_matrix ( )

Definition at line 477 of file tgbgauss.cc.

479 {
480  int z;
481  for(z=0;z<rows;z++)
482  {
483  if(n[z])
484  {
485  if(free_numbers)
486  {
487  int z2;
488  for(z2=0;z2<columns;z2++)
489  {
490  nDelete(&(n[z][z2]));
491  }
492  }
493  omFree(n[z]);
494  }
495  }
496  omfree(n);

Member Function Documentation

◆ add_lambda_times_row()

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

Definition at line 603 of file tgbgauss.cc.

605 {
606  int i;
607  for(i=0;i<columns;i++)
608  {
609  if(!(nIsZero(n[summand][i])))
610  {
611  number n1=n[add_to][i];
612  number n2=nMult(factor,n[summand][i]);
613  n[add_to][i]=nAdd(n1,n2);
614  nDelete(&n1);
615  nDelete(&n2);
616  }
617  }

◆ free_row()

void tgb_matrix::free_row ( int  row,
BOOLEAN  free_non_zeros = TRUE 
)

Definition at line 635 of file tgbgauss.cc.

637 {
638  int i;
639  for(i=0;i<columns;i++)
640  if((free_non_zeros)||(!(nIsZero(n[row][i]))))
641  nDelete(&(n[row][i]));
642  omFree(n[row]);
643  n[row]=NULL;

◆ get()

number tgb_matrix::get ( int  i,
int  j 
)

Definition at line 537 of file tgbgauss.cc.

539 {
540  assume(i<rows);
541  assume(j<columns);
542  return n[i][j];

◆ get_columns()

int tgb_matrix::get_columns ( )

Definition at line 532 of file tgbgauss.cc.

534 {
535  return columns;

◆ get_rows()

int tgb_matrix::get_rows ( )

Definition at line 527 of file tgbgauss.cc.

529 {
530  return rows;

◆ is_zero_entry()

BOOLEAN tgb_matrix::is_zero_entry ( int  i,
int  j 
)

Definition at line 544 of file tgbgauss.cc.

546 {
547  return (nIsZero(n[i][j]));

◆ min_col_not_zero_in_row()

int tgb_matrix::min_col_not_zero_in_row ( int  row)

Definition at line 557 of file tgbgauss.cc.

559 {
560  int i;
561  for(i=0;i<columns;i++)
562  {
563  if(!(nIsZero(n[row][i])))
564  return i;
565  }
566  return columns;//error code

◆ mult_row()

void tgb_matrix::mult_row ( int  row,
number  factor 
)

Definition at line 619 of file tgbgauss.cc.

621 {
622  if (nIsOne(factor))
623  return;
624  int i;
625  for(i=0;i<columns;i++)
626  {
627  if(!(nIsZero(n[row][i])))
628  {
629  number n1=n[row][i];
630  n[row][i]=nMult(n1,factor);
631  nDelete(&n1);
632  }
633  }

◆ next_col_not_zero()

int tgb_matrix::next_col_not_zero ( int  row,
int  pre 
)

Definition at line 568 of file tgbgauss.cc.

570 {
571  int i;
572  for(i=pre+1;i<columns;i++)
573  {
574  if(!(nIsZero(n[row][i])))
575  return i;
576  }
577  return columns;//error code

◆ non_zero_entries()

int tgb_matrix::non_zero_entries ( int  row)

Definition at line 590 of file tgbgauss.cc.

592 {
593  int i;
594  int z=0;
595  for(i=0;i<columns;i++)
596  {
597  if(!(nIsZero(n[row][i])))
598  z++;
599  }
600  return z;

◆ perm_rows()

void tgb_matrix::perm_rows ( int  i,
int  j 
)

Definition at line 549 of file tgbgauss.cc.

551 {
552  number* h;
553  h=n[i];
554  n[i]=n[j];
555  n[j]=h;

◆ print()

void tgb_matrix::print ( )

Definition at line 498 of file tgbgauss.cc.

500 {
501  int i;
502  int j;
503  PrintLn();
504  for(i=0;i<rows;i++)
505  {
506  PrintS("(");
507  for(j=0;j<columns;j++)
508  {
509  StringSetS("");
510  n_Write(n[i][j],currRing->cf);
511  char *s=StringEndS();
512  PrintS(s);
513  omFree(s);
514  PrintS("\t");
515  }
516  PrintS(")\n");
517  }

◆ set()

void tgb_matrix::set ( int  i,
int  j,
number  n 
)

Definition at line 520 of file tgbgauss.cc.

522 {
523  assume(i<rows);
524  assume(j<columns);
525  n[i][j]=nn;

◆ zero_row()

BOOLEAN tgb_matrix::zero_row ( int  row)

Definition at line 579 of file tgbgauss.cc.

581 {
582  int i;
583  for(i=0;i<columns;i++)
584  {
585  if(!(nIsZero(n[row][i])))
586  return FALSE;
587  }
588  return TRUE;

Field Documentation

◆ columns

int tgb_matrix::columns
private

Definition at line 21 of file tgbgauss.h.

◆ free_numbers

BOOLEAN tgb_matrix::free_numbers
private

Definition at line 23 of file tgbgauss.h.

◆ n

number** tgb_matrix::n
private

Definition at line 20 of file tgbgauss.h.

◆ rows

int tgb_matrix::rows
private

Definition at line 22 of file tgbgauss.h.


The documentation for this class was generated from the following files:
FALSE
#define FALSE
Definition: auxiliary.h:94
j
int j
Definition: facHensel.cc:105
omFree
#define omFree(addr)
Definition: omAllocDecl.h:259
nAdd
#define nAdd(n1, n2)
Definition: numbers.h:18
StringEndS
char * StringEndS()
Definition: reporter.cc:150
currRing
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
TRUE
#define TRUE
Definition: auxiliary.h:98
i
int i
Definition: cfEzgcd.cc:125
nIsOne
#define nIsOne(n)
Definition: numbers.h:25
n_Write
static FORCE_INLINE void n_Write(number n, const coeffs r, const BOOLEAN bShortOut=TRUE)
Definition: coeffs.h:591
PrintS
void PrintS(const char *s)
Definition: reporter.cc:283
h
static Poly * h
Definition: janet.cc:972
omAlloc
#define omAlloc(size)
Definition: omAllocDecl.h:208
nIsZero
#define nIsZero(n)
Definition: numbers.h:19
nMult
#define nMult(n1, n2)
Definition: numbers.h:17
factor
CanonicalForm factor
Definition: facAbsFact.cc:101
tgb_matrix::n
number ** n
Definition: tgbgauss.h:20
StringSetS
void StringSetS(const char *st)
Definition: reporter.cc:127
tgb_matrix::free_numbers
BOOLEAN free_numbers
Definition: tgbgauss.h:23
assume
#define assume(x)
Definition: mod2.h:384
NULL
#define NULL
Definition: omList.c:9
nDelete
#define nDelete(n)
Definition: numbers.h:16
tgb_matrix::rows
int rows
Definition: tgbgauss.h:22
s
const CanonicalForm int s
Definition: facAbsFact.cc:55
nInit
#define nInit(i)
Definition: numbers.h:24
PrintLn
void PrintLn()
Definition: reporter.cc:309
tgb_matrix::columns
int columns
Definition: tgbgauss.h:21
omfree
#define omfree(addr)
Definition: omAllocDecl.h:235