Commit 36a89974 authored by Giovanne Marcelo's avatar Giovanne Marcelo

add arguments to functions

parent 96b5d055
Pipeline #6382 failed with stage
in 4 minutes and 57 seconds
......@@ -4,7 +4,7 @@
#include "matrix.h"
typedef struct {
matrix R;
matrix residual;
matrix W;
matrix H;
double lamb;
......@@ -14,13 +14,13 @@ typedef struct {
void update_R();
void update_residual();
void update_wit();
void update_hjt();
void z();
void s();
void ccd(matrix R, matrix W, matrix H, double lamb, int k, int T);
void ccd_pp(matrix R, matrix W, matrix H, double lamb, int k);
void ccd(matrix residual, matrix W, matrix H, double lamb, int k, int T);
void ccd_pp(matrix residual, matrix W, matrix H, double lamb, int k);
void perform(algorithm_args *args);
#endif
......@@ -11,5 +11,6 @@ typedef gsl_matrix* matrix;
matrix matrix_alloc(long unsigned int rows, long unsigned int cols);
void print_matrix(matrix m);
void matrix_copy(matrix dest, matrix src);
void matrix_set(matrix m, int i, int j, double x);
double matrix_get(matrix m, int i, int j);
#endif
......@@ -27,29 +27,29 @@
* end for
*/
void update_R() {}
void update_wit() {}
void update_hjt() {}
void z() {}
void s() {}
void update_residual() {}
double z(matrix residual, matrix W, matrix H, double lamb) {}
double s(matrix residual, matrix W, matrix H, double lamb) {}
void ccd(matrix R, matrix W, matrix H, double lamb, int k, int T) {
void ccd(matrix residual, matrix W, matrix H, double lamb, int k, int T) {
double rating;
for(int iter = 0; iter < T ; iter++) {
for(int i = 0; i < R->size1 ; i++ ) {
for(int i = 0; i < residual->size1 ; i++ ) {
for(int t = 0; t < k; t++) {
z();
update_R();
update_wit();
rating = z();
update_residual();
matrix_set(W, i, t, rating);
}
}
for(int j = 0; j < R->size2; j++) {
for(int j = 0; j < residual->size2; j++) {
for(int t = 0; t < k; t++) {
s();
update_R();
update_hjt();
rating = s();
update_residual();
matrix_set(H, j, t, rating);
}
}
}
......@@ -66,12 +66,12 @@ void ccd(matrix R, matrix W, matrix H, double lamb, int k, int T) {
* end for
*/
void ccd_pp(matrix R, matrix W, matrix H, double lamb, int k) {
void ccd_pp(matrix residual, matrix W, matrix H, double lamb, int k) {
}
void perform(algorithm_args *args) {
ccd_pp(args->R, args->W, args->H, args->lamb, args->k);
ccd(args->residual, args->W, args->H, args->lamb, args->k);
}
......@@ -12,6 +12,14 @@ matrix matrix_alloc(long unsigned int rows, long unsigned int cols) {
return gsl_matrix_alloc(rows, cols);
}
void matrix_set(matrix m, int i, int j, double x) {
gsl_matrix_set(m, i, j, x);
}
double matrix_get(matrix m, int i, int j) {
return gsl_matrix_get(m, i, j);
}
void print_matrix(matrix m) {
for (size_t i=0; i<m->size1;++i){
for (size_t j=0; j<m->size2; ++j)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment