niniter.c

来自「ngspice又一个电子CAD仿真软件代码.功能更全」· C语言 代码 · 共 41 行

C
41
字号
/**********Copyright 1990 Regents of the University of California.  All rights reserved.Author: 1987 Gary W. Ng**********/#include "ngspice.h"#include "cktdefs.h"#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. */extern void SMPcaSolve();voidNInzIter(CKTcircuit *ckt, int posDrive, int negDrive){    int i;    /* clear out the right hand side vector */    for (i=0; i<= SMPmatSize((SMPmatrix *)ckt->CKTmatrix); i++) {	*((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;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?