My Project
Loading...
Searching...
No Matches
Singular
dyn_modules
machinelearning
tests
test_bufsize.c
Go to the documentation of this file.
1
#include <stdio.h>
2
#include <stdlib.h>
3
#include <string.h>
4
#include "
kernel/mod2.h
"
5
#include "
mlpredict.h
"
6
7
#if defined(HAVE_READLINE) && defined(HAVE_READLINE_READLINE_H)
8
#ifdef HAVE_PYTHON
9
int
main
(
int
argc,
char
*
argv
[])
10
{
11
int
i
= 0;
12
int
k
= 0;
13
int
length
[5];
14
char
*buffer[5];
15
if
(argc != 1) {
16
printf
(
"Usage: %s\n"
,
argv
[0]);
17
return
1;
18
}
19
20
i
=
ml_initialise
();
21
if
(
i
!= 1)
22
{
23
printf
(
"Cannot test - initialization failed\n"
);
24
return
0;
25
}
26
27
i
=
system
(
"echo \"ring\" > test.txt"
);
28
if
(
i
!= 0)
return
1;
29
30
i
=
ml_make_prediction
(
"test.txt"
, buffer,
length
,
strdup
);
31
printf
(
"Returnvalue for ml_make_prediciton: \t%d\n"
,
i
);
32
for
(
k
= 0;
k
< 5;
k
++) {
33
printf
(
"String %d in buffer: \t\t%s\n"
,
k
, buffer[
k
]);
34
}
35
if
(
i
!= 1)
return
1;
36
for
(
k
= 0;
k
< 5;
k
++) {
37
if
((
int
)
strlen
(buffer[
k
]) !=
length
[
k
])
38
return
1;
39
}
40
if
(
strcmp
(buffer[0],
"sing_29.htm"
))
return
1;
41
if
(
length
[0] != 11)
return
1;
42
43
i
=
ml_finalise
();
44
if
(
i
!= 1)
return
1;
45
46
return
0;
47
}
48
#else
/*!HAVE_PYTHON*/
49
int
main
(
int
argc,
char
*
argv
[])
50
{
51
return
0;
52
}
53
#endif
54
#else
/*!HAVE_READLINE*/
55
int
main
(
int
argc,
char
*
argv
[])
56
{
57
return
0;
58
}
59
#endif
60
i
int i
Definition
cfEzgcd.cc:132
k
int k
Definition
cfEzgcd.cc:99
List
Definition
ftmpl_list.h:52
length
static BOOLEAN length(leftv result, leftv arg)
Definition
interval.cc:257
mlpredict.h
Function definitions for using python to do machine learning in Singular.
mod2.h
strdup
#define strdup
Definition
omAllocFunc.c:18
main
int main()
Definition
p_Procs_Generate.cc:219
Generated on Sat May 25 2024 12:58:19 for My Project by
doxygen 1.9.8
for
Singular