00001 00006 /* 00007 Copyright (C) 2013 Andrea Vedaldi 00008 All rights reserved. 00009 00010 This file is part of the VLFeat library and is made available under 00011 the terms of the BSD license (see the COPYING file). 00012 */ 00013 00014 #include "mexutils.h" 00015 00016 void 00017 mexFunction(int nout VL_UNUSED, mxArray *out[], 00018 int nin, const mxArray *in[]) 00019 { 00020 enum {IN_NUM = 0} ; 00021 enum {OUT_NUM = 0} ; 00022 vl_size numThreads ; 00023 00024 numThreads = vl_get_max_threads() ; 00025 00026 if (nout > 1) { 00027 vlmxError(vlmxErrInvalidArgument, "More than one ouptut argumnets requested.") ; 00028 } 00029 if (nin > 1) { 00030 vlmxError(vlmxErrInvalidArgument, "More than one input argument specified.") ; 00031 } 00032 00033 00034 OUT(NUM) = vlmxCreatePlainScalar (numThreads) ; 00035 00036 if (nin == 0) { 00037 return ; 00038 } 00039 00040 if (!vlmxIsScalar(IN(NUM))) { 00041 vlmxError(vlmxErrInvalidArgument, "NUM is not a scalar.") ; 00042 } 00043 00044 numThreads = (vl_size) mxGetScalar(IN(NUM)) ; 00045 vl_set_num_threads (numThreads) ; 00046 }