From 044dc5a93c33d7aa4c9c98a626890c16446a56fc Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Mon, 16 May 2016 18:47:09 +0200 Subject: major refactor of the code --- src/gensvm_simplex.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/gensvm_simplex.c (limited to 'src/gensvm_simplex.c') diff --git a/src/gensvm_simplex.c b/src/gensvm_simplex.c new file mode 100644 index 0000000..1fd5f14 --- /dev/null +++ b/src/gensvm_simplex.c @@ -0,0 +1,45 @@ +/** + * @file gensvm_simplex.c + * @author Gertjan van den Burg + * @date May, 2016 + * @brief Function for generating the simplex matrix + * + * @details + * Contains the function for generating the simplex matrix for a given number + * of classes. + * + */ + +#include "gensvm_simplex.h" + +/** + * @brief Generate matrix of simplex vertex coordinates + * + * @details + * Generate the simplex matrix. Each row of the created + * matrix contains the coordinate vector of a single + * vertex of the K-simplex in K-1 dimensions. The simplex + * generated is a special simplex with edges of length 1. + * The simplex matrix U must already have been allocated. + * + * @param[in] K number of classes + * @param[in,out] U simplex matrix of size K * (K-1) + */ +void gensvm_simplex(long K, double *U) +{ + long i, j; + for (i=0; i