version 1.3, 2013/02/12 23:51:25 |
version 1.6, 2013/03/07 05:23:31 |
|
|
|
/* $OpenXM: OpenXM/src/hgm/so3/src/so3_nc.c,v 1.5 2013/03/05 05:26:07 takayama Exp $ */ |
#include <stdio.h> |
#include <stdio.h> |
#include <math.h> |
#include <math.h> |
#ifdef USE_GSL_LIB |
#ifdef USE_GSL_LIB |
|
|
#include "t-gsl_odeiv.h" |
#include "t-gsl_odeiv.h" |
#endif |
#endif |
|
|
|
#ifndef STANDALONE |
|
void mh_check_intr(int n); |
|
#endif |
|
|
/* gcc evalnc.c -lgsl -lblas -lm */ |
/* gcc evalnc.c -lgsl -lblas -lm */ |
/* gcc evalnc.c `pkg-config --cflags gsl` `pkg-config --libs gsl` */ |
/* gcc evalnc.c `pkg-config --cflags gsl` `pkg-config --libs gsl` */ |
|
|
int so3_func(); |
int so3_func(); |
void so3_nc(double a[3],double t0,double y[4]); |
void so3_nc(double a[3],double t0,double y[4]); |
void so3_evalByS(int deg,double a,double b,double c,double t,double f[4]); |
void so3_evalByS(int deg,double a,double b,double c,double t,double f[4]); |
|
int so3_usage(void); |
|
|
#define MDEG 20 |
#define MDEG 20 |
|
|
Line 81 void so3_main(double *in1,double *in2,double *in3,doub |
|
Line 87 void so3_main(double *in1,double *in2,double *in3,doub |
|
} |
} |
#endif |
#endif |
|
|
so3_usage() { |
int so3_usage(void) { |
fprintf(stderr,"Usage: so3_nc a b c returns nc(a,b,c) and its gradients\n"); |
fprintf(stderr,"Usage: so3_nc a b c returns nc(a,b,c) and its gradients\n"); |
fprintf(stderr," where nc is the normalization constant\n" ); |
fprintf(stderr," where nc is the normalization constant\n" ); |
fprintf(stderr," of the Fisher distribution on SO(3) for the diagonal matrix diag(a,b,c).\n"); |
fprintf(stderr," of the Fisher distribution on SO(3) for the diagonal matrix diag(a,b,c).\n"); |
fprintf(stderr," See http://arxiv.org/abs/1110.0721\n"); |
fprintf(stderr," See http://arxiv.org/abs/1110.0721\n"); |
fprintf(stderr,"Options: --quiet --t0 T0 --deg DEG\n"); |
fprintf(stderr,"Options: --quiet --t0 T0 --deg DEG\n"); |
fprintf(stderr," Series is evaluated at T0*(a,b,c) and the value is extended to (a,b,c) by diff. eq.\n"); |
fprintf(stderr," Series is evaluated at T0*(a,b,c) and the value is extended to (a,b,c) by diff. eq.\n"); |
|
return(0); |
} |
} |
|
|
/* Evaluate normalization constant */ |
/* Evaluate normalization constant */ |
Line 182 Ref: Note: See the Corollary 1 of the paper rotation.c |
|
Line 189 Ref: Note: See the Corollary 1 of the paper rotation.c |
|
int so3_func(double t, const double y[], double f[], void *params) |
int so3_func(double t, const double y[], double f[], void *params) |
{ |
{ |
extern double SO3_A[3]; |
extern double SO3_A[3]; |
|
#ifndef STANDALONE |
|
mh_check_intr(100); |
|
#endif |
f[0] = SO3_A[0]*y[1]+SO3_A[1]*y[2]+SO3_A[2]*y[3] -SO3_R*y[0]; |
f[0] = SO3_A[0]*y[1]+SO3_A[1]*y[2]+SO3_A[2]*y[3] -SO3_R*y[0]; |
f[1] = SO3_A[0]*y[0]+SO3_A[2]*y[2]+SO3_A[1]*y[3] - (2/t)*y[1] -SO3_R*y[1]; |
f[1] = SO3_A[0]*y[0]+SO3_A[2]*y[2]+SO3_A[1]*y[3] - (2/t)*y[1] -SO3_R*y[1]; |
f[2] = SO3_A[1]*y[0]+SO3_A[2]*y[1]+SO3_A[0]*y[3] - (2/t)*y[2] -SO3_R*y[2]; |
f[2] = SO3_A[1]*y[0]+SO3_A[2]*y[1]+SO3_A[0]*y[3] - (2/t)*y[2] -SO3_R*y[2]; |