source: git/kernel/int64vec.h @ 9e8da7

spielwiese
Last change on this file since 9e8da7 was b1dfaf, checked in by Frank Seelisch <seelisch@…>, 14 years ago
patch from Kai (checked for problems under Windows OS: no problems) git-svn-id: file:///usr/local/Singular/svn/trunk@13210 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • 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 <kernel/structs.h>
12#include <omalloc/omalloc.h>
13#include <kernel/febase.h>
14#include <kernel/intvec.h>
15
16class int64vec
17{
18private:
19  int64 *v;
20  int row;
21  int col;
22public:
23
24  int64vec(int l = 1)
25    {
26      v = (int64 *)omAlloc0(sizeof(int64)*l);
27      row = l;
28      col = 1;
29    }
30  int64vec(int r, int c, int64 init);
31  int64vec(int64vec* iv);
32  int64vec(intvec* iv);
33  int64& operator[](int i)
34    {
35#ifndef NDEBUG
36      if((i<0)||(i>=row*col))
37      {
38        Werror("wrong int64vec index:%d\n",i);
39      }
40#endif
41      return v[i];
42    }
43  inline const int64& operator[](int i) const
44    {
45#ifndef NDEBUG
46      if((i<0)||(i>=row*col))
47      {
48        Werror("wrong int64vec index:%d\n",i);
49      }
50#endif
51      return v[i];
52    }
53  void operator*=(int64 intop);
54  void operator/=(int64 intop);
55  // -2: not compatible, -1: <, 0:=, 1: >
56  int compare(const int64vec* o) const;
57  int  length() const { return col*row; }
58  int  cols() const { return col; }
59  int  rows() const { return row; }
60  void show(int mat=0,int spaces=0);
61  char * String(int dim = 2);
62  char * iv64String(int not_mat=1,int mat=0,int spaces=0, int dim=2);
63  int64 * iv64GetVec() { return v; }
64  ~int64vec()
65    {
66      if (v!=NULL)
67      {
68        omFreeSize((ADDRESS)v,sizeof(int64)*row*col);
69        v=NULL;
70      }
71    }
72  void iv64TEST()
73    {
74      omCheckAddrSize((ADDRESS)v,sizeof(int64)*row*col);
75    }
76};
77inline int64vec * iv64Copy(int64vec * o)
78{
79  int64vec * iv=new int64vec(o);
80  return iv;
81};
82
83int64vec * iv64Add(int64vec * a, int64vec * b);
84int64vec * iv64Sub(int64vec * a, int64vec * b);
85
86#ifdef MDEBUG
87#define iv64Test(v) v->iv64TEST()
88#else
89#define iv64Test(v)   ((void)0)
90#endif
91
92#endif
93
94
95
96
97
98
99
100
101
102
103
Note: See TracBrowser for help on using the repository browser.