Skip to content

Commit

Permalink
Merge branch '3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewdalpino committed May 25, 2021
2 parents 35f8b14 + 78de894 commit 399e499
Show file tree
Hide file tree
Showing 125 changed files with 5,899 additions and 13,173 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/ci-ext.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@ jobs:
strategy:
matrix:
image:
- php:7.2-cli
- php:7.2-cli-alpine
- php:7.3-cli
- php:7.3-cli-alpine
- php:7.4-cli
- php:7.4-cli-alpine
- php:8.0-cli
- php:8.0-cli-alpine
name: Image ${{ matrix.image }}
runs-on: ubuntu-latest
steps:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
matrix:
operating-system: [windows-latest, ubuntu-latest, macos-latest]
php-versions: ['7.2', '7.3', '7.4']
php-versions: ['7.4']

steps:
- name: Checkout
Expand All @@ -19,6 +19,8 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: pecl
extensions: fileinfo
ini-values: memory_limit=-1

- name: Validate composer.json
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
- 3.0.0-beta
- Add support for PHP 8.0 in the extension
- Drop extension support for PHP 7.2 and 7.3
- Tensors only compute floating point operations
- Remove dependency on JAMA library
- Remove previously deprecated items
- Matrix returns vector on row access
- Added Algebraic and Special function interfaces

- 2.2.3
- Remove dependency on pthreads

Expand Down
40 changes: 0 additions & 40 deletions benchmarks/LinearAlgebra/SolveBench.php

This file was deleted.

39 changes: 0 additions & 39 deletions benchmarks/Structural/InsertMatrixBench.php

This file was deleted.

32 changes: 0 additions & 32 deletions benchmarks/Structural/SubMatrixBench.php

This file was deleted.

30 changes: 10 additions & 20 deletions build-ext
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@

const CONFIG_M4_PATH = './ext/config.m4';

const BUILDDIR_MATCH = "PHP_ADD_BUILD_DIR([\$ext_builddir/tensor/])\n";
const BUILDDIR_PATCH = <<<'EOT'
PHP_ADD_BUILD_DIR([$ext_builddir/tensor/decompositions/])
PHP_ADD_BUILD_DIR([$ext_builddir/tensor/exceptions/])
PHP_ADD_BUILD_DIR([$ext_builddir/tensor/reductions/])

EOT
;
const EXECINFO_MATCH = "PHP_SUBST(TENSOR_SHARED_LIBADD)\n";
const EXECINFO_PATCH = <<<'EOT'
Expand All @@ -26,37 +17,36 @@ EOT
chdir(__DIR__);

echo 'Reading config.m4 file... ';

$configM4Contents = file_get_contents(CONFIG_M4_PATH);

if (!$configM4Contents) {
fwrite(STDERR, "Failed to read the config.m4 file!\n");

exit(1);
}
echo "done.\n";

echo 'Applying build dir patch... ';
if (strpos($configM4Contents, BUILDDIR_MATCH) === false) {
echo "not needed.\n";
} elseif (strpos($configM4Contents, trim(BUILDDIR_PATCH)) !== false) {
echo "already applyed.\n";
} else {
$configM4Contents = str_replace(BUILDDIR_MATCH, BUILDDIR_MATCH . BUILDDIR_PATCH, $configM4Contents);
echo "done.\n";
}

echo 'Applying libexec patch...';

if (strpos($configM4Contents, EXECINFO_MATCH) === false) {
fwrite(STDERR, "patch entrypoint not found!\n");

exit(1);
} elseif (strpos($configM4Contents, trim(EXECINFO_PATCH)) !== false) {
echo "already applyed.\n";
echo "already applied.\n";
} else {
$configM4Contents = str_replace(EXECINFO_MATCH, EXECINFO_MATCH . EXECINFO_PATCH, $configM4Contents);

echo "done.\n";
}

echo 'Saving config.m4 file... ';

if (!file_put_contents(CONFIG_M4_PATH, $configM4Contents)) {
fwrite(STDERR, "Failed to write the config.m4 file\n");

exit(1);
}

