more adaptions

This commit is contained in:
dwarning 2023-06-06 14:54:17 +02:00
parent 5dc09c6272
commit 2b3a916dd2
7 changed files with 108 additions and 17 deletions

View File

@ -344,6 +344,7 @@ spcEXTERN void spSetComplex( spMatrix );
spcEXTERN void spSetReal( spMatrix );
spcEXTERN void spStripFills( spMatrix );
spcEXTERN void spWhereSingular( spMatrix, int*, int* );
spcEXTERN void spConstMult( spMatrix, double );
/* Functions with argument lists that are dependent on options. */
@ -373,4 +374,3 @@ spcEXTERN void spSolveTransposed( spMatrix,
spREAL[], spREAL[] );
#endif /* NOT (spCOMPLEX && spSEPARATED_COMPLEX_VECTORS) */
#endif /* spOKAY */
//spcEXTERN void spConstMult(spMatrix, double);

View File

@ -3,3 +3,48 @@
* spdefs.h: #includes spice.h instead of misc.h
added a few #undefs to avoid redaclarations
2023-06-06 Dietmar Warning
spAllocate.c:
ReserveElements() not needed
Distinction between OriginalCount() and ElementCount() needed for ACCT report.
Structure Matrix has no "Original" member anymore, seems ELEMENTS plays this role.
spBuild.c:
int Min is initialized with LARGEST_LONG_INTEGER follows in -1, Min should be long int
spSMP.c:
Return value of SMP functions: what is meant for spError? the typedef to int or the spErrorState function?
SMPfindElt() calls spcFindElement() - it is not available
Compiling with spSEPARATED_COMPLEX_VECTORS=0 follows in error like this:
spSMP.c: In function SMPcSolve:
spSMP.c:222:5: error: too many arguments to function spSolve
222 | spSolve( (char *)Matrix, RHS, RHS, iRHS, iRHS );
| ^~~~~~~
In file included from spSMP.c:93:
../../../src/include/ngspice/spmatrix.h:371:23: note: declared here
371 | spcEXTERN void spSolve( spMatrix, spREAL[], spREAL[] );
This shows that prototypes are OK, but in the call of the function is no difference in parameter count.
spConfig.h:
#define REAL YES
#define EXPANDABLE YES
#define TRANSLATE YES
#define INITIALIZE NO
#define DIAGONAL_PIVOTING YES
#define ARRAY_OFFSET NO
#define MODIFIED_MARKOWITZ NO
#define DELETE NO
#define STRIP NO
#define MODIFIED_NODAL YES
#define QUAD_ELEMENT NO
#define TRANSPOSE YES
#define SCALING NO
#define DOCUMENTATION YES
#define MULTIPLICATION YES
#define DETERMINANT YES
#define STABILITY NO
#define CONDITION NO
#define PSEUDOCONDITION NO
#define FORTRAN NO
#define DEBUG YES
#define spCOMPLEX 1
#define spSEPARATED_COMPLEX_VECTORS 1

View File

@ -123,7 +123,7 @@ spMatrix
spCreate(
int Size,
int Complex,
int *pError
spError *pError
)
{
register unsigned SizePlusOne;
@ -670,7 +670,7 @@ register AllocationListPtr ListPtr, NextListPtr;
* The pointer to the matrix for which the error status is desired.
*/
int
spError
spErrorState( spMatrix eMatrix )
{
/* Begin `spErrorState'. */

View File

@ -151,7 +151,7 @@
* matrix. ARRAY_OFFSET must be either 0 or 1, no other offsets
* are valid.
*/
#define ARRAY_OFFSET YES
#define ARRAY_OFFSET NO
/*!
* This specifies that the modified Markowitz method of pivot

View File

@ -0,0 +1,27 @@
Copyright (c) 2003, Kenneth S. Kundert
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer. Redistributions
in binary form must reproduce the above copyright notice, this list
of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution. Neither the name of the
copyright holder nor the names of the authors may be used to endorse
or promote products derived from this software without specific prior
written permission.
This software is provided by the copyright holders and contributors
"as is" and any express or implied warranties, including, but not
limited to, the implied warranties of merchantability and fitness for
a particular purpose are disclaimed. In no event shall the copyright
owner or contributors be liable for any direct, indirect, incidental,
special, exemplary, or consequential damages (including, but not limited
to, procurement of substitute goods or services; loss of use, data, or
profits; or business interruption) however caused and on any theory of
liability, whether in contract, strict liability, or tort (including
negligence or otherwise) arising in any way out of the use of this
software, even if advised of the possibility of such damage.

View File

@ -96,7 +96,7 @@
#define NO 0
#define YES 1
typedef spREAL RealNumber, *RealVector;
typedef spREAL *RealVector;
static void LoadGmin(char *Matrix, double Gmin);
@ -417,7 +417,7 @@ SMPcDProd(SMPmatrix *Matrix, SPcomplex *pMantissa, int *pExponent)
* for compatibility with Spice3.
*/
#include "spDefs.h"
void
static void
LoadGmin( eMatrix, Gmin )
char *eMatrix;
register double Gmin;

View File

@ -23,23 +23,42 @@
*/
#define spINSIDE_SPARSE
#include <stdio.h>
#include "spConfig.h"
#include "ngspice/spmatrix.h"
#include "spDefs.h"
void
spConstMult(MatrixPtr matrix, double constant)
spConstMult(
spMatrix eMatrix,
double constant
)
{
ElementPtr e;
int i;
int size = matrix->Size;
ElementPtr pElement;
int I;
MatrixPtr Matrix = (MatrixPtr)eMatrix;
int size = Matrix->Size;
for (i = 1; i <= size; i++) {
for (e = matrix->FirstInCol[i]; e; e = e->NextInCol) {
e->Real *= constant;
e->Imag *= constant;
}
}
ASSERT_IS_SPARSE( Matrix );
#if spCOMPLEX
for (I = 1; I <= size; I++) {
for (pElement = Matrix->FirstInCol[I]; pElement; pElement = pElement->NextInCol) {
pElement->Real *= constant;
pElement->Imag *= constant;
}
}
return;
#endif
#if REAL
for (I = 1; I <= size; I++) {
pElement = Matrix->FirstInRow[I];
while (pElement != NULL)
{ pElement->Real *= constant;
pElement = pElement->NextInRow;
}
}
return;
#endif /* REAL */
}