aboutsummaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorGertjan van den Burg <burg@ese.eur.nl>2013-08-08 14:21:38 +0200
committerGertjan van den Burg <burg@ese.eur.nl>2013-08-08 14:21:38 +0200
commit862307cff068bee98318415aa15ab920a02838a2 (patch)
tree407a16f2ed4946c0ab67ed5737927fd3147b4b2a /src/util.c
parentchanged the update to ensure instances are iterated over once (diff)
downloadgensvm-862307cff068bee98318415aa15ab920a02838a2.tar.gz
gensvm-862307cff068bee98318415aa15ab920a02838a2.zip
allow seeding of V and added documentation
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c63
1 files changed, 3 insertions, 60 deletions
diff --git a/src/util.c b/src/util.c
index ba48212..28be2a1 100644
--- a/src/util.c
+++ b/src/util.c
@@ -1,5 +1,5 @@
#include "util.h"
-
+#include "matrix.h"
/*
Read the data from the data_file. The data matrix X is augmented
with a column of ones, to get the matrix Z.
@@ -188,8 +188,6 @@ void read_model(struct Model *model, char *model_filename)
}
-
-
void write_model(struct Model *model, char *output_filename)
{
FILE *fid;
@@ -318,63 +316,6 @@ double rnd()
return (double) rand()/0x7FFFFFFF;
}
-/*
- Set a matrix element using ROW Major order. i denotes row,
- j denotes column.
-*/
-void matrix_set(double *M, long cols, long i, long j, double val)
-{
- M[i*cols+j] = val;
-}
-
-/*
- Get a matrix element using ROW Major order. i denotes row,
- j denotes column.
-*/
-double matrix_get(double *M, long cols, long i, long j)
-{
- return M[i*cols+j];
-}
-
-/*
- Add to an existing matrix element. Row-Major order is used.
-*/
-void matrix_add(double *M, long cols, long i, long j, double val)
-{
- M[i*cols+j] += val;
-}
-
-/*
- Multiply existing matrix element. Row-Major order is used.
-*/
-void matrix_mult(double *M, long cols, long i, long j, double val)
-{
- M[i*cols+j] *= val;
-}
-
-
-/*
- Set a matrix element of a 3D matrix in ROW major order.
- N2 and N3 are the second and third dimension respectively
- and i, j, k are the indices of the first, second and third
- dimensions respectively.
-*/
-void matrix3_set(double *M, long N2, long N3, long i, long j, long k, double val)
-{
- M[k+N3*(j+N2*i)] = val;
-}
-
-/*
- Get a matrix element of a 3D matrix in ROW major order.
- N2 and N3 are the second and third dimension respectively, and
- i, j and k are the indices of the first, second and third
- dimension of the requested element respectively.
-*/
-double matrix3_get(double *M, long N2, long N3, long i, long j, long k)
-{
- return M[k+N3*(j+N2*i)];
-}
-
void allocate_model(struct Model *model)
{
long n = model->n;
@@ -466,6 +407,7 @@ void free_data(struct Data *data)
free(data);
}
+/*
void print_matrix(double *M, long rows, long cols)
{
long i, j;
@@ -477,3 +419,4 @@ void print_matrix(double *M, long rows, long cols)
}
info("\n");
}
+*/