source: git/libpolys/misc/int64vec.h @ 1745e5

spielwiese
Last change on this file since 1745e5 was 1745e5, checked in by Hans Schoenemann <hannes@…>, 13 years ago
int64.* ->misc, rCopy0AndAddA ->ring.h, fix walkSupport.cc
  • Property mode set to 100644
File size: 1.9 KB
Line 
1#ifndef INT64VEC_H
2#define INT64VEC_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id$ */
7/*
8* ABSTRACT: class intvec: lists/vectors of int64
9*/
10#include <string.h>
11#include <omalloc/omalloc.h>
12#include <misc/auxiliary.h>
13#include <misc/intvec.h>
14
15class int64vec
16{
17private:
18  int64 *v;
19  int row;
20  int col;
21public:
22
23  int64vec(int l = 1)
24    {
25      v = (int64 *)omAlloc0(sizeof(int64)*l);
26      row = l;
27      col = 1;
28    }
29  int64vec(int r, int c, int64 init);
30  int64vec(int64vec* iv);
31  int64vec(intvec* iv);
32  int64& operator[](int i)
33    {
34#ifndef NDEBUG
35      if((i<0)||(i>=row*col))
36      {
37        Werror("wrong int64vec index:%d\n",i);
38      }
39#endif
40      return v[i];
41    }
42  inline const int64& operator[](int i) const
43    {
44#ifndef NDEBUG
45      if((i<0)||(i>=row*col))
46      {
47        Werror("wrong int64vec index:%d\n",i);
48      }
49#endif
50      return v[i];
51    }
52  void operator*=(int64 intop);
53  void operator/=(int64 intop);
54  // -2: not compatible, -1: <, 0:=, 1: >
55  int compare(const int64vec* o) const;
56  int  length() const { return col*row; }
57  int  cols() const { return col; }
58  int  rows() const { return row; }
59  void show(int mat=0,int spaces=0);
60  char * String(int dim = 2);
61  char * iv64String(int not_mat=1,int mat=0,int spaces=0, int dim=2);
62  int64 * iv64GetVec() { return v; }
63  ~int64vec()
64    {
65      if (v!=NULL)
66      {
67        omFreeSize((ADDRESS)v,sizeof(int64)*row*col);
68        v=NULL;
69      }
70    }
71  void iv64TEST()
72    {
73      omCheckAddrSize((ADDRESS)v,sizeof(int64)*row*col);
74    }
75};
76inline int64vec * iv64Copy(int64vec * o)
77{
78  int64vec * iv=new int64vec(o);
79  return iv;
80}
81
82int64vec * iv64Add(int64vec * a, int64vec * b);
83int64vec * iv64Sub(int64vec * a, int64vec * b);
84
85#ifdef MDEBUG
86#define iv64Test(v) v->iv64TEST()
87#else
88#define iv64Test(v)   ((void)0)
89#endif
90
91#endif
92
93
94
95
96
97
98
99
100
101
102
Note: See TracBrowser for help on using the repository browser.