AUTO の中身

($AUTO)/src/README

README : This file.
autlib1.f : Auto library routines (including main program)
autlib2.f : Auto library routines (bvp linear equation routines)
autlib3.f : Auto library routines (interface routines)
autlib4.f : Auto library routines (Floquet routines)
autlib5.f : Auto library routines (HomPack)
stdat.f : A subroutine for starting orbits from numerical data
eispack.f : contains EISPACK routines needed by AUTO
autlab.f : A utility program for rewriting AUTO data files
86to97.f : A utility program to convert AUTO86 Data-files
94to97.f : A utility program to convert older AUTO94 Data-files
double.f : A utility program for ``doubling'' solutions in q.xxx
Makefile : To compile the source files


($AUTO)/src/autlib4.c

#include "auto_f2c.h"
#include "auto_c.h"

/* ----------------------------------------------------------------------- */
/* ----------------------------------------------------------------------- */
/* Floquet Multiplier Computation (Tom Fairgrieve, U. of Toronto) */
/* ----------------------------------------------------------------------- */
/* ----------------------------------------------------------------------- */
/* References: */
/* T. F. Fairgrieve, PhD Thesis, University of Toronto, 1994. */
/* T. F. Fairgrieve, A. D. Jepson, O.K. Floquet multipliers, */
/* SIAM J. Numer. Anal. 28. No. 5, 1991, 1446-1462. */

/* Please inform Tom Fairgrieve (tff@na.utoronto.ca) of any */
/* modifications to or errors in these routines. */
/* Mailing Address: T.F. Fairgrieve, Department of Computer Science, */
/* University of Toronto, Toronto, Ontario, CANADA M5S 1A4C */
/* ----------------------------------------------------------------------- */
/* ----------------------------------------------------------------------- */
/* Routines included in this file: */

/* subroutine flowkm : new routine to compute floquet multipliers */
/* subroutine dhhpr : compute a Householder matrix */
/* subroutine dhhap : appy a Householder matrix */
/* ----------------------------------------------------------------------- */
/* ----------------------------------------------------------------------- */
/* Required library routines (included in the file eispack.f) : */

/* subroutine qzhes : QZ reduction to Hessenberg form (EISPACK)*/
/* subroutine qzit : QZ reduction to quasi-upper triangular form (EISPACK)*/
/* subroutine qzval : QZ calculation of eigenvalues (EISPACK)*/
/* function epslon : machine constant routine (EISPACK)*/
/* ----------------------------------------------------------------------- */
/* ----------------------------------------------------------------------- */
/* function dnrm2 : compute l2-norm of a vector (BLAS-1)*/
/* function ddot : dot product of two vectors (BLAS-1)*/
/* subroutine dscal : scale a vector by a constant (BLAS-1)*/
/* function idamax : find index of element with max abs value (BLAS-1)*/
/* subroutine daxpy : constant times a vector plus a vector (BLAS-1)*/
/* subroutine drot : apply a plane rotation (BLAS-1)*/
/* subroutine dswap : swap two vectors (BLAS-1)*/
/* ----------------------------------------------------------------------- */
/* ----------------------------------------------------------------------- */
/* subroutine dgemc : matrix-matrix copy */
/* subroutine xerbla : BLAS error handling routine (BLAS-2)*/
/* function lsame : compare character strings (BLAS-2)*/
/* ----------------------------------------------------------------------- */
/* ----------------------------------------------------------------------- */
/* subroutine dgemm : matrix-matrix multiply (BLAS-3)*/
/* ----------------------------------------------------------------------- */
/* ----------------------------------------------------------------------- */
/* subroutines ezsvd, ndrotg, ndsvd, prse, sig22, sigmin, sndrtg : */
/* Demmel-Kahan svd routines */
/* ----------------------------------------------------------------------- */
/* ----------------------------------------------------------------------- */


($AUTO)/include/auto_c.h
ほどんどの関数の定義.

...
doublereal dnrm2(integer n, doublereal *dx, integer *incx);
doublereal ddot(integer n, doublereal *dx, integer *incx, doublereal *dy, integer *incy);
...

