My Project
Loading...
Searching...
No Matches
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 18 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.

460{
461 n=(number**) omAlloc(i*sizeof (number*));;
462 int z;
463 int z2;
464 for(z=0;z<i;z++)
465 {
466 n[z]=(number*)omAlloc(j*sizeof(number));
467 for(z2=0;z2<j;z2++)
468 {
469 n[z][z2]=nInit(0);
470 }
471 }
472 columns=j;
473 rows=i;
475}
#define FALSE
Definition: auxiliary.h:96
int i
Definition: cfEzgcd.cc:132
int rows
Definition: tgbgauss.h:23
number ** n
Definition: tgbgauss.h:21
BOOLEAN free_numbers
Definition: tgbgauss.h:24
int columns
Definition: tgbgauss.h:22
int j
Definition: facHensel.cc:110
#define nInit(i)
Definition: numbers.h:24
#define omAlloc(size)
Definition: omAllocDecl.h:210

◆ ~tgb_matrix()

tgb_matrix::~tgb_matrix ( )

Definition at line 477 of file tgbgauss.cc.

478{
479 int z;
480 for(z=0;z<rows;z++)
481 {
482 if(n[z])
483 {
484 if(free_numbers)
485 {
486 int z2;
487 for(z2=0;z2<columns;z2++)
488 {
489 nDelete(&(n[z][z2]));
490 }
491 }
492 omFree(n[z]);
493 }
494 }
495 omfree(n);
496}
#define nDelete(n)
Definition: numbers.h:16
#define omfree(addr)
Definition: omAllocDecl.h:237
#define omFree(addr)
Definition: omAllocDecl.h:261

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.

604{
605 int i;
606 for(i=0;i<columns;i++)
607 {
608 if(!(nIsZero(n[summand][i])))
609 {
610 number n1=n[add_to][i];
611 number n2=nMult(factor,n[summand][i]);
612 n[add_to][i]=nAdd(n1,n2);
613 nDelete(&n1);
614 nDelete(&n2);
615 }
616 }
617}
CanonicalForm factor
Definition: facAbsFact.cc:97
#define nIsZero(n)
Definition: numbers.h:19
#define nAdd(n1, n2)
Definition: numbers.h:18
#define nMult(n1, n2)
Definition: numbers.h:17

◆ free_row()

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

Definition at line 635 of file tgbgauss.cc.

636{
637 int i;
638 for(i=0;i<columns;i++)
639 if((free_non_zeros)||(!(nIsZero(n[row][i]))))
640 nDelete(&(n[row][i]));
641 omFree(n[row]);
642 n[row]=NULL;
643}
#define NULL
Definition: omList.c:12

◆ get()

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

Definition at line 537 of file tgbgauss.cc.

538{
539 assume(i<rows);
541 return n[i][j];
542}
#define assume(x)
Definition: mod2.h:389

◆ get_columns()

int tgb_matrix::get_columns ( )

Definition at line 532 of file tgbgauss.cc.

533{
534 return columns;
535}

◆ get_rows()

int tgb_matrix::get_rows ( )

Definition at line 527 of file tgbgauss.cc.

528{
529 return rows;
530}

◆ is_zero_entry()

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

Definition at line 544 of file tgbgauss.cc.

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

◆ 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.

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

◆ mult_row()

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

Definition at line 619 of file tgbgauss.cc.

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

◆ next_col_not_zero()

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

Definition at line 568 of file tgbgauss.cc.

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

◆ non_zero_entries()

int tgb_matrix::non_zero_entries ( int  row)

Definition at line 590 of file tgbgauss.cc.

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

◆ perm_rows()

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

Definition at line 549 of file tgbgauss.cc.

550{
551 number* h;
552 h=n[i];
553 n[i]=n[j];
554 n[j]=h;
555}
STATIC_VAR Poly * h
Definition: janet.cc:971

◆ print()

void tgb_matrix::print ( )

Definition at line 498 of file tgbgauss.cc.

499{
500 int i;
501 int j;
502 PrintLn();
503 for(i=0;i<rows;i++)
504 {
505 PrintS("(");
506 for(j=0;j<columns;j++)
507 {
508 StringSetS("");
509 n_Write(n[i][j],currRing->cf);
510 char *s=StringEndS();
511 PrintS(s);
512 omFree(s);
513 PrintS("\t");
514 }
515 PrintS(")\n");
516 }
517}
static FORCE_INLINE void n_Write(number n, const coeffs r, const BOOLEAN bShortOut=TRUE)
Definition: coeffs.h:588
const CanonicalForm int s
Definition: facAbsFact.cc:51
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
void StringSetS(const char *st)
Definition: reporter.cc:128
void PrintS(const char *s)
Definition: reporter.cc:284
char * StringEndS()
Definition: reporter.cc:151
void PrintLn()
Definition: reporter.cc:310

◆ set()

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

Definition at line 520 of file tgbgauss.cc.

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

◆ zero_row()

BOOLEAN tgb_matrix::zero_row ( int  row)

Definition at line 579 of file tgbgauss.cc.

580{
581 int i;
582 for(i=0;i<columns;i++)
583 {
584 if(!(nIsZero(n[row][i])))
585 return FALSE;
586 }
587 return TRUE;
588}
#define TRUE
Definition: auxiliary.h:100

Field Documentation

◆ columns

int tgb_matrix::columns
private

Definition at line 22 of file tgbgauss.h.

◆ free_numbers

BOOLEAN tgb_matrix::free_numbers
private

Definition at line 24 of file tgbgauss.h.

◆ n

number** tgb_matrix::n
private

Definition at line 21 of file tgbgauss.h.

◆ rows

int tgb_matrix::rows
private

Definition at line 23 of file tgbgauss.h.


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