00001 /*************************************************************************** 00002 matrix.h - description 00003 --------------- 00004 begin : Wed Apr 25 2001 00005 copyright : (C) 2001 by Reinhold Kainhofer 00006 email : reinhold@kainhofer.com 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * 00011 * This program is free software; you can redistribute it and/or modify 00012 * it under the terms of the GNU General Public License as published by 00013 * the Free Software Foundation; either version 2 of the License, or 00014 * (at your option) any later version. 00015 * 00016 ***************************************************************************/ 00017 00018 // Matrix.h 00019 #ifndef matrix_h // Sentry, use file only if it's not already included. 00020 #define matrix_h 00021 #include <math.h> 00022 #include "BaseDefinitions.h" 00023 00024 #define maxElem 20 00025 //typedef int bool; 00026 //typedef long double Zahl; 00027 #define true 1 00028 #define false 0 00029 #define Pi 3.14159265358979323846264338328 00030 00031 00033 // Matrix-Objekt 00034 // 00035 00036 class Matrix 00037 { 00038 public: //Konstruktoren 00039 Matrix(int zSz=3,int sSz=-1, Zahl diag=1, Zahl other=0); 00040 Matrix(Matrix& x); 00041 ~Matrix(); 00042 00043 protected: //Speicherverwaltung 00044 bool AllocMxMem(int zSz,int sSz); 00045 bool FreeMxMem(); 00046 protected: //Daten 00047 Zahl *Elements; 00048 int zSize,sSize; 00049 00050 public: //Selektoren und Eigenschaften 00051 Zahl Get(const int i,const int j) {return (((i>zSize)||(j>sSize)||(zSize<=0)||(sSize<=0))?0:Elements[(i-1)*sSize+j-1]);} 00052 Zahl Set(int i,int j, const Zahl val); 00053 int GetSize(void) {return zSize;} 00054 int GetZSize(void) {return zSize;} 00055 int GetSSize(void) {return sSize;} 00056 bool Quadratic(void) {return sSize==zSize;} 00057 00058 /*public: //Operatoren 00059 Matrix& operator = (Matrix& x); 00060 Matrix& operator * (Matrix& x); 00061 Matrix& operator + (Matrix& x); 00062 Matrix& operator - (Matrix& x); 00063 Matrix& operator * (const Zahl x);*/ 00064 00065 public: //Rearrangements 00066 bool TauscheZeilen(int n, int m); 00067 bool TauscheSpalten(int n, int m); 00068 00069 /* public: //Normen 00070 Zahl Schurnorm(); 00071 Zahl ZSNorm(); 00072 Zahl SSNorm(); 00073 */ 00074 public: //Determinante 00075 Zahl Det(); 00076 protected: 00077 int GetBestPivot(int Col); 00078 00079 /* public: //Datei Eingabe/Ausgabe 00080 bool Open(char* filename); 00081 bool Write(ofstream *str); 00082 00083 public: //spezielle Matrizentypen 00084 bool Kronecker(float angle); 00085 bool WalshHardamard(void); 00086 bool Zielke(Zahl a); 00087 bool Hilbert(void); 00088 00089 public: //Verfahren zur Inversion 00090 bool GaussJordan(void); 00091 bool Strassen(void); 00092 bool Schulz(Matrix& inv, char *fn=""); 00093 bool LRInversion(void); 00094 00095 protected: //Teilmatrizen (+Multiplikation) 00096 Matrix GetTmx(int flag); 00097 bool SetMxFromTmx(Matrix& B11, Matrix& B12, Matrix& B21, Matrix& B22); 00098 */ 00099 }; 00100 00101 #endif // Vektor_h
1.2.7 written by Dimitri van Heesch,
© 1997-2001