Skip to content
Snippets Groups Projects
Commit 4a39e944 authored by Boris Stefanovic's avatar Boris Stefanovic
Browse files

CLEAN: compiles

parent 7b9d9d44
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,7 @@ cluster_int_t* cluster_create_int(vector_int_t* center) {
if (NULL == cluster) return NULL;
cluster->center = center;
cluster->points = list_points_create_int();
return cluster;
}
cluster_fpt_t* cluster_create_fpt(vector_fpt_t* center) {
......@@ -15,6 +16,7 @@ cluster_fpt_t* cluster_create_fpt(vector_fpt_t* center) {
if (NULL == cluster) return NULL;
cluster->center = center;
cluster->points = list_points_create_fpt();
return cluster;
}
......
......@@ -7,7 +7,7 @@
bool randinit = false;
inline void init_rand() {
void init_rand() {
srand(time(NULL));
randinit = true;
}
......
......@@ -8,6 +8,8 @@ typedef int64_t int_t;
typedef double fpt_t;
void init_rand();
int rand_int(int max);
int rand_int_range(int min, int max);
......
#define _GNU_SOURCE
#include "io.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "linkedlist.h"
#include "vector.h"
......
#define _GNU_SOURCE
#include <getopt.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "distance.h"
#include "io.h"
#include "kmeans.h"
......@@ -77,12 +75,12 @@ int main_int(const char* ipath, const char* opath, const enum DistanceFunctionTy
FILE* ifile = ipath != NULL ? fopen(ipath, "r") : stdin;
const size_t dim = io_read_int(ifile);
const size_t nb_clusters = io_read_int(ifile);
if (0 <= dim) {
if (0 == dim) {
printf("DIMENSION MUST BE STRICTLY POSITIVE !\n");
fclose(ifile);
return EXIT_FAILURE;
}
if (0 <= nb_clusters) {
if (0 == nb_clusters) {
printf("NUMBER OF CLUSTERS MUST BE STRICTLY POSITIVE !\n");
fclose(ifile);
return EXIT_FAILURE;
......@@ -110,12 +108,12 @@ int main_fpt(const char* ipath, const char* opath, const enum DistanceFunctionTy
FILE* ifile = ipath != NULL ? fopen(ipath, "r") : stdin;
const size_t dim = io_read_int(ifile);
const size_t nb_clusters = io_read_int(ifile);
if (0 <= dim) {
if (0 == dim) {
printf("DIMENSION MUST BE STRICTLY POSITIVE !\n");
fclose(ifile);
return EXIT_FAILURE;
}
if (0 <= nb_clusters) {
if (0 == nb_clusters) {
printf("NUMBER OF CLUSTERS MUST BE STRICTLY POSITIVE !\n");
fclose(ifile);
return EXIT_FAILURE;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment