//
// php-armadillo/functions.cc
// @Author CismonX
#include "functions.hh"
#include "complex.hh"
#define PHP_ARMA_FE(func) \
ZEND_RAW_FENTRY("Arma\\" #func, ZEND_FN(func), nullptr, 0)
namespace php_arma
{
PHP_FUNCTION(cx_double)
double real = 0.;
double imag = 0.;
ZEND_PARSE_PARAMETERS_START(0, 2)
Z_PARAM_OPTIONAL
Z_PARAM_DOUBLE(real)
Z_PARAM_DOUBLE(imag)
ZEND_PARSE_PARAMETERS_END();
zval_set_scalar(return_value, std::complex<double>(real, imag));
}
PHP_FUNCTION(j)
double imag = 1.;
ZEND_PARSE_PARAMETERS_START(0, 1)
zval_set_scalar(return_value, std::complex<double>(0., imag));
PHP_FUNCTION(srand)
zend_long seed;
Z_PARAM_LONG(seed)
if (EX_NUM_ARGS() == 0) {
arma::arma_rng::set_seed_random();
} else {
arma::arma_rng::set_seed(seed);
const zend_function_entry functions[] = {
PHP_ARMA_FE(cx_double)
PHP_ARMA_FE(j)
PHP_ARMA_FE(srand)
PHP_FE_END
};