update
This commit is contained in:
parent
ca30fcbef5
commit
5bd00fe37d
|
@ -0,0 +1 @@
|
|||
*.h linguist-language=C
|
|
@ -1,2 +1,38 @@
|
|||
.deps
|
||||
*.lo
|
||||
*.la
|
||||
.libs
|
||||
acinclude.m4
|
||||
aclocal.m4
|
||||
autom4te.cache
|
||||
build
|
||||
config.guess
|
||||
config.h
|
||||
config.h.in
|
||||
config.log
|
||||
config.nice
|
||||
config.status
|
||||
config.sub
|
||||
configure
|
||||
configure.in
|
||||
configure.ac
|
||||
include
|
||||
install-sh
|
||||
libtool
|
||||
ltmain.sh
|
||||
Makefile
|
||||
Makefile.fragments
|
||||
Makefile.global
|
||||
Makefile.objects
|
||||
missing
|
||||
mkinstalldirs
|
||||
modules
|
||||
run-tests.php
|
||||
tests/*/*.diff
|
||||
tests/*/*.out
|
||||
tests/*/*.php
|
||||
tests/*/*.exp
|
||||
tests/*/*.log
|
||||
tests/*/*.sh
|
||||
.idea/
|
||||
.vscode/
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2018
|
||||
Copyright (c) 2019 CismonX
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
PHP_ARG_ENABLE(arma, for armadillo support,
|
||||
[ --enable-arma Enable armadillo support])
|
||||
|
||||
if test "$PHP_ARMA" != "no"; then
|
||||
ARMA_SRC="src/arma.c"
|
||||
PHP_NEW_EXTENSION(arma, $ARMA_SRC, $ext_shared)
|
||||
fi
|
|
@ -0,0 +1,64 @@
|
|||
//
|
||||
// php-armadillo/arma.c
|
||||
//
|
||||
// @Author CismonX
|
||||
//
|
||||
|
||||
#include "php_arma.h"
|
||||
|
||||
#include <zend_interfaces.h>
|
||||
#include <ext/standard/info.h>
|
||||
|
||||
#define ARMA_CE_INIT(cls, name) \
|
||||
zend_class_entry cls##_ce; \
|
||||
INIT_CLASS_ENTRY(cls##_ce, name, cls##_methods); \
|
||||
arma_##cls##_ce = zend_register_internal_class(&cls##_ce)
|
||||
#define ARMA_CONST_DECLARE(cls, name, val) \
|
||||
zend_declare_class_constant_long(arma_##cls##_ce, name, sizeof(name) - 1, val)
|
||||
#define ARMA_PROP_DECLARE(cls, name, flags) \
|
||||
zend_declare_property_null(arma_##cls##_ce, name, sizeof(name) - 1, flags)
|
||||
#define ARMA_HANDLERS_INIT(cls) \
|
||||
memcpy(&cls##_handlers, &std_object_handlers, sizeof(zend_object_handlers))
|
||||
#define ARMA_HANDLER_SET(cls, name) \
|
||||
cls##_handlers.name = cls##_##name
|
||||
|
||||
ZEND_DECLARE_MODULE_GLOBALS(arma)
|
||||
|
||||
#ifdef ZTS
|
||||
ZEND_TSRMLS_CACHE_DEFINE()
|
||||
#endif
|
||||
|
||||
PHP_MINIT_FUNCTION(arma)
|
||||
{
|
||||
#ifdef ZTS
|
||||
ZEND_INIT_MODULE_GLOBALS(arma, NULL, NULL);
|
||||
#endif
|
||||
|
||||
// ...
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
PHP_MINFO_FUNCTION(arma)
|
||||
{
|
||||
php_info_print_table_start();
|
||||
php_info_print_table_header(2, "armadillo support", "enabled");
|
||||
php_info_print_table_end();
|
||||
}
|
||||
|
||||
zend_module_entry arma_module_entry = {
|
||||
STANDARD_MODULE_HEADER,
|
||||
"arma",
|
||||
NULL,
|
||||
PHP_MINIT(arma),
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
PHP_MINFO(arma),
|
||||
PHP_ARMA_VERSION,
|
||||
STANDARD_MODULE_PROPERTIES
|
||||
};
|
||||
|
||||
#ifdef COMPILE_DL_ARMA
|
||||
ZEND_GET_MODULE(arma)
|
||||
#endif
|
|
@ -0,0 +1,43 @@
|
|||
//
|
||||
// php-armadillo/php_arma.h
|
||||
//
|
||||
// @Author CismonX
|
||||
//
|
||||
|
||||
#ifndef PHP_ARMA_H
|
||||
#define PHP_ARMA_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <php.h>
|
||||
|
||||
extern zend_module_entry arma_module_entry;
|
||||
|
||||
#define PHP_ARMA_VERSION "0.0.1"
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
#define PHP_ARMA_API __declspec(dllexport)
|
||||
#elif defined(__GNUC__) && __GNUC__ >= 4
|
||||
#define PHP_ARMA_API __attribute__ ((visibility("default")))
|
||||
#else
|
||||
#define PHP_ARMA_API
|
||||
#endif
|
||||
|
||||
ZEND_BEGIN_MODULE_GLOBALS(arma)
|
||||
int unused;
|
||||
ZEND_END_MODULE_GLOBALS(arma)
|
||||
|
||||
ZEND_EXTERN_MODULE_GLOBALS(arma)
|
||||
|
||||
#ifdef ZTS
|
||||
#ifdef COMPILE_DL_ARMA
|
||||
ZEND_TSRMLS_CACHE_EXTERN()
|
||||
#endif
|
||||
#define ARMA_G(v) TSRMG(arma_globals_id, zend_arma_globals*, v)
|
||||
#else
|
||||
#define ARMA_G(v) (arma_globals.v)
|
||||
#endif
|
||||
|
||||
#endif // !PHP_ARMA_H
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace Arma;
|
||||
|
||||
interface Base
|
||||
{
|
||||
function add($other);
|
||||
|
||||
function sub($other);
|
||||
|
||||
function mul($other);
|
||||
|
||||
function div($other);
|
||||
|
||||
function equals($others);
|
||||
|
||||
function notEquals($other);
|
||||
|
||||
function greaterThan($other);
|
||||
|
||||
function smallerThan($other);
|
||||
|
||||
function notGreaterThan($other);
|
||||
|
||||
function notSmallerThan($other);
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
<?php
|
||||
|
|
@ -2,35 +2,35 @@
|
|||
|
||||
namespace Arma;
|
||||
|
||||
class CxDmat implements CxMat
|
||||
class CxDMat implements CxMat
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
* @return CxDmat
|
||||
* @return CxDMat
|
||||
*/
|
||||
static function init($in_rows, $in_cols, $fill = null) {}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* @return CxDmat
|
||||
* @return CxDMat
|
||||
*/
|
||||
public static function fromMats($real, $imag) {}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* @return CxDmat
|
||||
* @return CxDMat
|
||||
*/
|
||||
static function fromSparse($sp_mat) {}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* @return CxDmat
|
||||
* @return CxDMat
|
||||
*/
|
||||
static function fromString($text) {}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* @return CxDmat
|
||||
* @return CxDMat
|
||||
*/
|
||||
static function fromVec($vector) {}
|
||||
}
|
|
@ -2,35 +2,35 @@
|
|||
|
||||
namespace Arma;
|
||||
|
||||
class CxImat implements CxMat
|
||||
class CxIMat implements CxMat
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
* @return CxImat
|
||||
* @return CxIMat
|
||||
*/
|
||||
static function init($in_rows, $in_cols, $fill = 0) {}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* @return CxImat
|
||||
* @return CxIMat
|
||||
*/
|
||||
public static function fromMats($real, $imag) {}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* @return CxImat
|
||||
* @return CxIMat
|
||||
*/
|
||||
static function fromSparse($sp_mat) {}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* @return CxImat
|
||||
* @return CxIMat
|
||||
*/
|
||||
static function fromString($text) {}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* @return CxImat
|
||||
* @return CxIMat
|
||||
*/
|
||||
static function fromVec($vector) {}
|
||||
}
|
|
@ -2,29 +2,29 @@
|
|||
|
||||
namespace Arma;
|
||||
|
||||
class Dmat implements Mat
|
||||
class DMat implements Mat
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
* @return Dmat
|
||||
* @return DMat
|
||||
*/
|
||||
static function init($in_rows, $in_cols, $fill = null) {}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* @return Dmat
|
||||
* @return DMat
|
||||
*/
|
||||
static function fromSparse($sp_mat) {}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* @return Dmat
|
||||
* @return DMat
|
||||
*/
|
||||
static function fromString($text) {}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* @return Dmat
|
||||
* @return DMat
|
||||
*/
|
||||
static function fromVec($vector) {}
|
||||
}
|
|
@ -2,29 +2,29 @@
|
|||
|
||||
namespace Arma;
|
||||
|
||||
class Imat implements Mat
|
||||
class IMat implements Mat
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
* @return Imat
|
||||
* @return IMat
|
||||
*/
|
||||
static function init($in_rows, $in_cols, $fill = 0) {}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* @return Imat
|
||||
* @return IMat
|
||||
*/
|
||||
static function fromSparse($sp_mat) {}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* @return Imat
|
||||
* @return IMat
|
||||
*/
|
||||
static function fromString($text) {}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* @return Imat
|
||||
* @return IMat
|
||||
*/
|
||||
static function fromVec($vector) {}
|
||||
}
|
Reference in New Issue