-
Notifications
You must be signed in to change notification settings - Fork 21
/
opt.h
60 lines (45 loc) · 1.5 KB
/
opt.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// (C) Copyright 2009, Chong Wang, David Blei and Li Fei-Fei
// written by Chong Wang, [email protected]
// This file is part of slda.
// slda is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 of the License, or (at your
// option) any later version.
// slda is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
#ifndef OPT_H_INCLUDED
#define OPT_H_INCLUDED
#include <gsl/gsl_vector.h>
#include "slda.h"
/*
* structure for the gsl optimization routine
*
*/
struct opt_parameter
{
suffstats * ss;
slda * model;
double PENALTY;
};
/*
* function to compute the value of the obj function, then
* return it
*/
double softmax_f(const gsl_vector * x, void * opt_param);
/*
* function to compute the derivatives of function
*
*/
void softmax_df(const gsl_vector * x, void * opt_param, gsl_vector * df);
/*
* function to compute the value and derivatives of the function
*
*/
void softmax_fdf(const gsl_vector * x, void * opt_param, double * f, gsl_vector * df);
#endif // OPT_H_INCLUDED