FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
algorithms2/main_cos.c at master · Phoenixmirage/algorithms2 · GitHub
Phoenixmirage
/
algorithms2
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
algorithms2
/
main_cos.c
Copy path
More file actions
More file actions
Latest commit
History
History
History
52 lines (46 loc) · 1.08 KB
Breadcrumbs
algorithms2
/
main_cos.c
Copy path
File metadata and controls
52 lines (46 loc) · 1.08 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include
"structs_cos2.h"
#include
<stdio.h>
#include
<string.h>
#include
<stdlib.h>
#include
<limits.h>
#include
<time.h>
#include
<math.h>
int
main
(
int
argc
,
char
*
*
argv
){
int
flagd
,
i
;
FILE
*
input
,
*
output
;
char
inputstr
[
50
];
for
(
i
=
1
;
i
<=
argc
-
2
;
i
=
i
+
2
){
if
(!
strcmp
(
argv
[
i
],
"-d"
)){
strcpy
(
inputstr
,
argv
[
i
+
1
]);
flagd
=
0
;
}
}
if
(
flagd
==
1
){
printf
(
"Give input file: "
);
scanf
(
"%s"
,
inputstr
);
}
if
((
input
=
fopen
(
inputstr
,
"r"
))
==
NULL
){
printf
(
"wrong file name\n"
);
return
-1
;
}
char
metric_space
[
100
];
char
metric
[
100
];
int
size
,
j
;
fscanf
(
input
,
"@metric_space %s\n"
,
metric_space
);
if
(!
strcmp
(
metric_space
,
"vector"
)){
fscanf
(
input
,
"@metric %s\n"
,
metric
);
if
(!
strcmp
(
metric
,
"cosine"
)){
int
size
,
items
;
int
no_cl
=
4
;
List_nodes
*
listn
;
listn
=
Cosine_input
(
input
,
&
size
,
&
items
);
Node
*
*
objects
;
init_array
(
&
objects
,
listn
,
items
);
cos_cluster
*
clusters
;
init_cos_cl
(
&
clusters
,
no_cl
);
k_medoids
(
no_cl
,
size
,
items
,
&
objects
,
&
clusters
);
printf
(
"medoids done\n"
);
print_clusters
(
clusters
,
no_cl
);
}
}
}
Back
|
FazBrowse Home
|
New Git URL