($AUTO)/src/eispack.c
auto_c.h で定義された関数の一部の実装.

/* eispack.f -- translated by f2c (version 19970805).
You must link the resulting object file with the libraries:
-lf2c -lm (in that order)

AUTO on Mac のエラー

Mac で AUTO を実行しようとした時に起きたエラーの解決策.


エラー 1 : /usr/bin/ld: Undefined symbols : _main

$ auto
AUTO> ld("ab")
AUTO> run()
make: [ab.o] Error 1 (ignored)
...
/usr/bin/ld: Undefined symbols:
_main
collect2: ld returned 1 exit status
make: [ab.exe] Error 1 (ignored)
make: ./ab.exe: Command not found
make: [run] Error 127 (ignored)
..




とりあえずの解決法
次のように Makefile を編集し,make した後で auto を実行すると解決する.

Makefile の編集.


EXE = $(PGM).exe
の行を,
EXE = ./$(PGM).exe
と書き直す.



解決法(AUTO のコマンドをいじる)
失敗時(AUTO> run() でのコンパイルメッセージ)

gcc -D_THREAD_SAFE -DPTHREADS -O -I/Users/hoge/prog/auto/include -c ab.c
gcc -D_THREAD_SAFE -DPTHREADS -O -I/Users/hoge/prog/auto/include ab.o -o ab.exe -L/Users/hoge/prog/auto/lib -lauto -lauto_f2c -lm
成功時($ make でのコンパイルメッセージ)

gcc -pthread -DPTHREADS -O -I/Users/hoge/prog/auto/include -c -o ab.o ab.c
gcc -pthread -DPTHREADS -O -I/Users/hoge/prog/auto/include ab.o -o ab.exe /Users/hoge/prog/auto/lib/*.o -L/Users/hoge/prog/auto/lib -lauto_f2c -lm

を比べると,
/Users/hoge/prog/auto/lib*.o を読み込んでいないのが,エラーの原因であることが分かる.

AUTO> run() をした時に,実行されている make のための Makefile は,
$(AUTO_DIR)/cmds/cmds.make を使っているらしいので,
このファイルの LIBS に,$(AUTO_DIR)/lib/*.o を追加する.
20行めくらい?

LIBS = -L$(AUTO_DIR)/lib -lauto -lauto_f2c -lm
↓編集後
LIBS = $(AUTO_DIR)/lib/*.o -L$(AUTO_DIR)/lib -lauto -lauto_f2c -lm




エラー 2 : plot できず?

これは,他のが原因だったかもしれない.
一応,これだけはやっておいたらいいかも.

$ python
>>> import Tkinter


以下,おそらく不要.
tkinter のインストール
http://people.ucsc.edu/~jacobkm/tkinter_osx_howto.html

1. Install Fink.
2. Add "unstable/main" to the "Trees:" line in /sw/etc/fink.conf
3. From the command line:

[localhost:~] jacob% fink selfupdate
(say yes to "packages from CVS")
[localhost:~] jacob% fink install xfree86-base (なし)
[localhost:~] jacob% fink install xfree86-rootless (なし)
[localhost:~] jacob% fink install windowmaker
[localhost:~] jacob% fink install python (2.5 をインストール? 2.3 以下じゃないと,AUTO 動作に問題あるらしいので,在れば不要)

4. Make sure XDarwin is running (run /Aplications/XDarwin)
5. From the command line:

[localhost:~] jacob% python
>>> import Tkinter
>>> #YAY!

AUTO の出力

fort.7 (=> b.hoge) :安定性の交代,分岐点の種類が見易い.
fort.8 (=> s.hoge):軌道の座標.
fort.9 (=> d.hoge):固有値,L2-norm, max(1) max(2), period

autlib1.c の,wrtbv8 内で出力


軌道の空間座標値は,ups[j][k] (0 <= j < ntst),(0 <= k < ncol) 内にある.

fort.8

4 30 4 6 2 1 201 3 412 50 4 50 ← *0
0.0000000000E+00 8.4126672680E-01 5.2580555883E+00 ← *1-A
...
9.9862932262E-01 8.3118721821E-01 5.1313960895E+00
9.9931466131E-01 8.3612426003E-01 5.1933992065E+00 ← *1-B
1.0000000000E+00 8.4126672680E-01 5.2580555883E+00 ← *2
1 10 ← *3
-4.6120475941E-03 1.5955207440E+00 ← *4-A
-1.5890722484E-01 -6.7386091320E-02
-1.5003073620E-01 4.9295602685E-02
-1.4041373599E-01 1.7584396443E-01
-1.3000897365E-01 3.1288396581E-01
-1.1877311309E-01 4.6098383219E-01
...

autlib1.c

wrtbv8(iap_type *iap, rap_type *rap, doublereal *par, integer *icp, doublereal *rldot, integer *ndxloc, doublereal **ups, doublereal **udotps, doublereal *tm, doublereal *dtm)
{
...
  fprintf(fp8,"%5ld",ibr); // *0 
  fprintf(fp8,"%5ld",mtot);
  fprintf(fp8,"%5ld",itp);
  fprintf(fp8,"%5ld",lab);
  fprintf(fp8,"%5ld",nfpr);
  fprintf(fp8,"%5ld",isw);
  fprintf(fp8,"%5ld",ntpl);
  fprintf(fp8,"%5ld",nar);
  fprintf(fp8,"%7ld",nrowpr);
  fprintf(fp8,"%5ld",ntst);
  fprintf(fp8,"%5ld",ncol);
  fprintf(fp8,"%5d\n",NPARX); // *0

for(j = 0; j < ntst; ++j){ //NTST(メッシュ区間数)in c.xxx 
  rn = 1. / ncol;
  for(i = 0; i < ncol; ++i){  //NCOL(区間内点数)in c.xxx
    k1 = i * ndim;
    k2 = (i + 1) * ndim;
    t = tm[j] + i * rn * dtm[j];
    fprintf(fp8,"    %19.10E",t);
    for(k = k1; k < k2; ++k){
      ...
      fprintf(fp8,"%19.10E",ups[j][k]);  // *1 (A-B)
    }
    fprintf(fp8, "\n");
  }
}
fprintf(fp8,"    %19.10E",tm[ntst]);  // *2 の 1つめ
for(i = 0; i < ndim; ++9){
  ...
   fprintf(fp8,"%19.10E",ups[ntst][i]); // *2 の2つめ以降
}
fprintf(fp8,"\n");
/* Write the free parameter indices: */
  for (i = 0; i < nfpr; ++i) {
    fprintf(fp8,"%5ld",icp[i]); // *3 
  }
  fprintf(fp8,"\n");  
    

