1 /*$Id: e_aux.h,v 26.83 2008/06/05 04:46:59 al Exp $ -*- C++ -*-
2 * Copyright (C) 2001 Albert Davis
3 * Author: Albert Davis <aldavis@gnu.org>
5 * This file is part of "Gnucap", the Gnu Circuit Analysis Package
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 *------------------------------------------------------------------
22 * helper functions, etc., that sort of belong to circuit elements
24 //testing=script 2007.07.13
28 /*--------------------------------------------------------------------------*/
30 T
port_impedance(const node_t
& n1
, const node_t
& n2
,
31 BSMATRIX
<T
>& mat
, const T
& parallel
)
33 T
* zapit
= new T
[mat
.size()+2];
35 for (int ii
= 0; ii
< mat
.size()+2; ++ii
) {
42 if (n2
.m_() != 0) {untested();
48 T raw_z
= zapit
[n1
.m_()] - zapit
[n2
.m_()];
50 return (parallel
!= 0.)
51 ? 1. / ((1./raw_z
)-parallel
)
54 /*--------------------------------------------------------------------------*/
55 /*--------------------------------------------------------------------------*/
57 // vim:ts=8:sw=2:noet: