Public Member Functions | Private Attributes
int64vec Class Reference

#include <int64vec.h>

Public Member Functions

 int64vec (int l=1)
 
 int64vec (int r, int c, int64 init)
 
 int64vec (int64vec *iv)
 
 int64vec (intvec *iv)
 
int64operator[] (int i)
 
const int64operator[] (int i) const
 
void operator*= (int64 intop)
 
void operator/= (int64 intop)
 
int compare (const int64vec *o) const
 
int length () const
 
int cols () const
 
int rows () const
 
void show (int mat=0, int spaces=0)
 
char * String (int dim=2)
 
char * iv64String (int not_mat=1, int mat=0, int spaces=0, int dim=2)
 
int64iv64GetVec ()
 
 ~int64vec ()
 
void iv64TEST ()
 
- Public Member Functions inherited from omallocClass
void * operator new (size_t size) throw (std::bad_alloc)
 
void operator delete (void *block) throw ()
 
void * operator new[] (size_t size) throw (std::bad_alloc)
 
void operator delete[] (void *block) throw ()
 
void * operator new (size_t size, const std::nothrow_t &) throw ()
 
void * operator new[] (size_t size, const std::nothrow_t &) throw ()
 

Private Attributes

int64v
 
int row
 
int col
 

Detailed Description

Definition at line 14 of file int64vec.h.

Constructor & Destructor Documentation

§ int64vec() [1/4]

int64vec::int64vec ( int  l = 1)
inline

Definition at line 22 of file int64vec.h.

23  {
24  v = (int64 *)omAlloc0(sizeof(int64)*l);
25  row = l;
26  col = 1;
27  }
long int64
Definition: auxiliary.h:67
int col
Definition: int64vec.h:19
int row
Definition: int64vec.h:18
#define omAlloc0(size)
Definition: omAllocDecl.h:211
int l
Definition: cfEzgcd.cc:94
int64 * v
Definition: int64vec.h:17

§ int64vec() [2/4]

int64vec::int64vec ( int  r,
int  c,
int64  init 
)

Definition at line 42 of file int64vec.cc.

43 {
44  row = r;
45  col = c;
46  int l = r*c;
47  if ((r>0) && (c>0))
48  v = (int64 *)omAlloc(sizeof(int64)*l);
49  else
50  v = NULL;
51  for (int i=0; i<l; i++)
52  {
53  v[i] = init;
54  }
55 }
long int64
Definition: auxiliary.h:67
int col
Definition: int64vec.h:19
#define omAlloc(size)
Definition: omAllocDecl.h:210
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
int row
Definition: int64vec.h:18
int l
Definition: cfEzgcd.cc:94
int64 * v
Definition: int64vec.h:17

§ int64vec() [3/4]

int64vec::int64vec ( int64vec iv)

Definition at line 20 of file int64vec.cc.

21 {
22  row = iv->rows();
23  col = iv->cols();
24  v = (int64 *)omAlloc(sizeof(int64)*row*col);
25  for (int i=0; i<row*col; i++)
26  {
27  v[i] = (*iv)[i];
28  }
29 }
int cols() const
Definition: int64vec.h:56
long int64
Definition: auxiliary.h:67
int col
Definition: int64vec.h:19
#define omAlloc(size)
Definition: omAllocDecl.h:210
int rows() const
Definition: int64vec.h:57
int i
Definition: cfEzgcd.cc:123
int row
Definition: int64vec.h:18
int64 * v
Definition: int64vec.h:17

§ int64vec() [4/4]

int64vec::int64vec ( intvec iv)

Definition at line 31 of file int64vec.cc.

32 {
33  row = iv->rows();
34  col = iv->cols();
35  v = (int64 *)omAlloc(sizeof(int64)*row*col);
36  for (int i=0; i<row*col; i++)
37  {
38  v[i] = (int64)((*iv)[i]);
39  }
40 }
int rows() const
Definition: intvec.h:88
long int64
Definition: auxiliary.h:67
int col
Definition: int64vec.h:19
#define omAlloc(size)
Definition: omAllocDecl.h:210
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: intvec.h:87
int row
Definition: int64vec.h:18
int64 * v
Definition: int64vec.h:17

