Skip to content

Commit

Permalink
build shogun's interfaces by default only for a limited set of data t…
Browse files Browse the repository at this point in the history
…ypes

namely char,uint8_t,uint16_t,uint64_t,float32_t,float64_t
  • Loading branch information
Soeren Sonnenburg committed Oct 17, 2011
1 parent 06a4899 commit 58f986e
Show file tree
Hide file tree
Showing 6 changed files with 497 additions and 6 deletions.
66 changes: 66 additions & 0 deletions src/configure
Expand Up @@ -115,6 +115,7 @@ _ld_static=""
_static=no
_optimizing=""
_interfaces=""
_datatypes="char,uint8_t,uint16_t,uint64_t,float32_t,float64_t"
_libshogun=yes
_python=auto
_octave=auto
Expand Down Expand Up @@ -1199,6 +1200,14 @@ Configuration:
octave_static
matlab_static
--datatypes=DATATYPE1,DATATYPE2,...
configure shogun to support these data types (default uint8_t,float32_t,float64_t)
can be any of
char,bool,uint8_t,uint16_t,uint32_t,uint64_t,
int8_t,int16_t,int32_t,int64_t,float32_t,float64_t,floatmax_t
-h, -help, --help display this help and exit
Installation directories:
Expand Down Expand Up @@ -1309,6 +1318,9 @@ _cpudetection=yes

for ac_option do
case "$ac_option" in
--datatypes=*)
_datatypes=`echo $ac_option | cut -d '=' -f 2`
;;
--interfaces=*)
_cmdline_static=no
_python_static=no
Expand Down Expand Up @@ -2739,6 +2751,57 @@ get_lflags()
echo $def
}

check_datatypes()
{
for d in `echo $_datatypes | cut -d '=' -f 2 | tr ',' ' '`
do
case "$d" in
char)
DEFINES="$DEFINES -DUSE_CHAR"
;;
bool)
DEFINES="$DEFINES -DUSE_BOOL"
;;
uint8_t)
DEFINES="$DEFINES -DUSE_UINT8"
;;
uint16_t)
DEFINES="$DEFINES -DUSE_UINT16"
;;
uint32_t)
DEFINES="$DEFINES -DUSE_UINT32"
;;
uint64_t)
DEFINES="$DEFINES -DUSE_UINT64"
;;
int8_t)
DEFINES="$DEFINES -DUSE_INT8"
;;
int16_t)
DEFINES="$DEFINES -DUSE_INT16"
;;
int32_t)
DEFINES="$DEFINES -DUSE_INT32"
;;
int64_t)
DEFINES="$DEFINES -DUSE_INT64"
;;
float32_t)
DEFINES="$DEFINES -DUSE_FLOAT32"
;;
float64_t)
DEFINES="$DEFINES -DUSE_FLOAT64"
;;
floatmax_t)
DEFINES="$DEFINES -DUSE_FLOATMAX"
;;
*)
die "Unknown datatype: $d"
;;
esac
done
}

set_opts()
{
if echo " $MACHINE " | grep "iPhone" >/dev/null
Expand Down Expand Up @@ -4787,6 +4850,8 @@ SHOGUN was configured for
interface(s) $cfgopts
It will support the following data types $_datatypes.
type "make" now to compile
EOF
Expand Down Expand Up @@ -4846,6 +4911,7 @@ check_pkg_config
check_make
check_doxygen
determine_march_mtune
check_datatypes
set_opts
test_spinlocks
test_libshogun
Expand Down
39 changes: 33 additions & 6 deletions src/interfaces/modular/Distance.i
Expand Up @@ -42,31 +42,58 @@
%include <shogun/distance/SimpleDistance.h>
namespace shogun
{
%template(SimpleRealDistance) CSimpleDistance<float64_t>;
%template(SimpleWordDistance) CSimpleDistance<uint16_t>;
#ifdef USE_CHAR
%template(SimpleCharDistance) CSimpleDistance<char>;
#endif
#ifdef USE_UINT16
%template(SimpleWordDistance) CSimpleDistance<uint16_t>;
#endif
#ifdef USE_INT32
%template(SimpleIntDistance) CSimpleDistance<int32_t>;
#endif
#ifdef USE_FLOAT64
%template(SimpleRealDistance) CSimpleDistance<float64_t>;
#endif

}

/* Templates Class SparseDistance*/
%include <shogun/distance/SparseDistance.h>
namespace shogun
{
%template(SparseRealDistance) CSparseDistance<float64_t>;
%template(SparseWordDistance) CSparseDistance<uint16_t>;
#ifdef USE_CHAR
%template(SparseCharDistance) CSparseDistance<char>;
#endif
#ifdef USE_UINT16
%template(SparseWordDistance) CSparseDistance<uint16_t>;
#endif
#ifdef USE_INT32
%template(SparseIntDistance) CSparseDistance<int32_t>;
#endif
#ifdef USE_FLOAT64
%template(SparseRealDistance) CSparseDistance<float64_t>;
#endif
}

/* Templates Class StringDistance*/
%include <shogun/distance/StringDistance.h>
namespace shogun
{
%template(StringRealDistance) CStringDistance<float64_t>;
%template(StringWordDistance) CStringDistance<uint16_t>;
#ifdef USE_CHAR
%template(StringCharDistance) CStringDistance<char>;
#endif
#ifdef USE_UINT16
%template(StringWordDistance) CStringDistance<uint16_t>;
#endif
#ifdef USE_INT32
%template(StringIntDistance) CStringDistance<int32_t>;
#endif
#ifdef USE_UINT64
%template(StringUlongDistance) CStringDistance<uint64_t>;
#endif
#ifdef USE_FLOAT64
%template(StringRealDistance) CStringDistance<float64_t>;
#endif
}

%include <shogun/distance/RealDistance.h>
Expand Down

0 comments on commit 58f986e

Please sign in to comment.