My Project  debian-1:4.1.1-p2+ds-4
Functions
int64vec.cc File Reference
#include "misc/auxiliary.h"
#include "misc/int64vec.h"
#include "misc/intvec.h"
#include "omalloc/omalloc.h"

Go to the source code of this file.

Functions

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

Function Documentation

◆ iv64Add()

int64vec* iv64Add ( int64vec a,
int64vec b 
)

Definition at line 172 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;

◆ iv64Sub()

int64vec* iv64Sub ( int64vec a,
int64vec b 
)

Definition at line 202 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;
si_min
static int si_min(const int a, const int b)
Definition: auxiliary.h:139
b
CanonicalForm b
Definition: cfModGcd.cc:4044
int64vec::rows
int rows() const
Definition: int64vec.h:63
i
int i
Definition: cfEzgcd.cc:125
int64vec
Definition: int64vec.h:16
si_max
static int si_max(const int a, const int b)
Definition: auxiliary.h:138
int64
long int64
Definition: auxiliary.h:66
int64vec::cols
int cols() const
Definition: int64vec.h:62
NULL
#define NULL
Definition: omList.c:9