Loading...
Searching...
No Matches
ftmpl_matrix.h
Go to the documentation of this file.
/* emacs edit mode for this file is -*- C++ -*- */
#ifndef INCL_MATRIX_H
#define INCL_MATRIX_H
#ifndef NOSTREAMIO
#ifdef HAVE_IOSTREAM
#include <iostream>
#define OSTREAM std::ostream
#elif defined(HAVE_IOSTREAM_H)
#include <iostream.h>
#define OSTREAM ostream
#endif
#endif /* NOSTREAMIO */
template <class T>
class SubMatrix;
template <class T>
class Matrix;
#ifndef NOSTREAMIO
template <class T>
OSTREAM& operator<< (OSTREAM &, const Matrix<T> &);
#endif
template <class T>
class FACTORY_PUBLIC Matrix
{
private:
int NR, NC;
T ** elems;
#ifndef NOSTREAMIO
void printrow ( OSTREAM & s, int i ) const;
#endif /* NOSTREAMIO */
typedef T* T_ptr;
public:
Matrix() : NR(0), NC(0), elems(0) {}
Matrix( int nr, int nc );
Matrix( const Matrix<T>& M );
~Matrix();
Matrix<T>& operator= ( const Matrix<T>& M );
int rows() const { return NR; }
int columns() const { return NC; }
SubMatrix<T> operator[] ( int i );
const SubMatrix<T> operator[] ( int i ) const;
T& operator() ( int row, int col );
T operator() ( int row, int col ) const;
SubMatrix<T> operator() ( int rmin, int rmax, int cmin, int cmax );
const SubMatrix<T> operator() ( int rmin, int rmax, int cmin, int cmax ) const;
void swapRow( int i, int j );
void swapColumn( int i, int j );
#ifndef NOSTREAMIO
void print( OSTREAM& s ) const;
friend OSTREAM & operator<< <T>( OSTREAM & s, const Matrix<T>& M );
#endif /* NOSTREAMIO */
friend class SubMatrix<T>;
};
/*template <class T>
Matrix<T> operator+ ( const Matrix<T>& lhs, const Matrix<T>& rhs );
template <class T>
Matrix<T> operator- ( const Matrix<T>& lhs, const Matrix<T>& rhs );
template <class T>
Matrix<T> operator* ( const Matrix<T>& lhs, const Matrix<T>& rhs );
template <class T>
Matrix<T> operator* ( const Matrix<T>& lhs, const T& rhs );
template <class T>
Matrix<T> operator* ( const T& lhs, const Matrix<T>& rhs );*/
template <class T>
class SubMatrix
{
private:
int r_min, r_max, c_min, c_max;
Matrix<T>& M;
// we do not provide a default ctor, so nobody can declare an empty SubMatrix
SubMatrix( int rmin, int rmax, int cmin, int cmax, const Matrix<T> & m );
public:
SubMatrix( const SubMatrix<T> & S );
SubMatrix<T>& operator= ( const SubMatrix<T>& S );
SubMatrix<T>& operator= ( const Matrix<T>& S );
operator Matrix<T>() const;
T operator[] ( int i ) const;
T& operator[] ( int i );
friend class Matrix<T>;
};
#ifndef NOSTREAMIO
template <class T>
OSTREAM & operator<< ( OSTREAM & s, const Matrix<T>& M );
#endif /* NOSTREAMIO */
#endif /* ! INCL_MATRIX_H */
OSTREAM
#define OSTREAM
Definition canonicalform.h:16
m
int m
Definition cfEzgcd.cc:128
i
int i
Definition cfEzgcd.cc:132
Matrix
Definition ftmpl_matrix.h:29
Matrix< CanonicalForm >::T_ptr
CanonicalForm * T_ptr
Definition ftmpl_matrix.h:36
Matrix::rows
int rows() const
Definition ftmpl_matrix.h:43
Matrix::Matrix
Matrix(int nr, int nc)
Definition ftmpl_matrix.cc:6
Matrix::swapRow
void swapRow(int i, int j)
Definition ftmpl_matrix.cc:110
Matrix::print
void print(OSTREAM &s) const
Definition ftmpl_matrix.cc:147
Matrix::swapColumn
void swapColumn(int i, int j)
Definition ftmpl_matrix.cc:122
Matrix::Matrix
Matrix(const Matrix< T > &M)
Definition ftmpl_matrix.cc:20
Matrix< CanonicalForm >::NR
int NR
Definition ftmpl_matrix.h:31
Matrix< CanonicalForm >::elems
CanonicalForm ** elems
Definition ftmpl_matrix.h:32
Matrix::~Matrix
~Matrix()
Definition ftmpl_matrix.cc:36
Matrix::Matrix
Matrix()
Definition ftmpl_matrix.h:38
Matrix< CanonicalForm >::NC
int NC
Definition ftmpl_matrix.h:31
Matrix::printrow
void printrow(OSTREAM &s, int i) const
Definition ftmpl_matrix.cc:138
Matrix::columns
int columns() const
Definition ftmpl_matrix.h:44
SubMatrix
Definition ftmpl_matrix.h:72
SubMatrix::SubMatrix
SubMatrix(int rmin, int rmax, int cmin, int cmax, const Matrix< T > &m)
Definition ftmpl_matrix.cc:231
SubMatrix::Matrix< T >
friend class Matrix< T >
Definition ftmpl_matrix.h:85
SubMatrix::r_max
int r_max
Definition ftmpl_matrix.h:74
SubMatrix::c_min
int c_min
Definition ftmpl_matrix.h:74
SubMatrix::c_max
int c_max
Definition ftmpl_matrix.h:74
SubMatrix::operator[]
T operator[](int i) const
Definition ftmpl_matrix.cc:299
SubMatrix::operator=
SubMatrix< T > & operator=(const SubMatrix< T > &S)
Definition ftmpl_matrix.cc:250
SubMatrix::M
Matrix< T > & M
Definition ftmpl_matrix.h:75
SubMatrix::r_min
int r_min
Definition ftmpl_matrix.h:74
s
const CanonicalForm int s
Definition facAbsFact.cc:51
j
int j
Definition facHensel.cc:110
operator<<
OSTREAM & operator<<(OSTREAM &, const Matrix< T > &)
Definition ftmpl_matrix.cc:314
FACTORY_PUBLIC
#define FACTORY_PUBLIC
Definition globaldefs.h:25
T
STATIC_VAR jList * T
Definition janet.cc:30
M
#define M
Definition sirandom.c:25