Скачиваний:
26
Добавлен:
01.05.2014
Размер:
1.45 Кб
Скачать
#if !defined(__MATRIX_H)
#define __MATRIX_H

/*  Project first

		Copyright © 1997 by US. All Rights Reserved.

		SUBSYSTEM:    first.exe Application
		FILE:         tstpscnd.h
		AUTHOR:       US


		OVERVIEW
		========
		Class definition for TVector and TMatrix.
*/

#pragma hdrstop
#include <stdio.h>

class TVector {
	double *data;

public:
	unsigned length;

	TVector(unsigned _length);
	~TVector();

	double &operator[] (unsigned y);
	TVector &operator+ (TVector &b);
	TVector &operator- (TVector &b);
	double operator* (TVector &b);
	TVector &operator* (double a);
	void operator= (TVector &source);
	void zero(void);
	double getmax(void);

	int resize(unsigned _length);

	void write(FILE *outf);

	friend class TMatrix;
};

typedef TVector *PVector;

class TMatrix {
	PVector *data;

public:
	unsigned width, height;

	TMatrix(unsigned _width, unsigned _height);
	~TMatrix();

	TVector &operator[] (unsigned x);				// returns the appropriate column
	TVector &operator() (unsigned y);				// returns the appropriate row
	TMatrix &operator+ (TMatrix &b);
	TMatrix &operator- (TMatrix &b);
	TMatrix &operator* (TMatrix &b);
	TMatrix &operator* (double a);
	void operator= (TMatrix &source);
	TMatrix &operator~ (void);
	void zero(void);
	TMatrix &operator! (void);
	TVector &getmmax(void);

	void write(FILE *outf);

	int resize(unsigned _width, unsigned _height);
};

#endif
Соседние файлы в папке SOURCE