2000-04-27 22:03:57 +02:00
|
|
|
/**********
|
|
|
|
|
Copyright 1990 Regents of the University of California. All rights reserved.
|
|
|
|
|
Author: 1987 Gary W. Ng
|
|
|
|
|
**********/
|
|
|
|
|
|
2011-08-20 19:27:09 +02:00
|
|
|
#include <ngspice/ngspice.h>
|
|
|
|
|
#include <ngspice/cktdefs.h>
|
2000-04-27 22:03:57 +02:00
|
|
|
#include "niniter.h"
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* NInzIter (ckt, posDrive, negDrive)
|
|
|
|
|
*
|
|
|
|
|
* This routine solves the adjoint system. It assumes that the matrix has
|
|
|
|
|
* already been loaded by a call to NIacIter, so it only alters the right
|
|
|
|
|
* hand side vector. The unit-valued current excitation is applied
|
|
|
|
|
* between nodes posDrive and negDrive.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
NInzIter(CKTcircuit *ckt, int posDrive, int negDrive)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
/* clear out the right hand side vector */
|
|
|
|
|
|
2010-08-10 20:07:13 +02:00
|
|
|
for (i = 0; i <= SMPmatSize(ckt->CKTmatrix); i++) {
|
2000-04-27 22:03:57 +02:00
|
|
|
*((ckt->CKTrhs) + i) = 0.0;
|
|
|
|
|
*((ckt->CKTirhs) + i) = 0.0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*((ckt->CKTrhs) + posDrive) = 1.0; /* apply unit current excitation */
|
|
|
|
|
*((ckt->CKTrhs) + negDrive) = -1.0;
|
|
|
|
|
SMPcaSolve(ckt->CKTmatrix, ckt->CKTrhs, ckt->CKTirhs, ckt->CKTrhsSpare,
|
|
|
|
|
ckt->CKTirhsSpare);
|
|
|
|
|
*ckt->CKTrhs = 0.0;
|
|
|
|
|
*ckt->CKTirhs = 0.0;
|
|
|
|
|
}
|