/[ascend]/trunk/base/generic/packages/sensitivity.c
ViewVC logotype

Diff of /trunk/base/generic/packages/sensitivity.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 88 by aw0a, Thu Dec 9 18:22:50 2004 UTC revision 89 by johnpye, Wed Dec 7 15:44:43 2005 UTC
# Line 63  Line 63 
63   * this will give us dy/dx.   * this will give us dy/dx.
64   */   */
65    
66    #if 0
67  static real64 *zero_vector(real64 *vec, int size)  static real64 *zero_vector(real64 *vec, int size)
68  {  {
69    int c;    int c;
# Line 71  static real64 *zero_vector(real64 *vec, Line 72  static real64 *zero_vector(real64 *vec,
72    }    }
73    return vec;    return vec;
74  }  }
75    #endif
76    
77  static real64 **make_matrix(int nrows, int ncols)  static real64 **make_matrix(int nrows, int ncols)
78  {  {
# Line 161  static slv_system_t PreSolve(struct Inst Line 163  static slv_system_t PreSolve(struct Inst
163  #endif  #endif
164    return sys;    return sys;
165  }  }
166    
167    #if 0
168  static int ReSolve(slv_system_t sys)  static int ReSolve(slv_system_t sys)
169  {  {
170    if (!sys)    if (!sys)
# Line 169  static int ReSolve(slv_system_t sys) Line 172  static int ReSolve(slv_system_t sys)
172    slv_solve(sys);    slv_solve(sys);
173    return 0;    return 0;
174  }  }
175    #endif
176    
177  static int DoSolve(struct Instance *inst)  static int DoSolve(struct Instance *inst)
178  {  {
# Line 195  int do_solve_eval(struct Slv_Interp *slv Line 199  int do_solve_eval(struct Slv_Interp *slv
199    int result;    int result;
200    struct Instance *inst;    struct Instance *inst;
201    len = gl_length(arglist);    len = gl_length(arglist);
202    
203      /* Ignore unused params */
204      (void)slv_interp; (void)i; (void)whichvar;
205    
206    if (len!=2) {    if (len!=2) {
207      FPRINTF(stdout,"Wrong number of args to do_solve_eval\n");      FPRINTF(stdout,"Wrong number of args to do_solve_eval\n");
208      return 1;      return 1;
# Line 312  int do_finite_diff_eval(struct Slv_Inter Line 320  int do_finite_diff_eval(struct Slv_Inter
320               struct gl_list_t *arglist,               struct gl_list_t *arglist,
321               unsigned long whichvar)               unsigned long whichvar)
322  {  {
323      /* Ignore unused params */
324      (void)slv_interp; (void)i; (void)whichvar;
325    
326    int result;    int result;
327    if (FiniteDiffCheckArgs(arglist))    if (FiniteDiffCheckArgs(arglist))
328      return 1;      return 1;
# Line 605  static int Compute_dy_dx_smart(slv_syste Line 616  static int Compute_dy_dx_smart(slv_syste
616    if (solution) ascfree((char *)solution);    if (solution) ascfree((char *)solution);
617    return 0;    return 0;
618  }  }
619    
620    #if 0
621  static int ComputeInverse(slv_system_t sys,  static int ComputeInverse(slv_system_t sys,
622                real64 *rhs)                real64 *rhs)
623  {  {
# Line 638  static int ComputeInverse(slv_system_t s Line 650  static int ComputeInverse(slv_system_t s
650    if (solution) ascfree((char *)solution);    if (solution) ascfree((char *)solution);
651    return 0;    return 0;
652  }  }
653    #endif
654    
   
655  int sensitivity_anal(struct Slv_Interp *slv_interp,  int sensitivity_anal(struct Slv_Interp *slv_interp,
656               struct Instance *inst, /* not used but will be */               struct Instance *inst, /* not used but will be */
657               struct gl_list_t *arglist)               struct gl_list_t *arglist)
# Line 648  int sensitivity_anal(struct Slv_Interp * Line 660  int sensitivity_anal(struct Slv_Interp *
660    struct gl_list_t *branch;    struct gl_list_t *branch;
661    struct var_variable **vlist = NULL;    struct var_variable **vlist = NULL;
662    int *inputs_ndx_list = NULL, *outputs_ndx_list = NULL;    int *inputs_ndx_list = NULL, *outputs_ndx_list = NULL;
663    real64 **dy_dx;    real64 **dy_dx = NULL;
664    slv_system_t sys = NULL;    slv_system_t sys = NULL;
665    unsigned long c;    int c;
666    int noutputs,ninputs;    int noutputs = 0;
667      int ninputs;
668    int i,j;    int i,j;
669    int offset;    int offset;
670    dof_t *dof;    dof_t *dof;
671    int num_vars,ind,found;    int num_vars,ind,found;
672    
673      /* Ignore unused params */
674      (void)slv_interp; (void) inst;
675    
676    linsolqr_system_t lqr_sys;    /* stuff for the linear system & matrix */    linsolqr_system_t lqr_sys;    /* stuff for the linear system & matrix */
677    mtx_matrix_t mtx;    mtx_matrix_t mtx;
678    int32 capacity;    int32 capacity;
679    real64 *scratch_vector = NULL;    real64 *scratch_vector = NULL;
680    int result=0;    int result=0;
681    
682    
683    (void)NumberFreeVars(NULL);       /* used to re-init the system */    (void)NumberFreeVars(NULL);       /* used to re-init the system */
684    (void)NumberRels(NULL);       /* used to re-init the system */    (void)NumberRels(NULL);       /* used to re-init the system */
685    which_instance = FetchElement(arglist,1,1);    which_instance = FetchElement(arglist,1,1);
# Line 866  static int DoDataAnalysis(struct var_var Line 883  static int DoDataAnalysis(struct var_var
883    fclose(fp);    fclose(fp);
884    return 0;    return 0;
885  }  }
886    
887    #if 0
888  static int DoProject_X(struct var_variable **old_inputs,  static int DoProject_X(struct var_variable **old_inputs,
889                 struct var_variable **new_inputs, /* new values of u */                 struct var_variable **new_inputs, /* new values of u */
890                 double step_length,                 double step_length,
# Line 899  static int DoProject_X(struct var_variab Line 917  static int DoProject_X(struct var_variab
917      new_y = old_y + step_length*tmp;      new_y = old_y + step_length*tmp;
918      /*    SetRealAtomValue(var,new_y,(unsigned)0);  */      /*    SetRealAtomValue(var,new_y,(unsigned)0);  */
919      var_set_value(var,new_y);      var_set_value(var,new_y);
920  #if  DEBUG  # if  DEBUG
921      FPRINTF(stderr,"Old_y = %12.8g; Nex_y = %12.8g\n",old_y,new_y);      FPRINTF(stderr,"Old_y = %12.8g; Nex_y = %12.8g\n",old_y,new_y);
922  #endif  #\endif
923    }    }
924    ascfree((char *)delta_x);    ascfree((char *)delta_x);
925    return 0;    return 0;
926  }  }
927    #endif
928    
929    
930  /*  /*
# Line 937  int sensitivity_anal_all(struct Slv_Inte Line 956  int sensitivity_anal_all(struct Slv_Inte
956    dof_t *dof;    dof_t *dof;
957    struct var_variable **inputs = NULL, **outputs = NULL;    struct var_variable **inputs = NULL, **outputs = NULL;
958    int *inputs_ndx_list = NULL, *outputs_ndx_list = NULL;    int *inputs_ndx_list = NULL, *outputs_ndx_list = NULL;
959    real64 **dy_dx;    real64 **dy_dx = NULL;
960    struct var_variable **vp,**ptr;    struct var_variable **vp,**ptr;
961    slv_system_t sys = NULL;    slv_system_t sys = NULL;
962    unsigned long c;    long c;
963    int noutputs,ninputs;    int noutputs=0, ninputs;
964    var_filter_t vfilter;    var_filter_t vfilter;
965    
966      /* Ignore unused params */
967      (void)slv_interp; (void)inst; (void)step_length;
968    
969    struct var_variable **new_inputs = NULL; /* optional stuff for variable    struct var_variable **new_inputs = NULL; /* optional stuff for variable
970                        * projection */                        * projection */
971    

Legend:
Removed from v.88  
changed lines
  Added in v.89

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22