00001 #ifndef __SPMATRIX_H__
00002 #define __SPMATRIX_H__
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 #ifndef spOKAY
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 #include "spConfig.h"
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096 #define spOKAY 0
00097 #define spSMALL_PIVOT 1
00098 #define spZERO_DIAG 2
00099 #define spSINGULAR 3
00100 #define spNO_MEMORY 4
00101 #define spPANIC 5
00102
00103 #define spFATAL 2
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126 #define spREAL double
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156 #define spDEFAULT_PARTITION 0
00157 #define spDIRECT_PARTITION 1
00158 #define spINDIRECT_PARTITION 2
00159 #define spAUTO_PARTITION 3
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190 #define spADD_REAL_ELEMENT(element,real) *(element) += real
00191
00192 #define spADD_IMAG_ELEMENT(element,imag) *(element+1) += imag
00193
00194 #define spADD_COMPLEX_ELEMENT(element,real,imag) \
00195 { *(element) += real; \
00196 *(element+1) += imag; \
00197 }
00198
00199 #define spADD_REAL_QUAD(template,real) \
00200 { *((template).Element1) += real; \
00201 *((template).Element2) += real; \
00202 *((template).Element3Negated) -= real; \
00203 *((template).Element4Negated) -= real; \
00204 }
00205
00206 #define spADD_IMAG_QUAD(template,imag) \
00207 { *((template).Element1+1) += imag; \
00208 *((template).Element2+1) += imag; \
00209 *((template).Element3Negated+1) -= imag; \
00210 *((template).Element4Negated+1) -= imag; \
00211 }
00212
00213 #define spADD_COMPLEX_QUAD(template,real,imag) \
00214 { *((template).Element1) += real; \
00215 *((template).Element2) += real; \
00216 *((template).Element3Negated) -= real; \
00217 *((template).Element4Negated) -= real; \
00218 *((template).Element1+1) += imag; \
00219 *((template).Element2+1) += imag; \
00220 *((template).Element3Negated+1) -= imag; \
00221 *((template).Element4Negated+1) -= imag; \
00222 }
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247 struct spTemplate
00248 { spREAL *Element1 ;
00249 spREAL *Element2 ;
00250 spREAL *Element3Negated;
00251 spREAL *Element4Negated;
00252 };
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266 #ifdef __STDC__
00267
00268
00269
00270 extern void spClear( char* );
00271 extern spREAL spCondition( char*, spREAL, int* );
00272 extern char *spCreate( int, int, int* );
00273 extern void spDeleteRowAndCol( char*, int, int );
00274 extern void spDestroy( char* );
00275 extern int spElementCount( char* );
00276 extern int spError( char* );
00277 extern int spFactor( char* );
00278 extern int spFileMatrix( char*, char*, char*, int, int, int );
00279 extern int spFileStats( char*, char*, char* );
00280 extern int spFillinCount( char* );
00281 extern int spGetAdmittance( char*, int, int, struct spTemplate* );
00282 extern spREAL *spGetElement( char*, int, int );
00283 extern char *spGetInitInfo( spREAL* );
00284 extern int spGetOnes( char*, int, int, int, struct spTemplate* );
00285 extern int spGetQuad( char*, int, int, int, int, struct spTemplate* );
00286 extern int spGetSize( char*, int );
00287 extern int spInitialize( char*, int (*)() );
00288 extern void spInstallInitInfo( spREAL*, char* );
00289 extern spREAL spLargestElement( char* );
00290 extern void spMNA_Preorder( char* );
00291 extern spREAL spNorm( char* );
00292 extern int spOrderAndFactor( char*, spREAL[], spREAL, spREAL, int );
00293 extern void spPartition( char*, int );
00294 extern void spPrint( char*, int, int, int );
00295 extern spREAL spPseudoCondition( char* );
00296 extern spREAL spRoundoff( char*, spREAL );
00297 extern void spScale( char*, spREAL[], spREAL[] );
00298 extern void spSetComplex( char* );
00299 extern void spSetReal( char* );
00300 extern void spStripFills( char* );
00301 extern void spWhereSingular( char*, int*, int* );
00302
00303
00304
00305 #if spCOMPLEX
00306 extern void spDeterminant ( char*, int*, spREAL*, spREAL* );
00307 #else
00308 extern void spDeterminant ( char*, int*, spREAL* );
00309 #endif
00310 #if spCOMPLEX && spSEPARATED_COMPLEX_VECTORS
00311 extern int spFileVector( char*, char* , spREAL[], spREAL[]);
00312 extern void spMultiply( char*, spREAL[], spREAL[], spREAL[], spREAL[] );
00313 extern void spMultTransposed(char*,spREAL[],spREAL[],spREAL[],spREAL[]);
00314 extern void spSolve( char*, spREAL[], spREAL[], spREAL[], spREAL[] );
00315 extern void spSolveTransposed(char*,spREAL[],spREAL[],spREAL[],spREAL[]);
00316 #else
00317 extern int spFileVector( char*, char* , spREAL[] );
00318 extern void spMultiply( char*, spREAL[], spREAL[] );
00319 extern void spMultTransposed( char*, spREAL[], spREAL[] );
00320 extern void spSolve( char*, spREAL[], spREAL[] );
00321 extern void spSolveTransposed( char*, spREAL[], spREAL[] );
00322 #endif
00323
00324 #else
00325
00326
00327
00328 extern void spClear();
00329 extern spREAL spCondition();
00330 extern char *spCreate();
00331 extern void spDeleteRowAndCol();
00332 extern void spDestroy();
00333 extern void spDeterminant ();
00334 extern int spElementCount();
00335 extern int spError();
00336 extern int spFactor();
00337 extern int spFileMatrix();
00338 extern int spFileStats();
00339 extern int spFileVector();
00340 extern int spFillinCount();
00341 extern int spGetAdmittance();
00342 extern spREAL *spGetElement();
00343 extern char *spGetInitInfo();
00344 extern int spGetOnes();
00345 extern int spGetQuad();
00346 extern int spGetSize();
00347 extern int spInitialize();
00348 extern void spInstallInitInfo();
00349 extern spREAL spLargestElement();
00350 extern void spMNA_Preorder();
00351 extern void spMultiply();
00352 extern void spMultTransposed();
00353 extern spREAL spNorm();
00354 extern int spOrderAndFactor();
00355 extern void spPartition();
00356 extern void spPrint();
00357 extern spREAL spPseudoCondition();
00358 extern spREAL spRoundoff();
00359 extern void spScale();
00360 extern void spSetComplex();
00361 extern void spSetReal();
00362 extern void spSolve();
00363 extern void spSolveTransposed();
00364 extern void spStripFills();
00365 extern void spWhereSingular();
00366 #endif
00367
00368 #endif
00369
00370 #endif