Index: trunk/Ohana/src/libohana/include/ohana.h
===================================================================
--- trunk/Ohana/src/libohana/include/ohana.h	(revision 37356)
+++ trunk/Ohana/src/libohana/include/ohana.h	(revision 37807)
@@ -242,4 +242,31 @@
 // sorting is now defined as a macro call
 # include <ohana_sort.h>
+
+// vector statistics options
+typedef enum {
+  VSTATS_NONE, 
+  VSTATS_MEAN, 
+  VSTATS_MEDIAN, 
+  VSTATS_WT_MEAN, 
+  VSTATS_INNER_MEAN, 
+  VSTATS_INNER_WTMEAN, 
+  VSTATS_CHI_INNER_MEAN, 
+  VSTATS_CHI_INNER_WTMEAN
+} VStatsMode;
+
+typedef struct {
+  double median;
+  double mean;
+  double sigma;
+  double error;
+  double chisq;
+  double min;
+  double max;
+  double Upper80;
+  double Lower20;
+  double total;
+  int    Nmeas;
+  VStatsMode statmode;
+} VStatsType;
 
 /* socket / pipe communication buffer */
@@ -314,4 +341,5 @@
 char   *ohana_version          PROTO((void));
 
+int     dgaussjordan_pivot     PROTO((double **A, double **B, int N, int M, double minPivot));
 int     dgaussjordan           PROTO((double **A, double **B, int N, int M));
 int     fgaussjordan           PROTO((float **A, float **B, int n, int m));
@@ -388,4 +416,8 @@
 int rconnect (char *command, char *hostname, char *shell, int *stdio, int *errorInfo, int doHandshake);
 
+int vstats_setmode (VStatsType *stats, char *mode);
+int vstats_getstats (double *value, double *dvalue, double *weight, int N, VStatsType *stats);
+int vstats_getstats_f (float *value, float *dvalue, float *weight, int N, VStatsType *stats);
+
 /*
 #   define F_SETFL         4   
@@ -404,3 +436,45 @@
 */
 
-# endif
+
+/** gsl-based functions for legendre and related polynomials **/
+
+double ohana_gsl_sf_log_1plusx (double x, double *err);
+double ohana_gsl_sf_lnpoch(const double a, const double x, double *err);
+double ohana_gsl_lnpoch_pos (const double a, const double x, double *err);
+double ohana_gsl_pochrel_smallx(const double a, const double x, double *err);
+
+double legendre_Pl (int l, double x, double *err);
+double legendre_Plm (int l, int m, double x, double *err);
+double legendre_Plm_sphere(int l, int m, double x, double *err);
+
+typedef struct {
+  double *Fr;
+  double *Fi;
+  int    *l;
+  int    *m;
+  int lmax;
+  int Nterms;
+} SHterms;
+
+SHterms *SHtermsInit (int lmax);
+void SHtermsFree (SHterms *terms);
+void SHtermsForRD (SHterms *terms, double R, double D);
+void SHtermsForLM (SHterms *terms, double R, double D, int l, int m);
+
+typedef struct {
+  double *dR_B;
+  double *dR_E;
+  double *dD_B;
+  double *dD_E;
+  int    *l;
+  int    *m;
+  int lmax;
+  int Nterms;
+} VSHterms;
+
+VSHterms *VSHtermsInit (int lmax);
+void VSHtermsFree (VSHterms *terms);
+void VSHtermsForRD (VSHterms *terms, double R, double D);
+void VSHtermsForLM (VSHterms *terms, double R, double D, int l, int m);
+
+# endif