echo "done.\n";
13 changes: 7 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
}
],
"require": {
"php": ">=7.2"
"php": ">=7.4"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "2.18.*",
"phalcon/zephir": "^0.12.20",
"phpbench/phpbench": "0.16.*",
"phalcon/zephir": "^0.13.5",
"phpbench/phpbench": "^1.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "0.12.*",
"phpstan/phpstan-phpunit": "0.12.*",
Expand All @@ -39,7 +39,6 @@
"autoload": {
"psr-4": {
"Tensor\\": "src/",
"JAMA\\": "lib/JAMA",
"Zephir\\Optimizers\\FunctionCall\\": "optimizers/"
},
"files": [
Expand Down Expand Up @@ -68,8 +67,10 @@
],
"clean": "zephir fullclean",
"compile": [
"zephir build --no-dev",
"@php build-ext"
"zephir generate",
"@php build-ext",
"zephir compile --no-dev",
"zephir install"
],
"fix": "php-cs-fixer fix --config=.php_cs.dist",
"test": "phpunit"
Expand Down
3 changes: 1 addition & 2 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
"extension-name": "tensor",
"description": "A library and extension that provides objects for scientific computing in PHP.",
"author": "Andrew DalPino",
"version": "2.2.3",
"version": "3.0.0-beta",
"verbose": true,
"extra-cflags": "-O3 -ffast-math",
"extra-libs": "-lopenblas -llapacke -lgfortran",
"extra-sources": [
"include/indexing.c",
"include/arithmetic.c",
"include/comparison.c",
"include/linear_algebra.c",
Expand Down
9 changes: 0 additions & 9 deletions docs/linear-algebra.md

This file was deleted.

16 changes: 7 additions & 9 deletions ext/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ if test "$PHP_TENSOR" = "yes"; then
fi

AC_DEFINE(HAVE_TENSOR, 1, [Whether you have Tensor])
tensor_sources="tensor.c kernel/main.c kernel/memory.c kernel/exception.c kernel/debug.c kernel/backtrace.c kernel/object.c kernel/array.c kernel/string.c kernel/fcall.c kernel/require.c kernel/file.c kernel/operators.c kernel/math.c kernel/concat.c kernel/variables.c kernel/filter.c kernel/iterator.c kernel/time.c kernel/exit.c tensor/arithmetic.zep.c
tensor_sources="tensor.c kernel/main.c kernel/memory.c kernel/exception.c kernel/debug.c kernel/backtrace.c kernel/object.c kernel/array.c kernel/string.c kernel/fcall.c kernel/require.c kernel/file.c kernel/operators.c kernel/math.c kernel/concat.c kernel/variables.c kernel/filter.c kernel/iterator.c kernel/time.c kernel/exit.c tensor/algebraic.zep.c
tensor/arithmetic.zep.c
tensor/arraylike.zep.c
tensor/comparable.zep.c
tensor/functional.zep.c
tensor/special.zep.c
tensor/statistical.zep.c
tensor/trigonometric.zep.c
tensor/exceptions/tensorexception.zep.c
Expand All @@ -29,19 +30,16 @@ if test "$PHP_TENSOR" = "yes"; then
tensor/matrix.zep.c
tensor/reductions/ref.zep.c
tensor/reductions/rref.zep.c
tensor/settings.zep.c include/indexing.c
include/arithmetic.c
tensor/settings.zep.c include/arithmetic.c
include/comparison.c
include/linear_algebra.c
include/signal_processing.c
include/settings.c"
PHP_NEW_EXTENSION(tensor, $tensor_sources, $ext_shared,, -O3 -ffast-math)
PHP_ADD_BUILD_DIR([$ext_builddir/kernel/])
PHP_ADD_BUILD_DIR([$ext_builddir/tensor/])

PHP_ADD_BUILD_DIR([$ext_builddir/tensor/decompositions/])
PHP_ADD_BUILD_DIR([$ext_builddir/tensor/exceptions/])
PHP_ADD_BUILD_DIR([$ext_builddir/tensor/reductions/])
for dir in "tensor tensor/decompositions tensor/exceptions tensor/reductions"; do
PHP_ADD_BUILD_DIR([$ext_builddir/$dir])
done
PHP_SUBST(TENSOR_SHARED_LIBADD)

AC_CHECK_FUNC(backtrace_symbols, have_backtrace_symbols=yes, have_backtrace_symbols=no)
Expand Down
4 changes: 2 additions & 2 deletions ext/config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ if (PHP_TENSOR != "no") {
ADD_EXTENSION_DEP("tensor", "json");
AC_DEFINE("ZEPHIR_USE_PHP_JSON", 1, "Whether PHP json extension is present at compile time");
}
ADD_SOURCES(configure_module_dirname + "/include", "indexing.c arithmetic.c comparison.c linear_algebra.c signal_processing.c settings.c", "tensor");
ADD_SOURCES(configure_module_dirname + "/tensor", "arithmetic.zep.c arraylike.zep.c comparable.zep.c functional.zep.c statistical.zep.c trigonometric.zep.c tensor.zep.c vector.zep.c columnvector.zep.c matrix.zep.c settings.zep.c", "tensor");
ADD_SOURCES(configure_module_dirname + "/include", "arithmetic.c comparison.c linear_algebra.c signal_processing.c settings.c", "tensor");
ADD_SOURCES(configure_module_dirname + "/tensor", "algebraic.zep.c arithmetic.zep.c arraylike.zep.c comparable.zep.c special.zep.c statistical.zep.c trigonometric.zep.c tensor.zep.c vector.zep.c columnvector.zep.c matrix.zep.c settings.zep.c", "tensor");
ADD_SOURCES(configure_module_dirname + "/tensor/exceptions", "tensorexception.zep.c invalidargumentexception.zep.c dimensionalitymismatch.zep.c runtimeexception.zep.c", "tensor");
ADD_SOURCES(configure_module_dirname + "/tensor/decompositions", "cholesky.zep.c eigen.zep.c lu.zep.c svd.zep.c", "tensor");
ADD_SOURCES(configure_module_dirname + "/tensor/reductions", "ref.zep.c rref.zep.c", "tensor");
Expand Down
40 changes: 0 additions & 40 deletions ext/include/indexing.c

This file was deleted.

9 changes: 0 additions & 9 deletions ext/include/indexing.h

This file was deleted.

Loading

0 comments on commit 399e499

Please sign in to comment.