My Project
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 20 of file int64vec.h.

Constructor & Destructor Documentation

◆ int64vec() [1/4]

int64vec::int64vec ( int  l = 1)
inline

Definition at line 31 of file int64vec.h.

32 {
33 v = (int64 *)omAlloc0(sizeof(int64)*l);
34 row = l;
35 col = 1;
36 }
long int64
Definition: auxiliary.h:68
int l
Definition: cfEzgcd.cc:100
int col
Definition: int64vec.h:28
int64 * v
Definition: int64vec.h:26
int row
Definition: int64vec.h:27
#define omAlloc0(size)
Definition: omAllocDecl.h:211

◆ int64vec() [2/4]

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

Definition at line 41 of file int64vec.cc.

42{
43 row = r;
44 col = c;
45 int l = r*c;
46 if ((r>0) && (c>0))
47 v = (int64 *)omAlloc(sizeof(int64)*l);
48 else
49 v = NULL;
50 for (int i=0; i<l; i++)
51 {
52 v[i] = init;
53 }
54}
int i
Definition: cfEzgcd.cc:132
void init()
Definition: lintree.cc:864
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define NULL
Definition: omList.c:12

◆ int64vec() [3/4]

int64vec::int64vec ( int64vec iv)

Definition at line 19 of file int64vec.cc.

20{
21 row = iv->rows();
22 col = iv->cols();
23 v = (int64 *)omAlloc(sizeof(int64)*row*col);
24 for (int i=0; i<row*col; i++)
25 {
26 v[i] = (*iv)[i];
27 }
28}
int rows() const
Definition: int64vec.h:66
int cols() const
Definition: int64vec.h:65

◆ int64vec() [4/4]

int64vec::int64vec ( intvec iv)

Definition at line 30 of file int64vec.cc.

31{
32 row = iv->rows();
33 col = iv->cols();
34 v = (int64 *)omAlloc(sizeof(int64)*row*col);
35 for (int i=0; i<row*col; i++)
36 {
37 v[i] = (int64)((*iv)[i]);
38 }
39}
int cols() const
Definition: intvec.h:95
int rows() const
Definition: intvec.h:96

◆ ~int64vec()

int64vec::~int64vec ( )
inline

Definition at line 71 of file int64vec.h.

72 {
73 if (v!=NULL)
74 {
75 omFreeSize((ADDRESS)v,sizeof(int64)*row*col);
76 v=NULL;
77 }
78 }
void * ADDRESS
Definition: auxiliary.h:119
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260

Member Function Documentation

◆ cols()

int int64vec::cols ( ) const
inline

Definition at line 65 of file int64vec.h.

65{ return col; }

◆ compare()

int int64vec::compare ( const int64vec o) const

Definition at line 138 of file int64vec.cc.

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

◆ iv64GetVec()

int64 * int64vec::iv64GetVec ( )
inline

Definition at line 70 of file int64vec.h.

70{ return v; }

◆ iv64String()

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

Definition at line 56 of file int64vec.cc.

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

◆ iv64TEST()

void int64vec::iv64TEST ( )
inline

Definition at line 79 of file int64vec.h.

80 {
82 }
#define omCheckAddrSize(addr, size)
Definition: omAllocDecl.h:327

◆ length()

int int64vec::length ( ) const
inline

Definition at line 64 of file int64vec.h.

64{ return col*row; }

◆ operator*=()

void int64vec::operator*= ( int64  intop)

Definition at line 119 of file int64vec.cc.

120{
121 for (int i=row*col-1; i>=0; i--) { v[i] *= intop; }
122}

◆ operator/=()

void int64vec::operator/= ( int64  intop)

Definition at line 124 of file int64vec.cc.

125{
126 if (intop == 0) return;
127 int64 bb=ABS(intop);
128 for (int i=row*col-1; i>=0; i--)
129 {
130 int64 r=v[i];
131 int64 c=r%bb;
132 if (c<0) c+=bb;
133 r=(r-c)/intop;
134 v[i]=r;
135 }
136}
static int ABS(int v)
Definition: auxiliary.h:112

◆ operator[]() [1/2]

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

Definition at line 40 of file int64vec.h.

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

◆ operator[]() [2/2]

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

Definition at line 50 of file int64vec.h.

51 {
52#ifndef SING_NDEBUG
53 if((i<0)||(i>=row*col))
54 {
55 Werror("wrong int64vec index:%d\n",i);
56 }
57#endif
58 return v[i];
59 }

◆ rows()

int int64vec::rows ( ) const
inline

Definition at line 66 of file int64vec.h.

66{ return row; }

◆ show()

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

Definition at line 104 of file int64vec.cc.

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

◆ String()

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

Definition at line 99 of file int64vec.cc.

100{
101 return iv64String(0, 0, dim);
102}

Field Documentation

◆ col

int int64vec::col
private

Definition at line 28 of file int64vec.h.

◆ row

int int64vec::row
private

Definition at line 27 of file int64vec.h.

◆ v

int64* int64vec::v
private

Definition at line 26 of file int64vec.h.


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