~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/file/matrix/covar_r.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /**@(#)
  2   */
  3 #include <stdio.h>
  4 #include <values.h>
  5 #include <tina/sys.h>
  6 #include <tina/sysfuncs.h>
  7 #include <tina/math.h>
  8 #include <tina/mathfuncs.h>
  9 #include <tina/vision.h>
 10 #include <tina/visionfuncs.h>
 11 
 12 Covar  *covar_read(char *pathname)
 13 {
 14     Covar  *cov;
 15     Covar  *covar_read_fp(FILE * fp);
 16     FILE   *fp;
 17     char    temps[1024];
 18 
 19     if ((fp = fopen(pathname, "r")) == NULL)
 20     {
 21         (void) string_append(temps, "cannot open file ", pathname, 0);
 22         error(temps, non_fatal);
 23         return (NULL);
 24     }
 25     cov = covar_read_fp(fp);
 26     (void) fclose(fp);
 27     return (cov);
 28 }
 29 
 30 Covar  *covar_read_fp(FILE * fp)
 31 {
 32     Covar  *covar_alloc();
 33     Covar  *cov;
 34     Matrix *dmatrix_read_fp();
 35     Vector *vector_alloc();
 36     int     i, n;
 37 
 38     (void) fscanf(fp, "%d ", &n);
 39     cov = covar_alloc(n);
 40     cov->n = n;
 41     (void) fscanf(fp, "%d ", &(cov->label));
 42     cov->mat = dmatrix_read_fp(fp, n, n);
 43     cov->vec = vector_alloc(n, double_v);
 44     for (i = 0; i < n; i++)
 45         (void) fscanf(fp, " %lf", &VECTOR_DOUBLE(cov->vec, i));
 46     return (cov);
 47 }
 48 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.