source: git/kernel/int64vec.h @ 76cfef

spielwiese
Last change on this file since 76cfef was 210e07, checked in by Oleksandr Motsak <motsak@…>, 13 years ago
ADD: testing headers with "make test.o" FIX: cleaning up headers in kernel: TODO: kutil.h?! FIX: febase.h -> old.febase.h (remove later on) ADD: dummy headers instead of some splited or moved: febase.h, modulop.h (for later fixing) FIX: renamed various obsolette files into "old.*"
  • 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 <misc/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.