My Project
Loading...
Searching...
No Matches
ftmpl_matrix.h
Go to the documentation of this file.
1/* emacs edit mode for this file is -*- C++ -*- */
2
3#ifndef INCL_MATRIX_H
4#define INCL_MATRIX_H
5
6#ifndef NOSTREAMIO
7#ifdef HAVE_IOSTREAM
8#include <iostream>
9#define OSTREAM std::ostream
10#elif defined(HAVE_IOSTREAM_H)
11#include <iostream.h>
12#define OSTREAM ostream
13#endif
14#endif /* NOSTREAMIO */
15
16template <class T>
17class SubMatrix;
18
19template <class T>
20class Matrix;
21
22#ifndef NOSTREAMIO
23template <class T>
25#endif
26
27template <class T>
29{
30private:
31 int NR, NC;
32 T ** elems;
33#ifndef NOSTREAMIO
34 void printrow ( OSTREAM & s, int i ) const;
35#endif /* NOSTREAMIO */
36 typedef T* T_ptr;
37public:
38 Matrix() : NR(0), NC(0), elems(0) {}
39 Matrix( int nr, int nc );
40 Matrix( const Matrix<T>& M );
41 ~Matrix();
42 Matrix<T>& operator= ( const Matrix<T>& M );
43 int rows() const { return NR; }
44 int columns() const { return NC; }
45 SubMatrix<T> operator[] ( int i );
46 const SubMatrix<T> operator[] ( int i ) const;
47 T& operator() ( int row, int col );
48 T operator() ( int row, int col ) const;
49 SubMatrix<T> operator() ( int rmin, int rmax, int cmin, int cmax );
50 const SubMatrix<T> operator() ( int rmin, int rmax, int cmin, int cmax ) const;
51 void swapRow( int i, int j );
52 void swapColumn( int i, int j );
53#ifndef NOSTREAMIO
54 void print( OSTREAM& s ) const;
55 friend OSTREAM & operator<< <T>( OSTREAM & s, const Matrix<T>& M );
56#endif /* NOSTREAMIO */
57 friend class SubMatrix<T>;
58};
59 /*template <class T>
60 Matrix<T> operator+ ( const Matrix<T>& lhs, const Matrix<T>& rhs );
61 template <class T>
62 Matrix<T> operator- ( const Matrix<T>& lhs, const Matrix<T>& rhs );
63 template <class T>
64 Matrix<T> operator* ( const Matrix<T>& lhs, const Matrix<T>& rhs );
65 template <class T>
66 Matrix<T> operator* ( const Matrix<T>& lhs, const T& rhs );
67 template <class T>
68 Matrix<T> operator* ( const T& lhs, const Matrix<T>& rhs );*/
69
70template <class T>
72{
73private:
76 // we do not provide a default ctor, so nobody can declare an empty SubMatrix
77 SubMatrix( int rmin, int rmax, int cmin, int cmax, const Matrix<T> & m );
78public:
79 SubMatrix( const SubMatrix<T> & S );
82 operator Matrix<T>() const;
83 T operator[] ( int i ) const;
84 T& operator[] ( int i );
85 friend class Matrix<T>;
86};
87
88#ifndef NOSTREAMIO
89template <class T>
90OSTREAM & operator<< ( OSTREAM & s, const Matrix<T>& M );
91#endif /* NOSTREAMIO */
92
93#endif /* ! INCL_MATRIX_H */
#define OSTREAM
Definition: canonicalform.h:16
int m
Definition: cfEzgcd.cc:128
int i
Definition: cfEzgcd.cc:132
T * T_ptr
Definition: ftmpl_matrix.h:36
int rows() const
Definition: ftmpl_matrix.h:43
T ** elems
Definition: ftmpl_matrix.h:32
int NC
Definition: ftmpl_matrix.h:31
int columns() const
Definition: ftmpl_matrix.h:44
friend class Matrix< T >
Definition: ftmpl_matrix.h:85
T operator[](int i) const
SubMatrix< T > & operator=(const SubMatrix< T > &S)
Matrix< T > & M
Definition: ftmpl_matrix.h:75
const CanonicalForm int s
Definition: facAbsFact.cc:51
int j
Definition: facHensel.cc:110
OSTREAM & operator<<(OSTREAM &, const Matrix< T > &)
#define OSTREAM
Definition: ftmpl_matrix.h:9
#define FACTORY_PUBLIC
Definition: globaldefs.h:25
STATIC_VAR jList * T
Definition: janet.cc:30
#define M
Definition: sirandom.c:25