§ ~int64vec()

int64vec::~int64vec ( )
inline

Definition at line 62 of file int64vec.h.

63  {
64  if (v!=NULL)
65  {
66  omFreeSize((ADDRESS)v,sizeof(int64)*row*col);
67  v=NULL;
68  }
69  }
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
long int64
Definition: auxiliary.h:67
int col
Definition: int64vec.h:19
void * ADDRESS
Definition: auxiliary.h:116
#define NULL
Definition: omList.c:10
int row
Definition: int64vec.h:18
int64 * v
Definition: int64vec.h:17

Member Function Documentation

§ cols()

int int64vec::cols ( ) const
inline

Definition at line 56 of file int64vec.h.

56 { return col; }
int col
Definition: int64vec.h:19

§ compare()

int int64vec::compare ( const int64vec o) const

Definition at line 139 of file int64vec.cc.

140 {
141  if ((col!=1) ||(op->cols()!=1))
142  {
143  if((col!=op->cols())
144  || (row!=op->rows()))
145  return -2;
146  }
147  int i;
148  for (i=0; i<si_min(length(),op->length()); i++)
149  {
150  if (v[i] > (*op)[i])
151  return 1;
152  if (v[i] < (*op)[i])
153  return -1;
154  }
155  // this can only happen for int64vec: (i.e. col==1)
156  for (; i<row; i++)
157  {
158  if (v[i] > 0)
159  return 1;
160  if (v[i] < 0)
161  return -1;
162  }
163  for (; i<op->rows(); i++)
164  {
165  if (0 > (*op)[i])
166  return 1;
167  if (0 < (*op)[i])
168  return -1;
169  }
170  return 0;
171 }
static int si_min(const int a, const int b)
Definition: auxiliary.h:122
int col
Definition: int64vec.h:19
int length() const
Definition: int64vec.h:55
int i
Definition: cfEzgcd.cc:123
int row
Definition: int64vec.h:18
int64 * v
Definition: int64vec.h:17

§ iv64GetVec()

int64* int64vec::iv64GetVec ( )
inline

Definition at line 61 of file int64vec.h.

61 { return v; }
int64 * v
Definition: int64vec.h:17

§ iv64String()

char * int64vec::iv64String ( int  not_mat = 1,
int  mat = 0,
int  spaces = 0,
int  dim = 2 
)

Definition at line 57 of file int64vec.cc.

58 {
59  StringSetS("");
60  if ((col == 1)&&(not_mat))
61  {
62  int i=0;
63  for (; i<row-1; i++)
64  {
65  StringAppend("%lld,",v[i]);
66  }
67  if (i<row)
68  {
69  StringAppend("%lld",v[i]);
70  }
71  }
72  else
73  {
74  for (int j=0; j<row; j++)
75  {
76  if (j<row-1)
77  {
78  for (int i=0; i<col; i++)
79  {
80  StringAppend("%lld%c",v[j*col+i],',');
81  }
82  }
83  else
84  {
85  for (int i=0; i<col; i++)
86  {
87  StringAppend("%lld%c",v[j*col+i],i<col-1 ? ',' : ' ');
88  }
89  }
90  if (j+1<row)
91  {
92  if (dim > 1) StringAppendS("\n");
93  if (spaces>0) StringAppend("%-*.*s",spaces,spaces," ");
94  }
95  }
96  }
97  return StringEndS();
98 }
int col
Definition: int64vec.h:19
char * StringEndS()
Definition: reporter.cc:151
int j
Definition: myNF.cc:70
void StringSetS(const char *st)
Definition: reporter.cc:128
void StringAppendS(const char *st)
Definition: reporter.cc:107
int dim(ideal I, ring r)
#define StringAppend
Definition: emacs.cc:82
int i
Definition: cfEzgcd.cc:123
int row
Definition: int64vec.h:18
int64 * v
Definition: int64vec.h:17

§ iv64TEST()

void int64vec::iv64TEST ( )
inline

Definition at line 70 of file int64vec.h.

