Jspice3
niniter.c
Go to the documentation of this file.
1 /***************************************************************************
2 JSPICE3 adaptation of Spice3f2 - Copyright (c) Stephen R. Whiteley 1992
3 Copyright 1990 Regents of the University of California. All rights reserved.
4 Authors: 1987 Gary W. Ng
5  1993 Stephen R. Whiteley
6 ****************************************************************************/
7 
8 #include "spice.h"
9 #include "cktdefs.h"
10 #include "niext.h"
11 
12 /*
13  * NInzIter (ckt, posDrive, negDrive)
14  *
15  * This routine solves the adjoint system. It assumes that the matrix has
16  * already been loaded by a call to NIacIter, so it only alters the right
17  * hand side vector. The unit-valued current excitation is applied
18  * between nodes posDrive and negDrive.
19  */
20 
21 void
22 NInzIter(ckt, posDrive, negDrive)
23 
24 CKTcircuit *ckt;
25 int posDrive;
26 int negDrive;
27 {
28  int i, size;
29 
30  /* clear out the right hand side vector */
31  size = spGetSize(ckt->CKTmatrix,1);
32  for (i = 0; i <= size; i++) {
33  *((ckt->CKTrhs) + i) = 0.0;
34  *((ckt->CKTirhs) + i) = 0.0;
35  }
36 
37  *((ckt->CKTrhs) + posDrive) = 1.0; /* apply unit current excitation */
38  *((ckt->CKTrhs) + negDrive) = -1.0;
39  spSolveTransposed(ckt->CKTmatrix,ckt->CKTrhs,
40  ckt->CKTrhs,ckt->CKTirhs,ckt->CKTirhs);
41  *ckt->CKTrhs = 0.0;
42  *ckt->CKTirhs = 0.0;
43 }
void NInzIter(CKTcircuit *ckt, int posDrive, int negDrive)
Definition: niniter.c:22
int spGetSize()
void spSolveTransposed()