My Project  debian-1:4.1.2-p1+ds-2
Functions
int64vec.cc File Reference
#include "misc/auxiliary.h"
#include "misc/int64vec.h"
#include "misc/intvec.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 171 of file int64vec.cc.

173 {
174  int64vec * iv;
175  int64 mn, ma, i;
176  if (a->cols() != b->cols()) return NULL;
177  mn = si_min(a->rows(),b->rows());
178  ma = si_max(a->rows(),b->rows());
179  if (a->cols() == 1)
180  {
181  iv = new int64vec(ma);
182  for (i=0; i<mn; i++) (*iv)[i] = (*a)[i] + (*b)[i];
183  if (ma > mn)
184  {
185  if (ma == a->rows())
186  {
187  for(i=mn; i<ma; i++) (*iv)[i] = (*a)[i];
188  }
189  else
190  {
191  for(i=mn; i<ma; i++) (*iv)[i] = (*b)[i];
192  }
193  }
194  return iv;
195  }
196  if (mn != ma) return NULL;
197  iv = new int64vec(a);
198  for (i=0; i<mn*a->cols(); i++) { (*iv)[i] += (*b)[i]; }
199  return iv;

◆ iv64Sub()

int64vec* iv64Sub ( int64vec a,
int64vec b 
)

Definition at line 201 of file int64vec.cc.

203 {
204  int64vec * iv;
205  int mn, ma,i;
206  if (a->cols() != b->cols()) return NULL;
207  mn = si_min(a->rows(),b->rows());
208  ma = si_max(a->rows(),b->rows());
209  if (a->cols() == 1)
210  {
211  iv = new int64vec(ma);
212  for (i=0; i<mn; i++) (*iv)[i] = (*a)[i] - (*b)[i];
213  if (ma > mn)
214  {
215  if (ma == a->rows())
216  {
217  for(i=mn; i<ma; i++) (*iv)[i] = (*a)[i];
218  }
219  else
220  {
221  for(i=mn; i<ma; i++) (*iv)[i] = -(*b)[i];
222  }
223  }
224  return iv;
225  }
226  if (mn != ma) return NULL;
227  iv = new int64vec(a);
228  for (i=0; i<mn*a->cols(); i++) { (*iv)[i] -= (*b)[i]; }
229  return iv;
si_min
static int si_min(const int a, const int b)
Definition: auxiliary.h:141
b
CanonicalForm b
Definition: cfModGcd.cc:4044
int64vec::rows
int rows() const
Definition: int64vec.h:66
i
int i
Definition: cfEzgcd.cc:125
int64vec
Definition: int64vec.h:19
si_max
static int si_max(const int a, const int b)
Definition: auxiliary.h:140
int64
long int64
Definition: auxiliary.h:68
int64vec::cols
int cols() const
Definition: int64vec.h:65
NULL
#define NULL
Definition: omList.c:11