source: git/kernel/int64vec.h @ 3ad53dd

spielwiese
Last change on this file since 3ad53dd was d14343a, checked in by Hans Schönemann <hannes@…>, 19 years ago
*hannes: code cleanup git-svn-id: file:///usr/local/Singular/svn/trunk@8110 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.7 KB
Line 
1#ifndef INT64VEC_H
2#define INT64VEC_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id: int64vec.h,v 1.3 2005-05-09 13:47:29 Singular Exp $ */
7/*
8* ABSTRACT: class intvec: lists/vectors of int64
9*/
10#include <string.h>
11#include "structs.h"
12#include "omalloc.h"
13#include "febase.h"
14#include "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  void operator*=(int64 intop);
44  void operator/=(int64 intop);
45  // -2: not compatible, -1: <, 0:=, 1: >
46  int compare(int64vec* o);
47  int  length() const { return col*row; }
48  int  cols() const { return col; }
49  int  rows() const { return row; }
50  void show(int mat=0,int spaces=0);
51  char * String(int dim = 2);
52  char * iv64String(int not_mat=1,int mat=0,int spaces=0, int dim=2);
53  int64 * iv64GetVec() { return v; }
54  ~int64vec()
55    {
56      if (v!=NULL)
57      {
58        omFreeSize((ADDRESS)v,sizeof(int64)*row*col);
59        v=NULL;
60      }
61    }
62  void iv64TEST()
63    {
64      omCheckAddrSize((ADDRESS)v,sizeof(int64)*row*col);
65    }
66};
67inline int64vec * iv64Copy(int64vec * o)
68{
69  int64vec * iv=new int64vec(o);
70  return iv;
71};
72
73int64vec * iv64Add(int64vec * a, int64vec * b);
74int64vec * iv64Sub(int64vec * a, int64vec * b);
75
76#ifdef MDEBUG
77#define iv64Test(v) v->iv64TEST()
78#else
79#define iv64Test(v)   ((void)0)
80#endif
81
82#endif
83
84
85
86
87
88
89
90
91
92
93
Note: See TracBrowser for help on using the repository browser.