Data Structures | Macros | Functions
int64vec.h File Reference
#include <string.h>
#include <omalloc/omalloc.h>
#include <misc/auxiliary.h>
#include <misc/intvec.h>

Go to the source code of this file.

Data Structures

class  int64vec
 

Macros

#define iv64Test(v)   do {} while (0)
 

Functions

int64veciv64Copy (int64vec *o)
 
int64veciv64Add (int64vec *a, int64vec *b)
 
int64veciv64Sub (int64vec *a, int64vec *b)
 

Macro Definition Documentation

#define iv64Test (   v)    do {} while (0)

Definition at line 87 of file int64vec.h.

Function Documentation

int64vec* iv64Add ( int64vec a,
int64vec b 
)

Definition at line 173 of file int64vec.cc.

174 {
175  int64vec * iv;
176  int64 mn, ma, i;
177  if (a->cols() != b->cols()) return NULL;
178  mn = si_min(a->rows(),b->rows());
179  ma = si_max(a->rows(),b->rows());
180  if (a->cols() == 1)
181  {
182  iv = new int64vec(ma);
183  for (i=0; i<mn; i++) (*iv)[i] = (*a)[i] + (*b)[i];
184  if (ma > mn)
185  {
186  if (ma == a->rows())
187  {
188  for(i=mn; i<ma; i++) (*iv)[i] = (*a)[i];
189  }
190  else
191  {
192  for(i=mn; i<ma; i++) (*iv)[i] = (*b)[i];
193  }
194  }
195  return iv;
196  }
197  if (mn != ma) return NULL;
198  iv = new int64vec(a);
199  for (i=0; i<mn*a->cols(); i++) { (*iv)[i] += (*b)[i]; }
200  return iv;
201 }
static int si_min(const int a, const int b)
Definition: auxiliary.h:167
long int64
Definition: auxiliary.h:112
int rows() const
Definition: int64vec.h:57
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: int64vec.h:56
#define NULL
Definition: omList.c:10
int64vec* iv64Copy ( int64vec o)
inline

Definition at line 75 of file int64vec.h.

76 {
77  int64vec * iv=new int64vec(o);
78  return iv;
79 }
int64vec* iv64Sub ( int64vec a,
int64vec b 
)

Definition at line 203 of file int64vec.cc.

204 {
205  int64vec * iv;
206  int mn, ma,i;
207  if (a->cols() != b->cols()) return NULL;
208  mn = si_min(a->rows(),b->rows());
209  ma = si_max(a->rows(),b->rows());
210  if (a->cols() == 1)
211  {
212  iv = new int64vec(ma);
213  for (i=0; i<mn; i++) (*iv)[i] = (*a)[i] - (*b)[i];
214  if (ma > mn)
215  {
216  if (ma == a->rows())
217  {
218  for(i=mn; i<ma; i++) (*iv)[i] = (*a)[i];
219  }
220  else
221  {
222  for(i=mn; i<ma; i++) (*iv)[i] = -(*b)[i];
223  }
224  }
225  return iv;
226  }
227  if (mn != ma) return NULL;
228  iv = new int64vec(a);
229  for (i=0; i<mn*a->cols(); i++) { (*iv)[i] -= (*b)[i]; }
230  return iv;
231 }
static int si_min(const int a, const int b)
Definition: auxiliary.h:167
int rows() const
Definition: int64vec.h:57
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: int64vec.h:56
#define NULL
Definition: omList.c:10