/* Write the direction of the branch: */
  fprintf(fp8,"    ");
  for (i = 0; i < nfpr; ++i) {
    if((i>0)&&((i)%7==0)){
      fprintf(fp8,"\n    ");
    }
    fprintf(fp8,"%19.10E",rldot[i]);  // *4 A-
  }
  fprintf(fp8,"\n");  

AUTO から,shooting point を得る.

wrtbv8(iap_type *iap, rap_type *rap, doublereal *par, integer *icp, doublereal *rldot, integer *ndxloc, doublereal **ups, doublereal **udotps, doublereal *tm, doublereal *dtm)
{
...
  mtot = ntot % 10000;
  fprintf(fp8,"%5ld",ibr);
  fprintf(fp8,"%5ld",mtot);
  fprintf(fp8,"%5ld",itp);
  fprintf(fp8,"%5ld",lab);
  fprintf(fp8,"%5ld",nfpr);
  fprintf(fp8,"%5ld",isw);
  fprintf(fp8,"%5ld",ntpl);
  fprintf(fp8,"%5ld",nar);
  fprintf(fp8,"%7ld",nrowpr);
  fprintf(fp8,"%5ld",ntst);
  fprintf(fp8,"%5ld",ncol);
  fprintf(fp8,"%5d\n",NPARX);

  // この下を追記.  
 // LABEL XXX の時のメッシュ点を splXXX.dat を出力する. 
  //========================================================
  // uniker : output the data of the orbit
  // ntst hooting points are got from AUTO
  // v[0],..., v[ntst-1]
  // v[ntst] sim v[0]
  char char_fname_sp[20];
  sprintf(char_fname_sp, "spl%03d.dat", mtot);
  FILE *fsp=fopen(char_fname_sp,"w");
  if(fsp == NULL) {
    printf("# ERROR: Could not open spXXX.dat");
    abort();
  }

  double period = par[10]; 
  //tm[j] in [0.0, 1.0]
  double s_j; // in [0.0, T]
  double h_j; // = s[j+1] - s[j]
  for (j = 0; j < ntst; ++j) {
    s_j = period*tm[j];
    h_j = period*(tm[j+1] - tm[j]); 
    fprintf(fsp,"    %ld", j);
    fprintf(fsp,"%19.10E", tm[j]);
    fprintf(fsp,"%19.10E", s_j);
    fprintf(fsp,"%19.10E", h_j);
    for (i = 0; i < ndim; ++i) {
      fprintf(fsp,"%19.10E", ups[j][i]);
    }
    fprintf(fsp,"\n");  
  }  

  s_j = period*tm[ntst]; // period*1.0
  h_j = period - s_j;  // 0.0 
  fprintf(fsp,"    %ld", ntst);
  fprintf(fsp,"%19.10E", tm[ntst]);
  fprintf(fsp,"%19.10E", s_j);
  fprintf(fsp,"%19.10E", h_j);
  for (i = 0; i < ndim; ++i) {
    fprintf(fsp,"%19.10E", ups[ntst][i]);
  }
  fprintf(fsp,"\n");  
  //========================================================
 // ここまで.この後は,元々の処理が続く
 
  /* Write the entire solution on unit 8 : */
  for (j = 0; j < ntst; ++j) {
    rn = 1. / ncol;
    for (i = 0; i < ncol; ++i) {
      k1 = i * ndim;
      k2 = (i + 1) * ndim;
      t = tm[j] + i * rn * dtm[j];
      fprintf(fp8,"    %19.10E",t);
      ...

なお,ups の中身は,以下のようになっている.

  // example
  // dimension = 2
  // 0<= j < ntst
  // (ncol-1) interpolated points
  //ups[j][0] // j_0 
  //ups[j][1]

  //ups[j][2] // j_1  
  //ups[j][3]
  //...
  //ups[j][(ncol-1)*dim]  // j_{ncol-1} 
  //ups[j][(ncol-1)*dim + 1] 
  
  //ups[j+1][0]
  //ups[j+1][1]
  //...
  //ups[ntst][0]
  //ups[ntst][1]

AUTO の流れ:continuation は,extrbv stupbv stplbv (adapt) -> extrbv を反復しながら行っている.


main.c main

autlib1.c autoae -> cnrlae

//Generate the starting point
stpnt
pvli

newlab //Determine a suitable starting label and branch number
sthd //Write constants
stplae //Write plotting data for the starting point
stprae //Starting procedure (to get second point on first branch)
swpnt //Initialize computation of the next bifurcating branch

stplae //Store plotting data for first point on the bifurcating branch
swprc //Determine the second point on the bifurcating branch
stplae //Store plotting data for second point

contae //Provide initial approximation to the next point on the branch
solvae //Find the next solution point on the branch

lcspae //Check for user supplied parameter output parameter-values

main

-> autobv (if(list.type==AUTOBV) list.type は,set_function_pointers 内で,iap の値で決定される.)

-> cnrlbv

-> rsptbv, setrtn, stdrbv, sthd, stplbv, extrbv

Ex1 : c=ab.1

AUTO > run(c="ab.1")
Starting ab ...
# call autoae
# call sthd

BR PT TY LAB PAR(1) L2-NORM U(1) U(2)
1 1 EP 1 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00
1 33 LP 2 1.057390E-01 1.484391E+00 3.110230E-01 1.451441E+00
...


Ex2 : c="ab.2"

AUTO> run(c="ab.2",s="ab1")
Starting ab ...
# call autobv
# call cnrlbv
# call rsptbv
# call STPNT_TYPE_BVP(*stpnt) in rsptbv
# call stpnps
# call funi in stpnps
# call setrtn
# call sthd (output to fort.7)
# call stplbv (output to fort.8)

BR PT TY LAB PAR(1) L2-NORM MAX(1) MAX(2) PERIOD
# call extrbv
# call stplbv
# call extrbv
# call stupbv
# call stplbv
# call adapt
# call extrbv
# call stupbv
# call stplbv
# call extrbv
# call stupbv
# call stplbv
# call extrbv
# call stupbv
...
# call extrbv
# call stupbv
# call stplbv
4 30 6 1.198815E-01 3.987129E+00 9.919113E-01 7.020342E+00 2.721044E+00
# call adapt
# call extrbv
# call stupbv


stplbv -> wrtbv8 を呼んで, fort.8 に軌道座標を出力している.

軌道の座標は,rsptbv 内で計算して ups 内に保存している.

rsptbv

-> STPNT_TYPE_BVP( (*stpnt) ), adapt, stupbv


sthd では,fort.7 に出力.

continuation は,extrbv stupbv stplbv (adapt) -> extrbv を反復しながら行っている.

STPNT_TYPE_BVP in auto_c.h

/* This is the type for all functions that can be used at starting points
for BVPs */
#define STPNT_TYPE_BVP(X) int X(iap_type *iap, rap_type *rap, doublereal *par, integer *icp, integer *ntsrs, integer *ncolrs, doublereal *rlcur, doublereal *rldot, integer *ndxloc, doublereal **ups, doublereal **udotps, doublereal **upoldp, doublereal *tm, doublereal *dtm, integer *nodir, doublereal *thl, doublereal *thu)
...
//autlib1.c
STPNT_TYPE_BVP(stpnbv);
STPNT_TYPE_BVP(stpnub);
...

//autlib3.c
STPNT_TYPE_BVP(stpnps);
STPNT_TYPE_BVP(stpnpo);
STPNT_TYPE_BVP(stpnbl);


adapt

-> newmsh interp


c.ab.2 では, stpnps が呼ばれる.

stpnps

-> findlb, readlb, funi, scaleb

パラメータ変更毎に,istop==1 となれば L5 に飛んで stplae で,出力している.

istop は,

lcspae 終了後の iap->istop で更新される.

lcspae は,

Check for user supplied parameter output parameter-values

Check for fold

Check for branch point

Check for Hopf bifurcation

のために呼ばれる.

lcspae

Detection of Singular Points
// This subroutine uses the secant method to accurately locate special
// points (branch points, folds, Hopf bifurcations, user zeroes).
// These are characterized as zeroes of the function FNCS supplied in the call.

// This subroutine calls CONT and SOLVAE with varying stepsize RDS.
// The special point is assumed to have been found with sufficient
// accuracy if the ratio between RDS and the user supplied value of
// DS is less than the user-supplied toler du.
...

lcspae は,FNCS_TYPE_AE( (* fncs) ) を引数にしており,内部で次を実行する.

  q1 = (*fncs)(iap, rap, par, icp, &chng, funi, m1aaloc, 
aa, rlcur, rlold, rldot, u, uold, udot,
rhs, dfdu, dfdp, iuz, vuz);

FNCS_TYPE_AE は,auto_c.h 内で次のように定義されている.

/*This is the type for all functions which can be used to detect
special points for algebraic problems */
#define FNCS_TYPE_AE(X) doublereal X(iap_type *iap, rap_type *rap, doublereal *par, integer *icp, logical *chng, FUNI_TYPE( (*funi) ), integer *m1aaloc, doublereal **aa, doublereal *rlcur, doublereal *rlold, doublereal *rldot, doublereal *u, doublereal *uold, doublereal *udot, doublereal *rhs, doublereal *dfdu, doublereal *dfdp, integer *iuz, doublereal *vuz)

...

// それぞれ,fp9 への出力を担う.
FNCS_TYPE_AE(fnbpae); // BP Function

FNCS_TYPE_AE(fnlpae); // Fold Function
FNCS_TYPE_AE(fnhbae); // Hopf Function,Eigenvalues
FNCS_TYPE_AE(fnuzae); // User Func.


fnbpae in autlib1.c は次のようなもの.

doublereal 
fnbpae(iap_type *iap, rap_type *rap, doublereal *par, integer *icp, logical *chng, FUNI_TYPE( (*funi) ), integer *m1aaloc, doublereal **aa, doublereal *rlcur, doublereal *rlold, doublereal *rldot, doublereal *u, doublereal *uold, doublereal *udot, doublereal *rhs, doublereal *dfdu, doublereal *dfdp, integer *iuz, doublereal *vuz)
{
/* System generated locals */
doublereal ret_val;

/* Local variables */
integer ntop, ntot, iid, ibr;
doublereal det;



iid = iap->iid;
ibr = iap->ibr;
ntot = iap->ntot;
ntop = (ntot + 1) % 10000;

det = rap->det;
ret_val = det;
*chng = TRUE_;

/* If requested write additional output on unit 9 : */

if (iid >= 2 && iap->mynode == 0) {
fprintf(fp9,"%4li%6li BP Function %14.5E\n",ibr,ntop,ret_val);
}

return ret_val;
} /* fnbpae_ */

iap は,次のような型 iap_type の変数である.

typedef struct {
/* 1 */ integer ndim;
/* 2 */ integer ips;
/* 3 */ integer irs;
/* 4 */ integer ilp;
/* 5 */ integer ntst;
/* 6 */ integer ncol;
/* 7 */ integer iad;
/* 8 */ integer iads;
/* 9 */ integer isp;
/* 10 */ integer isw;
/* 11 */ integer iplt;
/* 12 */ integer nbc;
/* 13 */ integer nint;

#ifdef MANIFOLD
/* 13a*/ integer nalc; /* The number of arclength constraints (k) */
#endif
/* 14 */ integer nmx;
/* 15 */ integer nuzr;
/* 16 */ integer npr;
/* 17 */ integer mxbf;
/* 18 */ integer iid;
/* 19 */ integer itmx;
/* 20 */ integer itnw;
/* 21 */ integer nwtn;
/* 22 */ integer jac;
/* 23 */ integer ndm;
/* 24 */ integer nbc0;
/* 25 */ integer nnt0;
/* 26 */ integer iuzr;
/* 27 */ integer itp;
/* 28 */ integer itpst;
/* 29 */ integer nfpr;
/* 30 */ integer ibr;
/* 31 */ integer nit;
/* 32 */ integer ntot;
/* 33 */ integer nins;
/* 34 */ integer istop;
/* 35 */ integer nbif;
/* 36 */ integer ipos;
/* 37 */ integer lab;
/* 41 */ integer nicp;
/* The following are not set in init_.

They have to do with the old parallel version. */
/* 38 */ integer mynode;
/* 39 */ integer numnodes;
/* 40 */ integer parallel_flag;
} iap_type;

これは,main 文の中で init 関数を用いて初期かされるが,

init 自体は,autlib1.c 内で次のように定義されている.

init(iap_type *iap, rap_type *rap, doublereal *par, integer *icp, doublereal *thl, doublereal **thu_pointer, integer **iuz_pointer, doublereal **vuz_pointer, logical *eof,integer nalc)
{
...




main 内 solvae で数値積分? FUNI_TYPE( (*funi) ) を引数にしており,

内部で,実行している.

(*funi)(iap, rap, ndim, u, uold, icp, par, 2, f, dfdu, dfdp);

FUNI_TYPE の定義 in auto_c.h

/*This is the type for all functions which can be used as "funi" the function
which evaluates the right hand side of the equations and generates

the Jacobian*/
#define FUNI_TYPE(X) int X(const iap_type *iap, const rap_type *rap, integer ndim, doublereal *u, const doublereal *uold, const integer *icp, doublereal *par, integer ijac, doublereal *f, doublereal *dfdu, doublereal *dfdp)

...

typedef struct {
FUNI_TYPE( (*funi) );
STPNT_TYPE_AE( (*stpnt) );
PVLI_TYPE_AE( (*pvli) );
} autoae_function_list;

typedef struct {
int type;
autobv_function_list bvlist;
autoae_function_list aelist;
} function_list;
...

/* autlib3.c */
FUNI_TYPE(fnlp);
STPNT_TYPE_AE(stpnlp);
FUNI_TYPE(fnc1);
STPNT_TYPE_AE(stpnc1);
FUNI_TYPE(fnc2);
STPNT_TYPE_AE(stpnc2);
FUNI_TYPE(fnds);
FUNI_TYPE(fnti);
FUNI_TYPE(fnhd);
STPNT_TYPE_AE(stpnhd);
FUNI_TYPE(fnhb);
STPNT_TYPE_AE(stpnhb);
FUNI_TYPE(fnhw);
STPNT_TYPE_AE(stpnhw);
FUNI_TYPE(fnps);
BCNI_TYPE(bcps);
ICNI_TYPE(icps);

int pdble(const iap_type *iap, const rap_type *rap, integer *ndim, integer *ntst, integer *ncol, integer *ndxloc, doublereal **ups, doublereal **udotps, doublereal *tm, doublereal *par);
STPNT_TYPE_BVP(stpnps);
FUNI_TYPE(fnws);
FUNI_TYPE(fnwp);
int stpnwp(iap_type *iap, rap_type *rap, doublereal *par, integer *icp, integer *ntsr, integer *ncolrs, doublereal *rlcur, doublereal *rldot, integer *ndxloc, doublereal **ups, doublereal **udotps, doublereal **upoldp, doublereal *tm, doublereal *dtm, integer *nodir, doublereal *thl, doublereal *thu);
FUNI_TYPE(fnsp);
FUNI_TYPE(fnpe);
ICNI_TYPE(icpe);
FUNI_TYPE(fnpl);
BCNI_TYPE(bcpl);
ICNI_TYPE(icpl);
int stpnpl(iap_type *iap, rap_type *rap, doublereal *par, integer *icp, integer *ntsr, integer *ncolrs, doublereal *rlcur, doublereal *rldot, integer *ndxloc, doublereal **ups, doublereal **udotps, doublereal **upoldp, doublereal *tm, doublereal *dtm, integer *nodir, doublereal *thl, doublereal *thu);
FUNI_TYPE(fnpd);
BCNI_TYPE(bcpd);
ICNI_TYPE(icpd);
int stpnpd(iap_type *iap, rap_type *rap, doublereal *par, integer *icp, integer *ntsr, integer *ncolrs, doublereal *rlcur, doublereal *rldot, integer *ndxloc, doublereal **ups, doublereal **udotps, doublereal **upoldp, doublereal *tm, doublereal *dtm, integer *nodir, doublereal *thl, doublereal *thu);
FUNI_TYPE(fntr);

int bctr(const iap_type *iap, const rap_type *rap, integer ndim, doublereal *par, const integer *icp, integer nbc, const doublereal *u0,const doublereal *u1, doublereal *f, integer ijac, doublereal *dbc);
ICNI_TYPE(ictr);

int stpntr(iap_type *iap, rap_type *rap, doublereal *par, integer *icp, integer *ntsr, integer *ncolrs, doublereal *rlcur, doublereal *rldot, integer *ndxloc, doublereal **ups, doublereal **udotps, doublereal **upoldp, doublereal *tm, doublereal *dtm, integer *nodir, doublereal *thl, doublereal *thu);
FUNI_TYPE(fnpo);
BCNI_TYPE(bcpo);
ICNI_TYPE(icpo);
STPNT_TYPE_BVP(stpnpo);
FUNI_TYPE(fnbl);
BCNI_TYPE(bcbl);
ICNI_TYPE(icbl);
STPNT_TYPE_BVP(stpnbl);
FUNI_TYPE(funi);
BCNI_TYPE(bcni);
ICNI_TYPE(icni);
...


で,funi は autlib3.c の 4363 行目から定義されている.

/* ----------------------------------------------------------------------- */
/* ----------------------------------------------------------------------- */
/* Routines for Interface with User Supplied Routines */

/* (To generate Jacobian by differencing, if not supplied analytically) */
/* ----------------------------------------------------------------------- */
/* ----------------------------------------------------------------------- */

/* ---------- ---- */
/* Subroutine */ int
funi(const iap_type *iap, const rap_type *rap, integer ndim, doublereal *u, const doublereal *uold, const integer *icp, doublereal *par, integer ijac, doublereal *f, doublereal *dfdu, doublereal *dfdp)
{
...
user.func(ndim, u, icp, par, ijc, f, dfdu, dfdp);
...
user.func(ndim, u, icp, par, 0, f1zz, dfdu, dfdp);
...

この中で,ユーザー定義の func が実行されている.

user は, user_function_list 型の変数で,

auto_f2c.h 内で,次のように定義されている.

const user_function_list user = { func, stpnt, bcnd, icnd, fopt, pvls, 0 };

この,func, stpnt, bcnd, icnd, fopt, pvls がユーザー定義の関数与える.

function_list は,main.c 内 main 関数の中で次のように初期化されている.

...
function_list list 
...
set_function_pointers(iap,&list);

set_function_pointers は次のようになっている.(autlib1.c)

int set_function_pointers(const iap_type iap,function_list *data) {
if ( (iap.ips == 0 || iap.ips == 1) && abs(iap.isw) != 2) {
/* ** Algebraic systems. */

if (iap.irs == 0) {
data->type = AUTOAE;
data->aelist.funi = funi;
data->aelist.stpnt = stpnus;
data->aelist.pvli = pvlsae;
} else {
data->type = AUTOAE;
data->aelist.funi = funi;
data->aelist.stpnt = stpnae;
data->aelist.pvli = pvlsae;
}
} else if (iap.ips == 11 && abs(iap.isw) != 2) {
/* ** Waves : Spatially homogeneous solutions, */

if (iap.irs == 0) {
data->type = AUTOAE;
...

imagemagick のインストール

http://www.ishihara.ne.jp/blog/archives/2006/10/index.html より転載


$ fink install libjpeg
$ fink install libpng3

1. ImageMagickソースコード一式を以下のサイトより取得(今回は ImageMagick-6.3.0)
http://www.imagemagick.org/script/download.php

2. tarballを解凍、展開したら、以下の手順でconfigureする


$ export CPPFLAGS="-I/sw/include"
$ export LDFLAGS="-L/sw/lib"
$ ./configure --enable-lzw=yes

3. コンパイルとインストール
configureの最後でJPEG v1 --with-jpeg=yes yesと出力されているのを確認して、コンパイルとインストールを実施


$ make
$ sudo make install

Mac 用 gnuplot でタブ補完を可能にする.


Fink 使用の場合
http://d.hatena.ne.jp/nkmrtkhd/searchdiary?word=%A5%D5%A5%A1%A5%A4%A5%EB より引用


/sw/fink/10.4/stable/main/finkinfo/sci/gnuplot.info のコンパイルパラメーター(ConfigureParams: 以下)に


--with-readline=gnu --enable-history-file

をつけてインストール。

成功!
ばっちりreadlineが使える。
すでにインストールしてあるときは、先のオプションを追加して


$ fink rebuild gnuplot
$ fink install gnuplot
とすればいい。



MacPorts 使用の場合.

最初から可能?
以下,できなければこうやればいいんじゃないかというメモ.


$ sudo port edit gnuplot
として,


...
configure.args --with-readline=gnu --enable-history-file \
--with-gd --with-png --with-pdf --with-x \
--enable-datastrings --enable-histograms \
--infodir='\${prefix}/share/info' \
--mandir='\${prefix}/share/man' \
--disable-wxwidgets
...
のように,configure.args のところに
 --with-readline=gnu --enable-history-file
を加えた後,install する.


port edit gnuplot を実行した時に,


Error: No EDITOR is specified in your environment
というエラーがでた場合は,

$export EDITOR="emacs"
等としてからやり直し.