IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 16059


Ignore:
Timestamp:
Jan 14, 2008, 1:50:11 PM (18 years ago)
Author:
eugene
Message:

convert to new gauss-jordan code (non-Press); fixing Wall,Werror warnings; fixed bug in shell command; fixed bug in matrix element lookup

Location:
trunk/Ohana/src/opihi
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/cmd.astro/multifit.c

    r8297 r16059  
    141141    }
    142142  }
    143   dgaussj (a, Ndim, b, 1);
     143  dgaussjordan (a, b, Ndim, 1);
    144144
    145145  Ny = 0;
  • trunk/Ohana/src/opihi/cmd.basic/shell.c

    r15868 r16059  
    11# include "basic.h"
     2
     3static char *defshell = "/bin/sh";
     4static char *cmdflag = "-c";
    25
    36int shell (int argc, char **argv) {
     
    69  int exit_status;
    710  int wait_status;
    8   int result;
    9   char **args;
     11  int result, length;
     12  char **args, *shell;
    1013
    11   ALLOCATE (args, char *, argc);
     14  shell = getenv ("SHELL");
     15  if (shell == NULL) shell = defshell;
     16
     17  // we are creating a command of the form /bin/sh -c argv[1] argv[2] etc, where
     18  // the argv[1], etc elements are concatenated into a single string
     19  ALLOCATE (args, char *, 4);
     20  args[0] = shell;
     21  args[1] = cmdflag;
     22
     23  length = 0;
    1224  for (i = 1; i < argc; i++) {
    13     args[i-1] = argv[i];
     25    length += strlen(argv[i]) + 1;
    1426  }
    15   args[i-1] = NULL;
     27 
     28  ALLOCATE (args[2], char, length);
     29  args[2][0] = 0;
     30  for (i = 1; i < argc; i++) {
     31    strcat (args[2], argv[i]);
     32    if (i < argc - 1) strcat (args[2], " ");
     33  }
     34  args[3] = NULL;
     35
     36  // send the commands to the shell specified in the env variable SHELL, or else /bin/sh
    1637
    1738  // use execvp to enable a timeout on the system call
    1839  pid = fork ();
    1940  if (!pid) { /* must be child process */
    20     execvp (args[0], args);
     41    execvp (shell, args);
    2142    exit (1);
    2243  }
  • trunk/Ohana/src/opihi/cmd.basic/test/list.sh

    r14176 r16059  
    7575  echo "Number of list elements: $check4:n"
    7676 end
    77  if (("$check4:0" != "This ") || ("$check4:1" != "is ") || ("$check4:2" != "a ") || ("$check4:3" != "list "))
     77 if (("$check4:0" != "This") || ("$check4:1" != "is") || ("$check4:2" != "a") || ("$check4:3" != "list"))
    7878  $PASS = 0
    7979  echo "List element does not return correctly!"
  • trunk/Ohana/src/opihi/cmd.basic/test/output.sh

    r14176 r16059  
    2323 output stdout
    2424 $line = `cat testout.txt`
    25  if ("$line" == "This is a test. ")
     25 if ("$line" == "This is a test.")
    2626   $PASS = 1
    2727 else
  • trunk/Ohana/src/opihi/cmd.basic/test/scan.sh

    r14176 r16059  
    2020 output stdout
    2121 scan test_file.txt fscan
    22  if ("$fscan" != "This ")
     22 if ("$fscan" != "This")
    2323  $PASS = 0
    2424  echo "Default not working!"
    2525 end
    2626 scan test_file.txt fscan 4
    27  if ("$fscan" != "test ")
     27 if ("$fscan" != "test")
    2828  $PASS = 0
    2929  echo "Scan failure!"
  • trunk/Ohana/src/opihi/cmd.data/fit.c

    r8297 r16059  
    118118      }
    119119    }
    120     if (!dgaussj (c, nterm, b, 1)) goto escape;
     120    if (!dgaussjordan (c, b, nterm, 1)) goto escape;
    121121
    122122    /* generate fitted values */
  • trunk/Ohana/src/opihi/cmd.data/fit2d.c

    r8871 r16059  
    161161    }
    162162
    163     dgaussj (c, wterm, b, 1);
     163    dgaussjordan (c, b, wterm, 1);
    164164
    165165    /** test print **/
  • trunk/Ohana/src/opihi/cmd.data/gaussj.c

    r14914 r16059  
    3434  }
    3535
    36   status = dgaussj (a, N, b, 1);
     36  status = dgaussjordan (a, b, N, 1);
    3737
    3838  for (i = 0; i < N; i++) {
  • trunk/Ohana/src/opihi/cmd.data/tvcolors.c

    r16013 r16059  
    33int tvcolors (int argc, char **argv) {
    44 
    5   int N, kapa, Nchannel;
     5  int N, kapa;
    66  char *name;
    77  KapaImageData data;
  • trunk/Ohana/src/opihi/lib.data/mrq2dmin.c

    r7917 r16059  
    9090
    9191  /* keep this test in here? */
    92   if (!fgaussj (talpha, Npar, tbeta, 1)) {
     92  if (!fgaussjordan (talpha, tbeta, Npar, 1)) {
    9393    lambda *= 10.0;
    9494    return (ochisq);
     
    183183float **mrq2dcovar (int Npar) {
    184184
    185   fgaussj (alpha, Npar, beta, 1);
     185  fgaussjordan (alpha, beta, Npar, 1);
    186186  return (alpha);
    187187
  • trunk/Ohana/src/opihi/lib.data/mrqmin.c

    r7917 r16059  
    6060  }
    6161
    62   fgaussj (talpha, Npar, tbeta, 1);
     62  fgaussjordan (talpha, tbeta, Npar, 1);
    6363
    6464  for (j = 0; j < Npar; j++) partry[j] = par[j] - tbeta[j][0];
     
    137137/* don't invoke this in the middle of a run, only near the end */
    138138float **mrqcovar (int Npar) {
    139   fgaussj (alpha, Npar, beta, 1);
     139  fgaussjordan (alpha, beta, Npar, 1);
    140140  return (alpha);
    141141}
  • trunk/Ohana/src/opihi/lib.shell/expand_vectors.c

    r16003 r16059  
    113113      if (J < 0) J += buf[0].header.Naxis[1];
    114114      ptr = (float *) buf[0].matrix.buffer;
    115       f1 = ptr[I + J*buf[0].header.Naxis[1]];
     115      f1 = ptr[I + J*buf[0].header.Naxis[0]];
    116116    } else {
    117117      if ((vec = SelectVector (tmpline, OLDVECTOR, TRUE)) == NULL) goto dumpline;
  • trunk/Ohana/src/opihi/lib.shell/parse.c

    r16003 r16059  
    177177
    178178      fptr = (float *) buf[0].matrix.buffer;
    179       fptr[Nx + Ny*buf[0].header.Naxis[1]] = atof (val);
     179      fptr[Nx + Ny*buf[0].header.Naxis[0]] = atof (val);
    180180    } else {
    181181      if ((vec = SelectVector (V0, OLDVECTOR, TRUE)) == NULL) goto error;
  • trunk/Ohana/src/opihi/mana/fitcontour.c

    r8297 r16059  
    5757  C[1][2] = C[2][1];
    5858   
    59   dgaussj (C, NTERM, B, 1);
     59  dgaussjordan (C, B, NTERM, 1);
    6060 
    6161  /** this is somewhat weak: if the object is too elongated, Rmin can be < 0 **/
Note: See TracChangeset for help on using the changeset viewer.