source: git/Singular/intvec.h @ 8cfee1c

spielwiese
Last change on this file since 8cfee1c was b009cf, checked in by Hans Schönemann <hannes@…>, 23 years ago
*hannes: removed bareiss(intmat) git-svn-id: file:///usr/local/Singular/svn/trunk@5153 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 2.3 KB
Line 
1#ifndef INTVEC_H
2#define INTVEC_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id: intvec.h,v 1.17 2001-01-31 18:04:51 Singular Exp $ */
7/*
8* ABSTRACT: class intvec: lists/vectors of integers
9*/
10#include <string.h>
11#include "omalloc.h"
12#include "febase.h"
13
14class intvec
15{
16private:
17  int *v;
18  int row;
19  int col;
20public:
21
22  intvec(int l = 1)
23    {
24      v = (int *)omAlloc0(sizeof(int)*l);
25      row = l;
26      col = 1;
27    }
28  intvec(int s, int e);
29  intvec(int r, int c, int init);
30  intvec(intvec* iv);
31
32  void resize(int new_length);
33  int range(int i)
34    { return ((i<row) && (i>=0) && (col==1)); }
35  int range(int i, int j)
36    { return ((i<row) && (i>=0) && (j<col) && (j>=0)); }
37  int& operator[](int i)
38    {
39#ifndef NDEBUG
40      if((i<0)||(i>=row*col))
41      {
42        Werror("wrong intvec index:%d\n",i);
43      }
44#endif
45      return v[i];
46    }
47#define IMATELEM(M,I,J) (M)[(I-1)*(M).cols()+J-1]
48  void operator+=(int intop);
49  void operator-=(int intop);
50  void operator*=(int intop);
51  void operator/=(int intop);
52  void operator%=(int intop);
53  // -2: not compatible, -1: <, 0:=, 1: >
54  int compare(intvec* o);
55  int compare(int o);
56  int  length() const { return col*row; }
57  int  cols() const { return col; }
58  int  rows() const { return row; }
59  void length(int l) { row = l; col = 1; }
60  void show(int mat=0,int spaces=0);
61  void makeVector() { row*=col;col=1; }
62  // keiner (ausser obachman) darf das folgenden benutzen !!!
63  int * ivGetVec() { return v; }
64  char * String(int dim = 2);
65  char * ivString(int mat=0,int spaces=0, int dim=2);
66  ~intvec()
67    {
68      if (v!=NULL)
69      {
70        omFreeSize((ADDRESS)v,sizeof(int)*row*col);
71        v=NULL;
72      }
73    }
74  void ivTEST()
75    {
76      omCheckAddrSize((ADDRESS)v,sizeof(int)*row*col);
77    }
78};
79intvec * ivCopy(intvec * o);
80intvec * ivAdd(intvec * a, intvec * b);
81intvec * ivSub(intvec * a, intvec * b);
82intvec * ivTranp(intvec * o);
83int      ivTrace(intvec * o);
84intvec * ivMult(intvec * a, intvec * b);
85//void     ivTriangMat(intvec * imat);
86void     ivTriangIntern(intvec * imat, int &ready, int &all);
87intvec * ivSolveKern(intvec * imat, int ready);
88
89
90#ifdef MDEBUG
91#define ivTest(v) v->ivTEST()
92#else
93#define ivTest(v)   ((void)0)
94#endif
95#undef INLINE_THIS
96
97#endif
Note: See TracBrowser for help on using the repository browser.