/* indxx.f -- translated by f2c (version of 3 February 1990  3:36:42).
   You must link the resulting object file with the libraries:
	-lF77 -lI77 -lm -lc   (in that order)
*/

#include "f2c.h"

/* Common Block Declarations */

struct {
    integer ielmnt, isbckt, nsbckt, iunsat, nunsat, itemps, numtem, isens, 
	    nsens, ifour, nfour, ifield, icode, idelim, icolum, insize, 
	    junode, lsbkpt, numbkp, iorder, jmnode, iur, iuc, ilc, ilr, 
	    numoff, isr, nmoffc, iseq, iseq1, neqn, nodevs, ndiag, iswap, 
	    iequa, macins, lvnim1, lx0, lvn, lynl, lyu, lyl, lx1, lx2, lx3, 
	    lx4, lx5, lx6, lx7, ld0, ld1, ltd, imynl, imvn, lcvn, nsnod, 
	    nsmat, nsval, icnod, icmat, icval, loutpt, lpol, lzer, irswpf, 
	    irswpr, icswpf, icswpr, irpt, jcpt, irowno, jcolno, nttbr, nttar, 
	    lvntmp;
} tabinf_;

#define tabinf_1 tabinf_

struct {
    integer locate[50], jelcnt[50], nunods, ncnods, numnod, nstop, nut, nlt, 
	    nxtrm, ndist, ntlin, ibr, numvs, numalt, numcyc;
} cirdat_;

#define cirdat_1 cirdat_

struct {
    doublereal value[200000];
} blank_;

#define blank_1 blank_

/*<       integer function indxx(node1,node2) >*/
integer indxx_(node1, node2)
integer *node1, *node2;
{
    /* System generated locals */
    integer ret_val;

    /* Local variables */
    static integer n1, n2;
#define nodplc ((integer *)&blank_1)
#define cvalue ((complex *)&blank_1)
    static integer loc;

/*<       implicit double precision (a-h,o-z) >*/

/*     this routine maps a (row, column) matrix term specification into */

/* the offset from the origin of the matrix storage at which the term is 
*/
/* actually located. */

/* spice version 2g.6  sccsid=tabinf 3/15/83 */
/*<       common /tabinf/ ielmnt,isbckt,nsbckt,iunsat,nunsat,itemps,numtem, >*/
/*<      1   isens,nsens,ifour,nfour,ifield,icode,idelim,icolum,insize, >*/
/*<      2   junode,lsbkpt,numbkp,iorder,jmnode,iur,iuc,ilc,ilr,numoff,isr, >*/
/*<      3   nmoffc,iseq,iseq1,neqn,nodevs,ndiag,iswap,iequa,macins,lvnim1, >*/
/*<      4   lx0,lvn,lynl,lyu,lyl,lx1,lx2,lx3,lx4,lx5,lx6,lx7,ld0,ld1,ltd, >*/
/*<      5   imynl,imvn,lcvn,nsnod,nsmat,nsval,icnod,icmat,icval, >*/
/*<      6   loutpt,lpol,lzer,irswpf,irswpr,icswpf,icswpr,irpt,jcpt, >*/
/*<      7   irowno,jcolno,nttbr,nttar,lvntmp >*/
/* spice version 2g.6  sccsid=cirdat 3/15/83 */
/*<       common /cirdat/ locate(50),jelcnt(50),nunods,ncnods,numnod,nstop, >*/
/*<      1   nut,nlt,nxtrm,ndist,ntlin,ibr,numvs,numalt,numcyc >*/
/* spice version 2g.6  sccsid=blank 3/15/83 */
/*<       common /blank/ value(200000) >*/
/*<       integer nodplc(64) >*/
/*<       complex cvalue(32) >*/
/*<       equivalence (value(1),nodplc(1),cvalue(1)) >*/

/*<       if (node1.eq.1) go to 100 >*/
    if (*node1 == 1) {
	goto L100;
    }
/*<       if (node2.eq.1) go to 100 >*/
    if (*node2 == 1) {
	goto L100;
    }

/*<       n1=nodplc(irswpr+node1) >*/
    n1 = nodplc[tabinf_1.irswpr + *node1 - 1];
/*<       n2=nodplc(icswpr+node2) >*/
    n2 = nodplc[tabinf_1.icswpr + *node2 - 1];
/*<       if (n1-n2) 10,10,30 >*/
    if (n1 - n2 <= 0) {
	goto L10;
    } else {
	goto L30;
    }

/*     search col n2 */

/*<    10 loc=n2 >*/
L10:
    loc = n2;
/*<    15 loc=nodplc(irpt+loc) >*/
L15:
    loc = nodplc[tabinf_1.irpt + loc - 1];
/*<       if (loc.eq.0) go to 100 >*/
    if (loc == 0) {
	goto L100;
    }
/*<       if (nodplc(irowno+loc)-n1) 15,20,15 >*/
    if (nodplc[tabinf_1.irowno + loc - 1] - n1 != 0) {
	goto L15;
    } else {
	goto L20;
    }
/*<    20 indxx=loc >*/
L20:
    ret_val = loc;
/*<       return >*/
    return ret_val;

/*     search row n1 */

/*<    30 loc=n1 >*/
L30:
    loc = n1;
/*<    35 loc=nodplc(jcpt+loc) >*/
L35:
    loc = nodplc[tabinf_1.jcpt + loc - 1];
/*<       if (loc.eq.0) go to 100 >*/
    if (loc == 0) {
	goto L100;
    }
/*<       if (nodplc(jcolno+loc)-n2) 35,40,35 >*/
    if (nodplc[tabinf_1.jcolno + loc - 1] - n2 != 0) {
	goto L35;
    } else {
	goto L40;
    }
/*<    40 indxx=loc >*/
L40:
    ret_val = loc;
/*<       return >*/
    return ret_val;

/*     unused location */

/*<   100 indxx=1 >*/
L100:
    ret_val = 1;
/*<       return >*/
    return ret_val;
/*<       end >*/
} /* indxx_ */

#undef cvalue
#undef nodplc


