#ifndef _MATRIX_
#define _MATRIX_
#include <exec/resident.h>
#include <exec/nodes.h>
#include <exec/lists.h>
#include <exec/ports.h>
#include <exec/tasks.h>
#include <intuition/intuition.h>
#include <intuition/intuitionbase.h>
#include <functions.h>
#include <string.h>
struct MInfo {
double Rang; 
double Spur; 
double Det; 
};
struct MStatistic {
long Rang; 
double Spur; 
double Det; 
double Summe; 
int Dichte; 
double Produkt; 
long Nil; 
long ZDim; 
long SDim; 
unsigned int Symmetrisch :1; 
unsigned int Normal :1; 
unsigned int Orthogonal :1; 
unsigned int Diagonal :1; 
unsigned int Triagonal :1;
unsigned int Selbstinvers :1;
unsigned int Projektion :1;
unsigned int Selbstadj :1; 
unsigned int Definit :2; 
};
#define POSITIV	1
#define NEGATIV 2
#define SEMI	4
#define UNDEFINIT 0
union value {
double d; 
long l; 
char *s;};
struct Kommunikation { 
double *v[7]; 
double *m[7]; 
char *string; 
struct MStatistic *MStat; 
struct MInfo *MInfo; 
char *printer; 
long dim; 
SHORT Manz; 
SHORT Vanz; 
union value val; 
BOOL set; 
BOOL busy; 
BOOL lock; 
BOOL output; 
struct Task *extask; 
ULONG maske; 
double Double; 
double ID;}; 
#define INFO_M1 0 
#define TRANS_M1 2
#define INVERS_M1	3
#define CLR_M1	4
#define PRINT_M1 5
#define BILIN	6
#define INFO_M2 7 
#define TRANS_M2 9
#define INVERS_M2 10
#define CLR_M2 11
#define PRINT_M2 12
#define ONB	13
#define M1_A	14 
#define M1_B	15
#define M1_C	16
#define M1_D	17
#define M1_E	18
#define M1_F	19
#define M1_G	20
#define M2_A	21 
#define M2_B	22
#define M2_C	23
#define M2_D	24
#define M2_E	25
#define M2_F	26
#define M2_G	27
#define V_A	42 
#define V_B	43
#define V_C	44
#define V_D	45
#define V_E	46
#define V_F	47
#define V_G	48
#define VDEST_A	75 
#define VDEST_B	76
#define VDEST_C	77
#define VDEST_D	78
#define VDEST_E	79
#define VDEST_F	80
#define VDEST_G	81
#define MDEST_A	68 
#define MDEST_B	69
#define MDEST_C	70
#define MDEST_D	71
#define MDEST_E	72
#define MDEST_F	73
#define MDEST_G	74
#define M_PROD_M1_M2	28
#define M_DIVI	30
#define ADDIER_M	31
#define SUBTRA	32
#define HOCH	33
#define RUNTER	34
#define GAUß	2000
#define GAUßPLUS	2001
#define GLSQR	2004
#define GAUTRI	2006
#define M_PROD_M_V	36
#define L_OPTI	37
#define ADDALL	38
#define MULALL	39
#define COPY_M_V	40
#define COPY_V_M	41
#define CLR_V	49
#define PRINT_V	51
#define E_TO_M2	53
#define	STATIS	54 
#define JACOBI	3001
#define EW_TRIDIA	3004
#define POLY	3000
#define NNSNORM	4000
#define NNZSNORM	4002
#define NNSSNORM	4003
#define NNFNORM	4001
#define NNKNORM	4004
#define	LR	1001
#define QR	1000
#define HESSEN	1004
#define CHOLESKY	1003
#define SYMZER	1002
#define PTOA	(long)((char *)"A")
#define PTOB	(long)((char *)"B")
#define PTOC	(long)((char *)"C")
#define PTOD	(long)((char *)"D")
#define PTOE	(long)((char *)"E")
#define PTOF	(long)((char *)"F")
#define PTOG	(long)((char *)"G")
#define	STATUS	59
#define	FREE	60 
#define	CLRALL	61
#define PRINT_A	62
#define	PRINT_STATUS	63 
#define ICON	64 
#define	ADDIER_V	65
#define	S_PROD	66 
#define	TRANS_V	67
#define SMULTI_M1 1 
#define SMULTI_M2 8 
#define SMULTI_V	50 
#define	EV	57 
#define T_PROD	29 
#define	POTENZ	52 
#define EW_QR	3002 
#define EW_LR	3003 
#define GSV	2002 
#define ESV	2003 
#define MATRIX1	160 
#define MATRIX2	161 
#define VEKTOR	162 
#define ALLE	163 
#define LOAD	164 
#define SAVE	165 
#define DELETE	166 
#define BUILDUP	144 
#define CHANGEDIM	143 
#define ZAHLEN_ALS_REELLE_ZAHLEN	0x0001
#define ZAHLEN_ALS_BRUECHE_1	0x0801
#define ZAHLEN_ALS_BRUECHE_2	0x1001
#define ANZAHL_AN_VEKTOREN	0x0021 
#define ANZAHL_AN_MATRIZEN	0x0821 
#define HILFE	0xf841
#define PROTOKOLL	0xf861
#define BLOCKWEISE	0xf881
#define ASCIIDATEI	0xf8a1
#define ZIFFER_NULL	0xf8c1
#define STABIL	0xf8e1
#define TOLERANZ	0xf901 
#define SAVE_PREFS	0xf921
#define LOAD_PREFS	0xf941 
#define HINTERGRUND	0xf961
#define SUMMENNORM	0xf802
#define EUKLIDNORM	0xf822
#define P_NORM_V	0xf842 
#define MAXIMUMSNORM	0xf862
#define SPALTENSUMMENNORM	0xf803
#define ZEILENSUMMENNORM	0xf823
#define SPEKTRALNORM	0xf843
#define FROBENIUSNORM	0xf863
#define P_NORM_M	0xf883 
#define KOND_SPALTENSUMMENNORM	0x00a3
#define KOND_ZEILENSUMMENNORM	0x08a3
#define KOND_SPEKTRALNORM	0x10a3
#define KOND_FROBENIUSNORM	0x18a3
#define KOND_P_NORM_M	0x20a3 
#define OUTPUT 1
#define NOOUTPUT 0
#define NO_INTUITION	1
#define NO_WB_SCREEN	2
#define NO_MATRIX	3
#define NO_REPLYPORT	4
#define MATRIX_ENDING	5
#define NO_SIGNAL	6
#define PRE_LOCKED	7
int LoginM(int OutFlag);
void FreeM(void);
int Make(int Operation);
int ChangeDim(long DIM);
void Make_long(int Operation,long ganze_zahl);
void Make_real(int Operation,double *reelle_zahl);
void Make_datei(int Operation,int Objekt,char *name);
int Make_menu(int Operation,long l);
double MAT(char a,long x,long y);
double VEK(char a,long y);
void AUSGABE(char *i);
#pragma amicall(MatrixlibBase, 0x1e, LoginM(d0))
#pragma amicall(MatrixlibBase, 0x24, FreeM())
#pragma amicall(MatrixlibBase, 0x2a, Make(d0))
#pragma amicall(MatrixlibBase, 0x30, ChangeDim(d0))
#pragma amicall(MatrixlibBase, 0x36, Make_long(d0,d1))
#pragma amicall(MatrixlibBase, 0x3c, Make_real(d0,a0))
#pragma amicall(MatrixlibBase, 0x42, Make_datei(d0,d1,a0))
#pragma amicall(MatrixlibBase, 0x48, Make_menu(d0,d1))
#define MAT(A,C,D) (MatrixlibBase->Out->m[A-65][((D)-1)*MatrixlibBase->Out->dim+(C)-1] )
#define VEK(A,C) (MatrixlibBase->Out->v[A-97][(C)-1])
#define AUSGABE(A) strcpy(MatrixlibBase->Out->printer,A)
#define MSTATRANG MatrixlibBase->Out->MStat->Rang
#define MSTATSUMME MatrixlibBase->Out->MStat->Summe
#define MSTATPRODUKT MatrixlibBase->Out->MStat->Produkt
#define MSTATDICHTE MatrixlibBase->Out->MStat->Dichte
#define MSTATSPUR MatrixlibBase->Out->MStat->Spur
#define MSTATDET MatrixlibBase->Out->MStat->Det
#define MSTATNIL	MatrixlibBase->Out->MStat->Nil
#define MSTATZDIM MatrixlibBase->Out->MStat->ZDim
#define MSTATSDIM MatrixlibBase->Out->MStat->SDim
#define MSTATSYMMETRISCH MatrixlibBase->Out->MStat->Symmetrisch
#define MSTATNORMAL MatrixlibBase->Out->MStat->Normal
#define MSTATORTHOGONAL MatrixlibBase->Out->MStat->Orthogonal
#define MSTATDIAGONAL MatrixlibBase->Out->MStat->Diagonal 
#define MSTATTRIAGONAL MatrixlibBase->Out->MStat->Triagonal
#define MSTATSELBSTINVERS MatrixlibBase->Out->MStat->Selbstinvers
#define MSTATPROJEKTION	MatrixlibBase->Out->MStat->Projektion
#define MSTATSELBSTADJUNGIERT	MatrixlibBase->Out->MStat->Selbstadj
#define MSTATDEFINIT	MatrixlibBase->Out->MStat->Definit
#define MINFODET MatrixlibBase->Out->MInfo->Det
#define MINFORANG MatrixlibBase->Out->MInfo->Rang
#define MINFOSPUR MatrixlibBase->Out->MInfo->Spur
#define STATUSZEILE	MatrixlibBase->Out->string
#define ERGEBNIS	MatrixlibBase->Out->Double
struct MatrixlibBase {
struct Library	ml_Lib;
unsigned long	ml_SegList;
BOOL	log;
struct MsgPort	*ReplyPort;
struct MsgPort	*MATRIXPort;
struct Kommunikation	*Out;
struct Gadget	Gad;
struct IntuiMessage	MyMess;
struct IntuitionBase	*IntBase;
long	bit;
};
#endif