71  {
73  }
#define omCheckAddrSize(addr, size)
Definition: omAllocDecl.h:327
long int64
Definition: auxiliary.h:67
int col
Definition: int64vec.h:19
void * ADDRESS
Definition: auxiliary.h:116
int row
Definition: int64vec.h:18
int64 * v
Definition: int64vec.h:17

§ length()

int int64vec::length ( ) const
inline

Definition at line 55 of file int64vec.h.

55 { return col*row; }
int col
Definition: int64vec.h:19
int row
Definition: int64vec.h:18

§ operator*=()

void int64vec::operator*= ( int64  intop)

Definition at line 120 of file int64vec.cc.

121 {
122  for (int i=row*col-1; i>=0; i--) { v[i] *= intop; }
123 }
int col
Definition: int64vec.h:19
int i
Definition: cfEzgcd.cc:123
int row
Definition: int64vec.h:18
int64 * v
Definition: int64vec.h:17

§ operator/=()

void int64vec::operator/= ( int64  intop)

Definition at line 125 of file int64vec.cc.

126 {
127  if (intop == 0) return;
128  int64 bb=ABS(intop);
129  for (int i=row*col-1; i>=0; i--)
130  {
131  int64 r=v[i];
132  int64 c=r%bb;
133  if (c<0) c+=bb;
134  r=(r-c)/intop;
135  v[i]=r;
136  }
137 }
long int64
Definition: auxiliary.h:67
int col
Definition: int64vec.h:19
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123
#define ABS(x)
Definition: auxiliary.h:112
int row
Definition: int64vec.h:18
int64 * v
Definition: int64vec.h:17

§ operator[]() [1/2]

int64& int64vec::operator[] ( int  i)
inline

Definition at line 31 of file int64vec.h.

32  {
33 #ifndef SING_NDEBUG
34  if((i<0)||(i>=row*col))
35  {
36  Werror("wrong int64vec index:%d\n",i);
37  }
38 #endif
39  return v[i];
40  }
int col
Definition: int64vec.h:19
int i
Definition: cfEzgcd.cc:123
int row
Definition: int64vec.h:18
void Werror(const char *fmt,...)
Definition: reporter.cc:189
int64 * v
Definition: int64vec.h:17

§ operator[]() [2/2]

const int64& int64vec::operator[] ( int  i) const
inline

Definition at line 41 of file int64vec.h.

42  {
43 #ifndef SING_NDEBUG
44  if((i<0)||(i>=row*col))
45  {
46  Werror("wrong int64vec index:%d\n",i);
47  }
48 #endif
49  return v[i];
50  }
int col
Definition: int64vec.h:19
int i
Definition: cfEzgcd.cc:123
int row
Definition: int64vec.h:18
void Werror(const char *fmt,...)
Definition: reporter.cc:189
int64 * v
Definition: int64vec.h:17

§ rows()

int int64vec::rows ( ) const
inline

Definition at line 57 of file int64vec.h.

57 { return row; }
int row
Definition: int64vec.h:18

§ show()

void int64vec::show ( int  mat = 0,
int  spaces = 0 
)

Definition at line 105 of file int64vec.cc.

106 {
107  char *s=iv64String(notmat,spaces);
108  if (spaces>0)
109  {
110  PrintNSpaces(spaces);
111  PrintS(s);
112  }
113  else
114  {
115  PrintS(s);
116  }
117  omFree(s);
118 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
char * iv64String(int not_mat=1, int mat=0, int spaces=0, int dim=2)
Definition: int64vec.cc:57
#define omFree(addr)
Definition: omAllocDecl.h:261
void PrintS(const char *s)
Definition: reporter.cc:284
void PrintNSpaces(const int n)
Definition: reporter.cc:364

§ String()

char * int64vec::String ( int  dim = 2)

Definition at line 100 of file int64vec.cc.

101 {
102  return iv64String(0, 0, dim);
103 }
char * iv64String(int not_mat=1, int mat=0, int spaces=0, int dim=2)
Definition: int64vec.cc:57
int dim(ideal I, ring r)

Field Documentation

§ col

int int64vec::col
private

Definition at line 19 of file int64vec.h.

§ row

int int64vec::row
private

Definition at line 18 of file int64vec.h.

§ v

int64* int64vec::v
private

Definition at line 17 of file int64vec.h.


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