source: git/Singular/intvec.h @ aad2408

spielwiese
Last change on this file since aad2408 was 0e1846, checked in by Olaf Bachmann <obachman@…>, 27 years ago
This commit was generated by cvs2svn to compensate for changes in r59, which included commits to RCS files with non-trunk default branches. git-svn-id: file:///usr/local/Singular/svn/trunk@60 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 2.1 KB
Line 
1#ifndef INTVEC_H
2#define INTVEC_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/*
7* ABSTRACT
8*/
9/* $Log: not supported by cvs2svn $
10*/
11#include <string.h>
12#include "mmemory.h"
13#include "febase.h"
14
15class intvec
16{
17  private:
18    int *v;
19    int row;
20    int col;
21  public:
22    intvec(int l=1)
23    {
24      v = (int *)Alloc0(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    int range(int i)
32       { return ((i<row) && (i>=0) && (col==1)); }
33    int range(int i, int j)
34       { return ((i<row) && (i>=0) && (j<col) && (j>=0)); }
35    int& operator[](int i) {
36       if((i<0)||(i>=row*col))
37       {
38          Print("wrong index:%d\n",i);
39       }
40       return v[i];}
41#define IMATELEM(M,I,J) (M)[(I-1)*(M).cols()+J-1]
42    void operator+=(int intop);
43    void operator-=(int intop);
44    void operator*=(int intop);
45    void operator/=(int intop);
46    void operator%=(int intop);
47    // -2: not compatible, -1: <, 0:=, 1: >
48    int compare(intvec* o);
49    int compare(int o);
50    int  length() const { return col*row; }
51    int  cols() const { return col; }
52    int  rows() const { return row; }
53    void length(int l) { row = l; col = 1; }
54    void show(int spaces=0);
55    void makeVector() { row*=col;col=1; }
56    // keiner (ausser obachman) darf das folgenden benutzen !!!
57    int * ivGetVec() { return v; }
58    char * String();
59    char * ivString();
60    ~intvec()
61       {
62#ifdef MDEBUG
63         mmTestL(this);
64#endif
65         if (v!=NULL)
66         {
67            Free((ADDRESS)v,sizeof(int)*row*col);
68#ifdef TEST
69            v=NULL;
70#endif
71         }
72       }
73};
74intvec * ivCopy(intvec * o);
75intvec * ivAdd(intvec * a, intvec * b);
76intvec * ivSub(intvec * a, intvec * b);
77intvec * ivTranp(intvec * o);
78int      ivTrace(intvec * o);
79intvec * ivMult(intvec * a, intvec * b);
80void     ivTriangMat(intvec * imat, int srw, int col);
81int      ivFirstEmptyRow(intvec * imat);
82void     ivCancelContent(intvec * imat,int from=1);
83intvec * ivSolveIntMat(intvec * imat);
84
85#endif
Note: See TracBrowser for help on using the repository browser.