File: jensen_shannon.h

package info (click to toggle)
cufflinks 1.3.0-2
  • links: PTS, VCS
  • area: non-free
  • in suites: wheezy
  • size: 3,864 kB
  • sloc: cpp: 48,999; ansic: 12,297; sh: 3,381; python: 432; makefile: 209
file content (33 lines) | stat: -rw-r--r-- 1,041 bytes parent folder | download
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
/*
 *  jensen_shannon.h
 *  cufflinks
 *
 *  Created by Cole Trapnell on 8/30/10.
 *  Copyright 2010 Cole Trapnell. All rights reserved.
 *
 */

#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/matrix_proxy.hpp>
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/vector_proxy.hpp>
#include <boost/numeric/ublas/io.hpp>

#include <vector>

namespace ublas = boost::numeric::ublas;

double entropy(const ublas::vector<double>& p);

double jensen_shannon_distance(std::vector<ublas::vector<double> >& sample_kappas);

//void alt_jensen_shannon_gradient(std::vector<ublas::vector<double> >& sample_kappas,
//                                 double js,
//                                 ublas::vector<double>& gradient);

void jensen_shannon_gradient(std::vector<ublas::vector<double> >& sample_kappas,
							 double js,
							 ublas::vector<double>& gradient);

void make_js_covariance_matrix(std::vector<ublas::matrix<double> >& kappa_covariances,
							   ublas::matrix<double>& js_covariance);