diff --git a/benchmarks/Factories/VectorLinspaceBench.php b/benchmarks/Factories/VectorLinspaceBench.php new file mode 100644 index 0000000..aac22d9 --- /dev/null +++ b/benchmarks/Factories/VectorLinspaceBench.php @@ -0,0 +1,33 @@ + + */ + public function sizes() : Generator + { + yield 'small' => ['size' => 1024 * 1024]; + yield 'medium' => ['size' => 4096 * 4096]; + } + + /** + * @Subject + * @Iterations(5) + * @ParamProviders({"sizes"}) + * @OutputTimeUnit("milliseconds", precision=3) + * @param array $params + */ + public function linspace(array $params) : void + { + Vector::linspace(0.0, 1000.0, $params['size']); + } +} diff --git a/benchmarks/Factories/VectorRangeBench.php b/benchmarks/Factories/VectorRangeBench.php new file mode 100644 index 0000000..3c57b3d --- /dev/null +++ b/benchmarks/Factories/VectorRangeBench.php @@ -0,0 +1,33 @@ + + */ + public function sizes() : Generator + { + yield 'small' => ['size' => 1024 * 1024]; + yield 'medium' => ['size' => 4096 * 4096]; + } + + /** + * @Subject + * @Iterations(5) + * @ParamProviders({"sizes"}) + * @OutputTimeUnit("milliseconds", precision=3) + * @param array $params + */ + public function range(array $params) : void + { + Vector::range(0.0, (float) $params['size'], 1.0); + } +} diff --git a/ext/include/factories.c b/ext/include/factories.c index 8b2978e..520d93a 100644 --- a/ext/include/factories.c +++ b/ext/include/factories.c @@ -178,3 +178,96 @@ void tensor_random_gaussian(zval * return_value, zval * n) zval_ptr_dtor(&c); } + +/** + * Create a tensor with `n` evenly spaced values between `min` and `max`, + * inclusive of both endpoints. Values are accumulated from `min` toward + * `max`, with the final element forced to `max` to guarantee exact endpoint. + * The caller is responsible for rejecting n < 2 or min > max. + */ +void tensor_linspace(zval * return_value, zval * min, zval * max, zval * n) +{ + zend_long length = zephir_get_intval(n); + double lo = zephir_get_doubleval(min); + double hi = zephir_get_doubleval(max); + zval c; + + if (UNEXPECTED(tensor_tensorbuffer_create(return_value, length, &c) == FAILURE)) { + return; + } + + double * vc = zephir_buffer_doubles(&c); + + double step = fabs(hi - lo) / (double) (length - 1); + + zend_long i; + + vc[0] = lo; + + for (i = 1; i < length - 1; ++i) { + vc[i] = vc[i - 1] + step; + } + + vc[length - 1] = hi; + + zval_ptr_dtor(&c); +} + +/** + * Create a tensor mirroring PHP's `range($start, $end, $step)` semantics: + * values are `start + i*step` (or `start - i*|step|` for decreasing range), + * generated until the value crosses `end`. The caller must reject a zero step, + * a step with the wrong sign for the direction of traversal, and a step + * whose magnitude exceeds the span. Equal start/end yields a single-element + * tensor holding that value. + */ +void tensor_range(zval * return_value, zval * start, zval * end, zval * interval) +{ + double s = zephir_get_doubleval(start); + double e = zephir_get_doubleval(end); + double st = fabs(zephir_get_doubleval(interval)); + + zval c; + + if (s == e) { + if (UNEXPECTED(tensor_tensorbuffer_create(return_value, 1, &c) == FAILURE)) { + return; + } + + double * vc = zephir_buffer_doubles(&c); + + vc[0] = s; + + zval_ptr_dtor(&c); + + return; + } + + int increasing = e > s; + double sign = increasing ? 1.0 : -1.0; + + zend_long count = 0; + zend_long i; + + for (i = 0; ; ++i) { + double el = s + ((double) i) * st * sign; + + if ((increasing && el > e) || (!increasing && el < e)) { + break; + } + + ++count; + } + + if (UNEXPECTED(tensor_tensorbuffer_create(return_value, count, &c) == FAILURE)) { + return; + } + + double * vc = zephir_buffer_doubles(&c); + + for (i = 0; i < count; ++i) { + vc[i] = s + ((double) i) * st * sign; + } + + zval_ptr_dtor(&c); +} diff --git a/ext/include/factories.h b/ext/include/factories.h index 7b2ee87..2287ba9 100644 --- a/ext/include/factories.h +++ b/ext/include/factories.h @@ -42,4 +42,22 @@ void tensor_random_uniform_pm1(zval * return_value, zval * n); */ void tensor_random_gaussian(zval * return_value, zval * n); +/** + * Allocate a fresh `Tensor\TensorBuffer` of `n` elements holding the evenly + * spaced values between `min` and `max` (inclusive of both endpoints). Values + * are accumulated from `min` toward `max`, with the final element forced to + * `max`. The caller must reject `n < 2` and `min > max`. + */ +void tensor_linspace(zval * return_value, zval * min, zval * max, zval * n); + +/** + * Allocate a fresh `Tensor\TensorBuffer` mirroring PHP's + * `range($start, $end, $interval)`: values are `start ± i*|interval|`, + * generated until the value crosses `end`. Equal start/end yields a + * single-element buffer. The caller must reject a zero interval, an interval + * whose sign disagrees with the traversal direction (for increasing ranges), + * and an interval whose magnitude exceeds the span. + */ +void tensor_range(zval * return_value, zval * start, zval * end, zval * interval); + #endif diff --git a/ext/tensor/decompositions/cholesky.zep.c b/ext/tensor/decompositions/cholesky.zep.c index 06af098..4f19e54 100644 --- a/ext/tensor/decompositions/cholesky.zep.c +++ b/ext/tensor/decompositions/cholesky.zep.c @@ -106,7 +106,7 @@ PHP_METHOD(Tensor_Decompositions_Cholesky, decompose) zephir_check_call_status(); ZEPHIR_CALL_CE_STATIC(&_6, tensor_matrix_ce, "fromBuffer", NULL, 0, &l, &_7, &_8); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 14, &_6); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 12, &_6); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/tensor/decompositions/eigen.zep.c b/ext/tensor/decompositions/eigen.zep.c index 0ad84f6..4059b4c 100644 --- a/ext/tensor/decompositions/eigen.zep.c +++ b/ext/tensor/decompositions/eigen.zep.c @@ -167,7 +167,7 @@ PHP_METHOD(Tensor_Decompositions_Eigen, decompose) ZEPHIR_CALL_METHOD(&eigenvectors, &_10, "transpose", NULL, 0); zephir_check_call_status(); object_init_ex(return_value, tensor_decompositions_eigen_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 15, &eigenvalues, &eigenvectors, &eigenvaluesImaginary); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 13, &eigenvalues, &eigenvectors, &eigenvaluesImaginary); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/tensor/decompositions/lu.zep.c b/ext/tensor/decompositions/lu.zep.c index ffa94d4..fbd1b0e 100644 --- a/ext/tensor/decompositions/lu.zep.c +++ b/ext/tensor/decompositions/lu.zep.c @@ -153,7 +153,7 @@ PHP_METHOD(Tensor_Decompositions_Lu, decompose) ZEPHIR_CALL_CE_STATIC(&p, tensor_matrix_ce, "fromBuffer", NULL, 0, &_14, &_15, &_16); zephir_check_call_status(); object_init_ex(return_value, tensor_decompositions_lu_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &l, &u, &p); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 14, &l, &u, &p); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/tensor/decompositions/svd.zep.c b/ext/tensor/decompositions/svd.zep.c index 7ebf8b0..7fa3d27 100644 --- a/ext/tensor/decompositions/svd.zep.c +++ b/ext/tensor/decompositions/svd.zep.c @@ -126,7 +126,7 @@ PHP_METHOD(Tensor_Decompositions_Svd, decompose) ZEPHIR_CALL_CE_STATIC(&vT, tensor_matrix_ce, "fromBuffer", NULL, 0, &_9, &_10, &_11); zephir_check_call_status(); object_init_ex(return_value, tensor_decompositions_svd_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 17, &u, &singularValues, &vT); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 15, &u, &singularValues, &vT); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/tensor/matrix.zep.c b/ext/tensor/matrix.zep.c index 568071d..003082e 100644 --- a/ext/tensor/matrix.zep.c +++ b/ext/tensor/matrix.zep.c @@ -207,11 +207,11 @@ PHP_METHOD(Tensor_Matrix, fromArray) object_init_ex(return_value, tensor_matrix_ce); ZVAL_LONG(&_1$$3, 0); ZVAL_LONG(&_2$$3, 0); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer$$3, &_1$$3, &_2$$3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer$$3, &_1$$3, &_2$$3); zephir_check_call_status(); RETURN_MM(); } - ZEPHIR_CALL_FUNCTION(&aList, "array_values", NULL, 19, &a); + ZEPHIR_CALL_FUNCTION(&aList, "array_values", NULL, 17, &a); zephir_check_call_status(); zephir_memory_observe(&firstRow); zephir_array_fetch_long(&firstRow, &aList, 0, PH_NOISY, "tensor/matrix.zep", 105); @@ -314,7 +314,7 @@ PHP_METHOD(Tensor_Matrix, fromArray) tensor_buffer_from_array(&buffer, &flat); object_init_ex(return_value, tensor_matrix_ce); ZVAL_LONG(&_19, rows); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_19, &n); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_19, &n); zephir_check_call_status(); RETURN_MM(); } @@ -456,7 +456,7 @@ PHP_METHOD(Tensor_Matrix, fill) tensor_fill(&_9, &_10, &_11); ZVAL_LONG(&_12, m); ZVAL_LONG(&_13, n); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &_9, &_12, &_13); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &_9, &_12, &_13); zephir_check_call_status(); RETURN_MM(); } @@ -506,14 +506,14 @@ PHP_METHOD(Tensor_Matrix, identity) ZVAL_LONG(&_4, 0); ZVAL_LONG(&_5, n); ZVAL_DOUBLE(&_6, 1.0); - ZEPHIR_CALL_FUNCTION(&ones, "array_fill", NULL, 20, &_4, &_5, &_6); + ZEPHIR_CALL_FUNCTION(&ones, "array_fill", NULL, 18, &_4, &_5, &_6); zephir_check_call_status(); object_init_ex(return_value, tensor_matrix_ce); ZEPHIR_INIT_VAR(&_7); tensor_diagonal(&_7, &ones); ZVAL_LONG(&_4, n); ZVAL_LONG(&_5, n); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &_7, &_4, &_5); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &_7, &_4, &_5); zephir_check_call_status(); RETURN_MM(); } @@ -549,7 +549,7 @@ PHP_METHOD(Tensor_Matrix, diagonal) tensor_diagonal(&_0, &elements); ZVAL_LONG(&_1, n); ZVAL_LONG(&_2, n); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &_0, &_1, &_2); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &_0, &_1, &_2); zephir_check_call_status(); RETURN_MM(); } @@ -626,7 +626,7 @@ PHP_METHOD(Tensor_Matrix, rand) tensor_random_uniform_01(&_9, &_10); ZVAL_LONG(&_11, m); ZVAL_LONG(&_12, n); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &_9, &_11, &_12); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &_9, &_11, &_12); zephir_check_call_status(); RETURN_MM(); } @@ -702,7 +702,7 @@ PHP_METHOD(Tensor_Matrix, gaussian) tensor_random_gaussian(&_9, &_10); ZVAL_LONG(&_11, m); ZVAL_LONG(&_12, n); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &_9, &_11, &_12); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &_9, &_11, &_12); zephir_check_call_status(); RETURN_MM(); } @@ -779,7 +779,7 @@ PHP_METHOD(Tensor_Matrix, uniform) tensor_random_uniform_pm1(&_9, &_10); ZVAL_LONG(&_11, m); ZVAL_LONG(&_12, n); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &_9, &_11, &_12); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &_9, &_11, &_12); zephir_check_call_status(); RETURN_MM(); } @@ -816,7 +816,7 @@ PHP_METHOD(Tensor_Matrix, fromBuffer) object_init_ex(return_value, tensor_matrix_ce); ZVAL_LONG(&_0, m); ZVAL_LONG(&_1, n); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, a, &_0, &_1); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, a, &_0, &_1); zephir_check_call_status(); RETURN_MM(); } @@ -1702,7 +1702,7 @@ PHP_METHOD(Tensor_Matrix, map) zephir_read_property_cached(&_0, this_ptr, _zephir_prop_0, 15, PH_NOISY_CC | PH_READONLY); ZEPHIR_CALL_METHOD(&_1, &_0, "toArray", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&b, "array_map", NULL, 9, callback, &_1); + ZEPHIR_CALL_FUNCTION(&b, "array_map", NULL, 7, callback, &_1); zephir_check_call_status(); ZEPHIR_INIT_VAR(&buffer); tensor_buffer_from_array(&buffer, &b); @@ -1753,7 +1753,7 @@ PHP_METHOD(Tensor_Matrix, reduce) ZEPHIR_CALL_METHOD(&_1, &_0, "toArray", NULL, 0); zephir_check_call_status(); ZVAL_DOUBLE(&_2, initial); - ZEPHIR_RETURN_CALL_FUNCTION("array_reduce", NULL, 10, &_1, callback, &_2); + ZEPHIR_RETURN_CALL_FUNCTION("array_reduce", NULL, 8, &_1, callback, &_2); zephir_check_call_status(); RETURN_MM(); } @@ -1804,7 +1804,7 @@ PHP_METHOD(Tensor_Matrix, transpose) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_4, this_ptr, _zephir_prop_0, 17, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_5, this_ptr, _zephir_prop_2, 16, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_4, &_5); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_4, &_5); zephir_check_call_status(); RETURN_MM(); } @@ -1870,7 +1870,7 @@ PHP_METHOD(Tensor_Matrix, inverse) object_init_ex(&_5$$4, tensor_exceptions_runtimeexception_ce); ZEPHIR_INIT_VAR(&_6$$4); ZEPHIR_CONCAT_SS(&_6$$4, "Failed to compute the inverse", " of a singular matrix."); - ZEPHIR_CALL_METHOD(NULL, &_5$$4, "__construct", NULL, 21, &_6$$4); + ZEPHIR_CALL_METHOD(NULL, &_5$$4, "__construct", NULL, 19, &_6$$4); zephir_check_call_status(); zephir_throw_exception_debug(&_5$$4, "tensor/matrix.zep", 651); ZEPHIR_MM_RESTORE(); @@ -1885,7 +1885,7 @@ PHP_METHOD(Tensor_Matrix, inverse) object_init_ex(&_9$$5, tensor_exceptions_runtimeexception_ce); ZEPHIR_INIT_VAR(&_10$$5); ZEPHIR_CONCAT_SS(&_10$$5, "Failed to compute the inverse", " of a singular matrix."); - ZEPHIR_CALL_METHOD(NULL, &_9$$5, "__construct", NULL, 21, &_10$$5); + ZEPHIR_CALL_METHOD(NULL, &_9$$5, "__construct", NULL, 19, &_10$$5); zephir_check_call_status(); zephir_throw_exception_debug(&_9$$5, "tensor/matrix.zep", 658); ZEPHIR_MM_RESTORE(); @@ -1894,7 +1894,7 @@ PHP_METHOD(Tensor_Matrix, inverse) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_11, this_ptr, _zephir_prop_1, 17, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_12, this_ptr, _zephir_prop_1, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_11, &_12); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_11, &_12); zephir_check_call_status(); RETURN_MM(); } @@ -1945,7 +1945,7 @@ PHP_METHOD(Tensor_Matrix, pseudoinverse) object_init_ex(&_3$$3, tensor_exceptions_runtimeexception_ce); ZEPHIR_INIT_VAR(&_4$$3); ZEPHIR_CONCAT_SS(&_4$$3, "Failed to compute the pseudoinverse", " of the matrix."); - ZEPHIR_CALL_METHOD(NULL, &_3$$3, "__construct", NULL, 21, &_4$$3); + ZEPHIR_CALL_METHOD(NULL, &_3$$3, "__construct", NULL, 19, &_4$$3); zephir_check_call_status(); zephir_throw_exception_debug(&_3$$3, "tensor/matrix.zep", 675); ZEPHIR_MM_RESTORE(); @@ -1954,7 +1954,7 @@ PHP_METHOD(Tensor_Matrix, pseudoinverse) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_5, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_6, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_5, &_6); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_5, &_6); zephir_check_call_status(); RETURN_MM(); } @@ -2012,7 +2012,7 @@ PHP_METHOD(Tensor_Matrix, det) ZEPHIR_CALL_METHOD(&_6, &ref, "swaps", NULL, 0); zephir_check_call_status(); ZVAL_DOUBLE(&_7, -1.0); - ZEPHIR_CALL_FUNCTION(&_8, "pow", NULL, 11, &_7, &_6); + ZEPHIR_CALL_FUNCTION(&_8, "pow", NULL, 9, &_7, &_6); zephir_check_call_status(); mul_function(return_value, &pi, &_8); RETURN_MM(); @@ -2097,7 +2097,7 @@ PHP_METHOD(Tensor_Matrix, fullRank) zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_1, this_ptr, "shape", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_2, "min", NULL, 22, &_1); + ZEPHIR_CALL_FUNCTION(&_2, "min", NULL, 20, &_1); zephir_check_call_status(); RETURN_MM_BOOL(ZEPHIR_IS_IDENTICAL(&_0, &_2)); } @@ -2223,7 +2223,7 @@ PHP_METHOD(Tensor_Matrix, matmul) zephir_read_property_cached(&_13, this_ptr, _zephir_prop_2, 16, PH_NOISY_CC | PH_READONLY); ZEPHIR_CALL_METHOD(&_14, b, "n", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_13, &_14); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_13, &_14); zephir_check_call_status(); RETURN_MM(); } @@ -2509,7 +2509,7 @@ PHP_METHOD(Tensor_Matrix, convolve) ZEPHIR_INIT_NVAR(&_21); zephir_sub_function(&_21, &_32, &mb); ZVAL_LONG(&_31, stride); - ZEPHIR_CALL_FUNCTION(&_33, "intdiv", NULL, 23, &_21, &_31); + ZEPHIR_CALL_FUNCTION(&_33, "intdiv", NULL, 21, &_21, &_31); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_32); ZVAL_LONG(&_32, 1); @@ -2523,14 +2523,14 @@ PHP_METHOD(Tensor_Matrix, convolve) ZEPHIR_INIT_NVAR(&_32); zephir_sub_function(&_32, &_34, &nb); ZVAL_LONG(&_31, stride); - ZEPHIR_CALL_FUNCTION(&_33, "intdiv", NULL, 23, &_32, &_31); + ZEPHIR_CALL_FUNCTION(&_33, "intdiv", NULL, 21, &_32, &_31); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_34); ZVAL_LONG(&_34, 1); ZEPHIR_INIT_VAR(&outN); zephir_add_function(&outN, &_33, &_34); object_init_ex(return_value, tensor_matrix_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &outM, &outN); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &outM, &outN); zephir_check_call_status(); RETURN_MM(); } @@ -3604,7 +3604,7 @@ PHP_METHOD(Tensor_Matrix, abs) tensor_abs(&_0, &_1); zephir_read_property_cached(&_2, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &_0, &_2, &_3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &_0, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } @@ -3664,7 +3664,7 @@ PHP_METHOD(Tensor_Matrix, sqrt) tensor_sqrt(&_0, &_1); zephir_read_property_cached(&_2, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &_0, &_2, &_3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &_0, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } @@ -3706,7 +3706,7 @@ PHP_METHOD(Tensor_Matrix, exp) tensor_exp(&_0, &_1); zephir_read_property_cached(&_2, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &_0, &_2, &_3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &_0, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } @@ -3748,7 +3748,7 @@ PHP_METHOD(Tensor_Matrix, expm1) tensor_expm1(&_0, &_1); zephir_read_property_cached(&_2, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &_0, &_2, &_3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &_0, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } @@ -3825,7 +3825,7 @@ PHP_METHOD(Tensor_Matrix, log) tensor_log(&_4$$4, &_5$$4); zephir_read_property_cached(&_6$$4, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_7$$4, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &_4$$4, &_6$$4, &_7$$4); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &_4$$4, &_6$$4, &_7$$4); zephir_check_call_status(); RETURN_MM(); } @@ -3836,7 +3836,7 @@ PHP_METHOD(Tensor_Matrix, log) tensor_log_base(&_8, &_9, &_10); zephir_read_property_cached(&_11, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_12, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &_8, &_11, &_12); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &_8, &_11, &_12); zephir_check_call_status(); RETURN_MM(); } @@ -3878,7 +3878,7 @@ PHP_METHOD(Tensor_Matrix, log1p) tensor_log1p(&_0, &_1); zephir_read_property_cached(&_2, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &_0, &_2, &_3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &_0, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } @@ -3920,7 +3920,7 @@ PHP_METHOD(Tensor_Matrix, sigmoid) tensor_sigmoid(&_0, &_1); zephir_read_property_cached(&_2, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &_0, &_2, &_3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &_0, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } @@ -3962,7 +3962,7 @@ PHP_METHOD(Tensor_Matrix, sin) tensor_sin(&_0, &_1); zephir_read_property_cached(&_2, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &_0, &_2, &_3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &_0, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } @@ -4004,7 +4004,7 @@ PHP_METHOD(Tensor_Matrix, asin) tensor_asin(&_0, &_1); zephir_read_property_cached(&_2, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &_0, &_2, &_3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &_0, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } @@ -4046,7 +4046,7 @@ PHP_METHOD(Tensor_Matrix, cos) tensor_cos(&_0, &_1); zephir_read_property_cached(&_2, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &_0, &_2, &_3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &_0, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } @@ -4088,7 +4088,7 @@ PHP_METHOD(Tensor_Matrix, acos) tensor_acos(&_0, &_1); zephir_read_property_cached(&_2, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &_0, &_2, &_3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &_0, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } @@ -4130,7 +4130,7 @@ PHP_METHOD(Tensor_Matrix, tan) tensor_tan(&_0, &_1); zephir_read_property_cached(&_2, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &_0, &_2, &_3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &_0, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } @@ -4172,7 +4172,7 @@ PHP_METHOD(Tensor_Matrix, atan) tensor_atan(&_0, &_1); zephir_read_property_cached(&_2, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &_0, &_2, &_3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &_0, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } @@ -4214,7 +4214,7 @@ PHP_METHOD(Tensor_Matrix, tanh) tensor_tanh(&_0, &_1); zephir_read_property_cached(&_2, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &_0, &_2, &_3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &_0, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } @@ -4256,7 +4256,7 @@ PHP_METHOD(Tensor_Matrix, rad2deg) tensor_rad2deg(&_0, &_1); zephir_read_property_cached(&_2, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &_0, &_2, &_3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &_0, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } @@ -4298,7 +4298,7 @@ PHP_METHOD(Tensor_Matrix, deg2rad) tensor_deg2rad(&_0, &_1); zephir_read_property_cached(&_2, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &_0, &_2, &_3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &_0, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } @@ -4657,7 +4657,7 @@ PHP_METHOD(Tensor_Matrix, quantile) zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &q_param); ZVAL_DOUBLE(&_0, q); - ZEPHIR_CALL_FUNCTION(&_1, "is_finite", NULL, 12, &_0); + ZEPHIR_CALL_FUNCTION(&_1, "is_finite", NULL, 10, &_0); zephir_check_call_status(); if (UNEXPECTED(!zephir_is_true(&_1))) { ZEPHIR_INIT_VAR(&_2$$3); @@ -4737,7 +4737,7 @@ PHP_METHOD(Tensor_Matrix, softmax) tensor_softmax(&_0, &_1, &_2); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_2, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_4, this_ptr, _zephir_prop_1, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &_0, &_3, &_4); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &_0, &_3, &_4); zephir_check_call_status(); RETURN_MM(); } @@ -4880,7 +4880,7 @@ PHP_METHOD(Tensor_Matrix, covariance) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_4, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_3, &_4); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_3, &_4); zephir_check_call_status(); RETURN_MM(); } @@ -4952,7 +4952,7 @@ PHP_METHOD(Tensor_Matrix, round) tensor_round(&_4, &_5, &_6); zephir_read_property_cached(&_7, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_8, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &_4, &_7, &_8); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &_4, &_7, &_8); zephir_check_call_status(); RETURN_MM(); } @@ -4994,7 +4994,7 @@ PHP_METHOD(Tensor_Matrix, floor) tensor_floor(&_0, &_1); zephir_read_property_cached(&_2, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &_0, &_2, &_3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &_0, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } @@ -5036,7 +5036,7 @@ PHP_METHOD(Tensor_Matrix, ceil) tensor_ceil(&_0, &_1); zephir_read_property_cached(&_2, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &_0, &_2, &_3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &_0, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } @@ -5078,7 +5078,7 @@ PHP_METHOD(Tensor_Matrix, sign) tensor_sign(&_0, &_1); zephir_read_property_cached(&_2, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &_0, &_2, &_3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &_0, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } @@ -5120,7 +5120,7 @@ PHP_METHOD(Tensor_Matrix, negate) tensor_negate(&_0, &_1); zephir_read_property_cached(&_2, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &_0, &_2, &_3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &_0, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } @@ -5190,7 +5190,7 @@ PHP_METHOD(Tensor_Matrix, clip) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_5, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_6, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_5, &_6); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_5, &_6); zephir_check_call_status(); RETURN_MM(); } @@ -5240,7 +5240,7 @@ PHP_METHOD(Tensor_Matrix, clipLower) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_2, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_2, &_3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } @@ -5290,7 +5290,7 @@ PHP_METHOD(Tensor_Matrix, clipUpper) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_2, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_2, &_3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } @@ -5408,7 +5408,7 @@ PHP_METHOD(Tensor_Matrix, augmentAbove) ZEPHIR_INIT_VAR(&_19); zephir_add_function(&_19, &_17, &_18); ZVAL_LONG(&_18, n); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_19, &_18); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_19, &_18); zephir_check_call_status(); RETURN_MM(); } @@ -5524,7 +5524,7 @@ PHP_METHOD(Tensor_Matrix, augmentBelow) ZEPHIR_INIT_VAR(&_18); zephir_add_function(&_18, &_17, &_16); ZVAL_LONG(&_17, n); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_18, &_17); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_18, &_17); zephir_check_call_status(); RETURN_MM(); } @@ -5687,7 +5687,7 @@ PHP_METHOD(Tensor_Matrix, augmentLeft) ZEPHIR_INIT_VAR(&_31); zephir_add_function(&_31, &_29, &_30); ZVAL_LONG(&_29, m); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_29, &_31); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_29, &_31); zephir_check_call_status(); RETURN_MM(); } @@ -5850,7 +5850,7 @@ PHP_METHOD(Tensor_Matrix, augmentRight) ZEPHIR_INIT_VAR(&_30); zephir_add_function(&_30, &_28, &_29); ZVAL_LONG(&_28, m); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_28, &_30); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_28, &_30); zephir_check_call_status(); RETURN_MM(); } @@ -5954,7 +5954,7 @@ PHP_METHOD(Tensor_Matrix, repeat) ZVAL_LONG(&_13, ((n + 1))); ZEPHIR_INIT_VAR(&_15); mul_function(&_15, &_12, &_13); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_14, &_15); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_14, &_15); zephir_check_call_status(); RETURN_MM(); } @@ -6031,7 +6031,7 @@ PHP_METHOD(Tensor_Matrix, multiplyMatrix) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_8, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_9, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_8, &_9); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_8, &_9); zephir_check_call_status(); RETURN_MM(); } @@ -6108,7 +6108,7 @@ PHP_METHOD(Tensor_Matrix, divideMatrix) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_8, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_9, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_8, &_9); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_8, &_9); zephir_check_call_status(); RETURN_MM(); } @@ -6185,7 +6185,7 @@ PHP_METHOD(Tensor_Matrix, addMatrix) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_8, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_9, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_8, &_9); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_8, &_9); zephir_check_call_status(); RETURN_MM(); } @@ -6262,7 +6262,7 @@ PHP_METHOD(Tensor_Matrix, subtractMatrix) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_8, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_9, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_8, &_9); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_8, &_9); zephir_check_call_status(); RETURN_MM(); } @@ -6340,7 +6340,7 @@ PHP_METHOD(Tensor_Matrix, powMatrix) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_8, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_9, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_8, &_9); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_8, &_9); zephir_check_call_status(); RETURN_MM(); } @@ -6418,7 +6418,7 @@ PHP_METHOD(Tensor_Matrix, modMatrix) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_8, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_9, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_8, &_9); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_8, &_9); zephir_check_call_status(); RETURN_MM(); } @@ -6496,7 +6496,7 @@ PHP_METHOD(Tensor_Matrix, equalMatrix) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_8, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_9, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_8, &_9); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_8, &_9); zephir_check_call_status(); RETURN_MM(); } @@ -6573,7 +6573,7 @@ PHP_METHOD(Tensor_Matrix, notEqualMatrix) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_8, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_9, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_8, &_9); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_8, &_9); zephir_check_call_status(); RETURN_MM(); } @@ -6651,7 +6651,7 @@ PHP_METHOD(Tensor_Matrix, greaterMatrix) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_8, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_9, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_8, &_9); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_8, &_9); zephir_check_call_status(); RETURN_MM(); } @@ -6729,7 +6729,7 @@ PHP_METHOD(Tensor_Matrix, greaterEqualMatrix) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_8, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_9, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_8, &_9); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_8, &_9); zephir_check_call_status(); RETURN_MM(); } @@ -6806,7 +6806,7 @@ PHP_METHOD(Tensor_Matrix, lessMatrix) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_8, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_9, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_8, &_9); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_8, &_9); zephir_check_call_status(); RETURN_MM(); } @@ -6883,7 +6883,7 @@ PHP_METHOD(Tensor_Matrix, lessEqualMatrix) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_8, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_9, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_8, &_9); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_8, &_9); zephir_check_call_status(); RETURN_MM(); } @@ -6966,7 +6966,7 @@ PHP_METHOD(Tensor_Matrix, multiplyVector) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_11, this_ptr, _zephir_prop_2, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_12, this_ptr, _zephir_prop_0, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_11, &_12); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_11, &_12); zephir_check_call_status(); RETURN_MM(); } @@ -7049,7 +7049,7 @@ PHP_METHOD(Tensor_Matrix, divideVector) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_11, this_ptr, _zephir_prop_2, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_12, this_ptr, _zephir_prop_0, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_11, &_12); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_11, &_12); zephir_check_call_status(); RETURN_MM(); } @@ -7132,7 +7132,7 @@ PHP_METHOD(Tensor_Matrix, addVector) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_11, this_ptr, _zephir_prop_2, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_12, this_ptr, _zephir_prop_0, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_11, &_12); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_11, &_12); zephir_check_call_status(); RETURN_MM(); } @@ -7215,7 +7215,7 @@ PHP_METHOD(Tensor_Matrix, subtractVector) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_11, this_ptr, _zephir_prop_2, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_12, this_ptr, _zephir_prop_0, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_11, &_12); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_11, &_12); zephir_check_call_status(); RETURN_MM(); } @@ -7298,7 +7298,7 @@ PHP_METHOD(Tensor_Matrix, powVector) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_11, this_ptr, _zephir_prop_2, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_12, this_ptr, _zephir_prop_0, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_11, &_12); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_11, &_12); zephir_check_call_status(); RETURN_MM(); } @@ -7381,7 +7381,7 @@ PHP_METHOD(Tensor_Matrix, modVector) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_11, this_ptr, _zephir_prop_2, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_12, this_ptr, _zephir_prop_0, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_11, &_12); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_11, &_12); zephir_check_call_status(); RETURN_MM(); } @@ -7465,7 +7465,7 @@ PHP_METHOD(Tensor_Matrix, equalVector) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_11, this_ptr, _zephir_prop_2, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_12, this_ptr, _zephir_prop_0, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_11, &_12); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_11, &_12); zephir_check_call_status(); RETURN_MM(); } @@ -7548,7 +7548,7 @@ PHP_METHOD(Tensor_Matrix, notEqualVector) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_11, this_ptr, _zephir_prop_2, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_12, this_ptr, _zephir_prop_0, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_11, &_12); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_11, &_12); zephir_check_call_status(); RETURN_MM(); } @@ -7631,7 +7631,7 @@ PHP_METHOD(Tensor_Matrix, greaterVector) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_11, this_ptr, _zephir_prop_2, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_12, this_ptr, _zephir_prop_0, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_11, &_12); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_11, &_12); zephir_check_call_status(); RETURN_MM(); } @@ -7714,7 +7714,7 @@ PHP_METHOD(Tensor_Matrix, greaterEqualVector) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_11, this_ptr, _zephir_prop_2, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_12, this_ptr, _zephir_prop_0, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_11, &_12); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_11, &_12); zephir_check_call_status(); RETURN_MM(); } @@ -7797,7 +7797,7 @@ PHP_METHOD(Tensor_Matrix, lessVector) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_11, this_ptr, _zephir_prop_2, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_12, this_ptr, _zephir_prop_0, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_11, &_12); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_11, &_12); zephir_check_call_status(); RETURN_MM(); } @@ -7881,7 +7881,7 @@ PHP_METHOD(Tensor_Matrix, lessEqualVector) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_11, this_ptr, _zephir_prop_2, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_12, this_ptr, _zephir_prop_0, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_11, &_12); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_11, &_12); zephir_check_call_status(); RETURN_MM(); } @@ -7964,7 +7964,7 @@ PHP_METHOD(Tensor_Matrix, multiplyColumnVector) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_11, this_ptr, _zephir_prop_0, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_12, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_11, &_12); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_11, &_12); zephir_check_call_status(); RETURN_MM(); } @@ -8047,7 +8047,7 @@ PHP_METHOD(Tensor_Matrix, divideColumnVector) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_11, this_ptr, _zephir_prop_0, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_12, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_11, &_12); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_11, &_12); zephir_check_call_status(); RETURN_MM(); } @@ -8130,7 +8130,7 @@ PHP_METHOD(Tensor_Matrix, addColumnVector) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_11, this_ptr, _zephir_prop_0, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_12, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_11, &_12); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_11, &_12); zephir_check_call_status(); RETURN_MM(); } @@ -8213,7 +8213,7 @@ PHP_METHOD(Tensor_Matrix, subtractColumnVector) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_11, this_ptr, _zephir_prop_0, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_12, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_11, &_12); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_11, &_12); zephir_check_call_status(); RETURN_MM(); } @@ -8296,7 +8296,7 @@ PHP_METHOD(Tensor_Matrix, powColumnVector) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_11, this_ptr, _zephir_prop_0, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_12, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_11, &_12); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_11, &_12); zephir_check_call_status(); RETURN_MM(); } @@ -8379,7 +8379,7 @@ PHP_METHOD(Tensor_Matrix, modColumnVector) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_11, this_ptr, _zephir_prop_0, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_12, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_11, &_12); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_11, &_12); zephir_check_call_status(); RETURN_MM(); } @@ -8462,7 +8462,7 @@ PHP_METHOD(Tensor_Matrix, equalColumnVector) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_11, this_ptr, _zephir_prop_0, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_12, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_11, &_12); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_11, &_12); zephir_check_call_status(); RETURN_MM(); } @@ -8545,7 +8545,7 @@ PHP_METHOD(Tensor_Matrix, notEqualColumnVector) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_11, this_ptr, _zephir_prop_0, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_12, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_11, &_12); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_11, &_12); zephir_check_call_status(); RETURN_MM(); } @@ -8628,7 +8628,7 @@ PHP_METHOD(Tensor_Matrix, greaterColumnVector) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_11, this_ptr, _zephir_prop_0, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_12, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_11, &_12); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_11, &_12); zephir_check_call_status(); RETURN_MM(); } @@ -8711,7 +8711,7 @@ PHP_METHOD(Tensor_Matrix, greaterEqualColumnVector) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_11, this_ptr, _zephir_prop_0, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_12, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_11, &_12); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_11, &_12); zephir_check_call_status(); RETURN_MM(); } @@ -8794,7 +8794,7 @@ PHP_METHOD(Tensor_Matrix, lessColumnVector) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_11, this_ptr, _zephir_prop_0, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_12, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_11, &_12); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_11, &_12); zephir_check_call_status(); RETURN_MM(); } @@ -8877,7 +8877,7 @@ PHP_METHOD(Tensor_Matrix, lessEqualColumnVector) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_11, this_ptr, _zephir_prop_0, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_12, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_11, &_12); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_11, &_12); zephir_check_call_status(); RETURN_MM(); } @@ -8927,7 +8927,7 @@ PHP_METHOD(Tensor_Matrix, multiplyScalar) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_2, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_2, &_3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } @@ -8977,7 +8977,7 @@ PHP_METHOD(Tensor_Matrix, divideScalar) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_2, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_2, &_3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } @@ -9027,7 +9027,7 @@ PHP_METHOD(Tensor_Matrix, addScalar) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_2, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_2, &_3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } @@ -9077,7 +9077,7 @@ PHP_METHOD(Tensor_Matrix, subtractScalar) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_2, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_2, &_3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } @@ -9127,7 +9127,7 @@ PHP_METHOD(Tensor_Matrix, powScalar) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_2, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_2, &_3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } @@ -9177,7 +9177,7 @@ PHP_METHOD(Tensor_Matrix, modScalar) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_2, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_2, &_3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } @@ -9227,7 +9227,7 @@ PHP_METHOD(Tensor_Matrix, equalScalar) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_2, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_2, &_3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } @@ -9277,7 +9277,7 @@ PHP_METHOD(Tensor_Matrix, notEqualScalar) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_2, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_2, &_3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } @@ -9327,7 +9327,7 @@ PHP_METHOD(Tensor_Matrix, greaterScalar) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_2, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_2, &_3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } @@ -9378,7 +9378,7 @@ PHP_METHOD(Tensor_Matrix, greaterEqualScalar) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_2, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_2, &_3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } @@ -9428,7 +9428,7 @@ PHP_METHOD(Tensor_Matrix, lessScalar) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_2, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_2, &_3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } @@ -9479,7 +9479,7 @@ PHP_METHOD(Tensor_Matrix, lessEqualScalar) object_init_ex(return_value, tensor_matrix_ce); zephir_read_property_cached(&_2, this_ptr, _zephir_prop_1, 16, PH_NOISY_CC | PH_READONLY); zephir_read_property_cached(&_3, this_ptr, _zephir_prop_2, 17, PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 18, &buffer, &_2, &_3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 16, &buffer, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } @@ -9679,7 +9679,7 @@ PHP_METHOD(Tensor_Matrix, getIterator) object_init_ex(return_value, spl_ce_ArrayIterator); ZEPHIR_CALL_METHOD(&_0, this_ptr, "asVectors", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 13, &_0); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 11, &_0); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/tensor/reductions/ref.zep.c b/ext/tensor/reductions/ref.zep.c index 85add5b..b23679b 100644 --- a/ext/tensor/reductions/ref.zep.c +++ b/ext/tensor/reductions/ref.zep.c @@ -113,7 +113,7 @@ PHP_METHOD(Tensor_Reductions_Ref, reduce) swaps = zephir_get_intval(&_8); object_init_ex(return_value, tensor_reductions_ref_ce); ZVAL_LONG(&_9, swaps); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 24, &b, &_9); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 22, &b, &_9); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/tensor/reductions/rref.zep.c b/ext/tensor/reductions/rref.zep.c index 48e4b71..0563b5f 100644 --- a/ext/tensor/reductions/rref.zep.c +++ b/ext/tensor/reductions/rref.zep.c @@ -86,7 +86,7 @@ PHP_METHOD(Tensor_Reductions_Rref, reduce) zephir_check_call_status(); ZEPHIR_CALL_CE_STATIC(&_3, tensor_matrix_ce, "fromBuffer", NULL, 0, &result, &_4, &_5); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 25, &_3); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 23, &_3); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/tensor/tensorbuffer.zep.c b/ext/tensor/tensorbuffer.zep.c index 71d17cf..6c934b9 100644 --- a/ext/tensor/tensorbuffer.zep.c +++ b/ext/tensor/tensorbuffer.zep.c @@ -95,7 +95,7 @@ PHP_METHOD(Tensor_TensorBuffer, fromBuffers) zephir_memory_observe(&_2); zephir_array_fetch_long(&_2, &buffers, 0, PH_NOISY, "tensor/tensorbuffer.zep", 50); ZVAL_LONG(&_3, 1); - ZEPHIR_CALL_FUNCTION(&_4, "array_slice", NULL, 26, &buffers, &_3); + ZEPHIR_CALL_FUNCTION(&_4, "array_slice", NULL, 24, &buffers, &_3); zephir_check_call_status(); ZEPHIR_RETURN_CALL_METHOD(&_2, "concat", NULL, 0, &_4); zephir_check_call_status(); @@ -324,7 +324,7 @@ PHP_METHOD(Tensor_TensorBuffer, slice) ZVAL_LONG(&_10, length); tensor_buffer_slice(&b, &_8, &_9, &_10); object_init_ex(return_value, tensor_tensorbuffer_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 27, &b); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 25, &b); zephir_check_call_status(); RETURN_MM(); } @@ -454,7 +454,7 @@ PHP_METHOD(Tensor_TensorBuffer, sliceStrided) ZVAL_LONG(&_15, stride); tensor_buffer_slice_strided(&b, &_12, &_13, &_14, &_15); object_init_ex(return_value, tensor_tensorbuffer_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 27, &b); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 25, &b); zephir_check_call_status(); RETURN_MM(); } @@ -535,7 +535,7 @@ PHP_METHOD(Tensor_TensorBuffer, concat) zephir_read_property_cached(&_5, this_ptr, _zephir_prop_0, 21, PH_NOISY_CC | PH_READONLY); tensor_buffer_concat(&b, &_5, &unwrapped); object_init_ex(return_value, tensor_tensorbuffer_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 27, &b); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 25, &b); zephir_check_call_status(); RETURN_MM(); } @@ -617,7 +617,7 @@ PHP_METHOD(Tensor_TensorBuffer, split) ZVAL_COPY(&buffer, _8); ZEPHIR_INIT_NVAR(&_9$$4); object_init_ex(&_9$$4, tensor_tensorbuffer_ce); - ZEPHIR_CALL_METHOD(NULL, &_9$$4, "__construct", &_10, 27, &buffer); + ZEPHIR_CALL_METHOD(NULL, &_9$$4, "__construct", &_10, 25, &buffer); zephir_check_call_status(); zephir_array_append(&tensorBuffers, &_9$$4, PH_SEPARATE, "tensor/tensorbuffer.zep", 232); } ZEND_HASH_FOREACH_END(); @@ -641,7 +641,7 @@ PHP_METHOD(Tensor_TensorBuffer, split) zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_13$$5); object_init_ex(&_13$$5, tensor_tensorbuffer_ce); - ZEPHIR_CALL_METHOD(NULL, &_13$$5, "__construct", &_10, 27, &buffer); + ZEPHIR_CALL_METHOD(NULL, &_13$$5, "__construct", &_10, 25, &buffer); zephir_check_call_status(); zephir_array_append(&tensorBuffers, &_13$$5, PH_SEPARATE, "tensor/tensorbuffer.zep", 232); } @@ -702,7 +702,7 @@ PHP_METHOD(Tensor_TensorBuffer, repeat) ZVAL_LONG(&_5, times); tensor_buffer_repeat(&b, &_4, &_5); object_init_ex(return_value, tensor_tensorbuffer_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 27, &b); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 25, &b); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/tensor/vector.zep.c b/ext/tensor/vector.zep.c index 8773d18..3def1e0 100644 --- a/ext/tensor/vector.zep.c +++ b/ext/tensor/vector.zep.c @@ -549,19 +549,29 @@ PHP_METHOD(Tensor_Vector, uniform) * @param float start * @param float end * @param float interval + * @throws \Tensor\Exceptions\InvalidArgumentException * @return self */ PHP_METHOD(Tensor_Vector, range) { + zval _2$$4, _9$$5; + zend_bool _0, _3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_6 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *start_param = NULL, *end_param = NULL, *interval_param = NULL, _0, _1, _2, _3; + zval *start_param = NULL, *end_param = NULL, *interval_param = NULL, _4, _5, _7, _10, _11, _12, _1$$4, _8$$5; double start, end, interval; - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&_7); + ZVAL_UNDEF(&_10); + ZVAL_UNDEF(&_11); + ZVAL_UNDEF(&_12); + ZVAL_UNDEF(&_1$$4); + ZVAL_UNDEF(&_8$$5); + ZVAL_UNDEF(&_2$$4); + ZVAL_UNDEF(&_9$$5); ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_DOUBLE(start) Z_PARAM_DOUBLE(end) @@ -575,13 +585,53 @@ PHP_METHOD(Tensor_Vector, range) interval = 1.0; } else { } - ZVAL_DOUBLE(&_0, start); - ZVAL_DOUBLE(&_1, end); - ZVAL_DOUBLE(&_2, interval); - ZEPHIR_CALL_FUNCTION(&_3, "range", NULL, 6, &_0, &_1, &_2); - zephir_check_call_status(); - ZVAL_BOOL(&_0, 0); - ZEPHIR_RETURN_CALL_STATIC("fromArray", NULL, 0, &_3, &_0); + if (UNEXPECTED(interval == 0.0)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(tensor_exceptions_invalidargumentexception_ce, "Interval cannot be zero.", "tensor/vector.zep", 216); + return; + } + _0 = end > start; + if (_0) { + _0 = interval < 0.0; + } + if (UNEXPECTED(_0)) { + ZEPHIR_INIT_VAR(&_1$$4); + object_init_ex(&_1$$4, tensor_exceptions_invalidargumentexception_ce); + ZEPHIR_INIT_VAR(&_2$$4); + ZEPHIR_CONCAT_SS(&_2$$4, "Interval must be positive", " when the end is greater than the start."); + ZEPHIR_CALL_METHOD(NULL, &_1$$4, "__construct", NULL, 2, &_2$$4); + zephir_check_call_status(); + zephir_throw_exception_debug(&_1$$4, "tensor/vector.zep", 221); + ZEPHIR_MM_RESTORE(); + return; + } + _3 = start != end; + if (_3) { + ZVAL_DOUBLE(&_4, (end - start)); + ZEPHIR_CALL_FUNCTION(&_5, "abs", &_6, 6, &_4); + zephir_check_call_status(); + ZVAL_DOUBLE(&_4, interval); + ZEPHIR_CALL_FUNCTION(&_7, "abs", &_6, 6, &_4); + zephir_check_call_status(); + _3 = ZEPHIR_LT(&_5, &_7); + } + if (UNEXPECTED(_3)) { + ZEPHIR_INIT_VAR(&_8$$5); + object_init_ex(&_8$$5, tensor_exceptions_invalidargumentexception_ce); + ZEPHIR_INIT_VAR(&_9$$5); + ZEPHIR_CONCAT_SS(&_9$$5, "Interval must be smaller", " than the range spanned by the start and end."); + ZEPHIR_CALL_METHOD(NULL, &_8$$5, "__construct", NULL, 2, &_9$$5); + zephir_check_call_status(); + zephir_throw_exception_debug(&_8$$5, "tensor/vector.zep", 226); + ZEPHIR_MM_RESTORE(); + return; + } + object_init_ex(return_value, zend_get_called_scope(execute_data)); + ZEPHIR_INIT_VAR(&_10); + ZVAL_DOUBLE(&_4, start); + ZVAL_DOUBLE(&_11, end); + ZVAL_DOUBLE(&_12, interval); + tensor_range(&_10, &_4, &_11, &_12); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 3, &_10); zephir_check_call_status(); RETURN_MM(); } @@ -597,12 +647,10 @@ PHP_METHOD(Tensor_Vector, range) */ PHP_METHOD(Tensor_Vector, linspace) { - zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_9 = NULL; - zend_long n, ZEPHIR_LAST_CALL_STATUS, k; - zval *min_param = NULL, *max_param = NULL, *n_param = NULL, _0$$4, _1$$4, _2$$4, _3$$4, _4, _5, _6, _7, _8$$5, _10$$5, _11$$5; - double min, max, interval; + zend_long n, ZEPHIR_LAST_CALL_STATUS; + zval *min_param = NULL, *max_param = NULL, *n_param = NULL, _0$$4, _1$$4, _2$$4, _3$$4, _4, _5, _6, _7; + double min, max; ZVAL_UNDEF(&_0$$4); ZVAL_UNDEF(&_1$$4); @@ -612,10 +660,6 @@ PHP_METHOD(Tensor_Vector, linspace) ZVAL_UNDEF(&_5); ZVAL_UNDEF(&_6); ZVAL_UNDEF(&_7); - ZVAL_UNDEF(&_8$$5); - ZVAL_UNDEF(&_10$$5); - ZVAL_UNDEF(&_11$$5); - ZVAL_UNDEF(&a); ZEND_PARSE_PARAMETERS_START(3, 3) Z_PARAM_DOUBLE(min) Z_PARAM_DOUBLE(max) @@ -625,7 +669,7 @@ PHP_METHOD(Tensor_Vector, linspace) zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 3, 0, &min_param, &max_param, &n_param); if (UNEXPECTED(min > max)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(tensor_exceptions_invalidargumentexception_ce, "Minimum must be less than maximum.", "tensor/vector.zep", 229); + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(tensor_exceptions_invalidargumentexception_ce, "Minimum must be less than maximum.", "tensor/vector.zep", 244); return; } if (UNEXPECTED(n < 2)) { @@ -638,41 +682,17 @@ PHP_METHOD(Tensor_Vector, linspace) ZEPHIR_CONCAT_SSVS(&_3$$4, "Number of elements", " must be greater than 1, ", &_2$$4, " given."); ZEPHIR_CALL_METHOD(NULL, &_0$$4, "__construct", NULL, 2, &_3$$4); zephir_check_call_status(); - zephir_throw_exception_debug(&_0$$4, "tensor/vector.zep", 234); + zephir_throw_exception_debug(&_0$$4, "tensor/vector.zep", 249); ZEPHIR_MM_RESTORE(); return; } - k = (n - 1); - ZVAL_DOUBLE(&_4, (max - min)); - ZEPHIR_CALL_FUNCTION(&_5, "abs", NULL, 7, &_4); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_6); - zephir_div_zval_long(&_6, &_5, k); - interval = zephir_get_numberval(&_6); - ZEPHIR_INIT_VAR(&a); - zephir_create_array(&a, 1, 0); - ZEPHIR_INIT_VAR(&_7); - ZVAL_DOUBLE(&_7, min); - zephir_array_fast_append(&a, &_7); - while (1) { - if (!(zephir_fast_count_int(&a) < k)) { - break; - } - ZEPHIR_MAKE_REF(&a); - ZEPHIR_CALL_FUNCTION(&_8$$5, "end", &_9, 8, &a); - ZEPHIR_UNREF(&a); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_10$$5); - ZVAL_DOUBLE(&_10$$5, interval); - ZEPHIR_INIT_NVAR(&_11$$5); - zephir_add_function(&_11$$5, &_8$$5, &_10$$5); - zephir_array_append(&a, &_11$$5, PH_SEPARATE, "tensor/vector.zep", 244); - } - ZEPHIR_INIT_NVAR(&_7); - ZVAL_DOUBLE(&_7, max); - zephir_array_append(&a, &_7, PH_SEPARATE, "tensor/vector.zep", 247); - ZVAL_BOOL(&_4, 0); - ZEPHIR_RETURN_CALL_SELF("fromArray", NULL, 0, &a, &_4); + object_init_ex(return_value, zend_get_called_scope(execute_data)); + ZEPHIR_INIT_VAR(&_4); + ZVAL_DOUBLE(&_5, min); + ZVAL_DOUBLE(&_6, max); + ZVAL_LONG(&_7, n); + tensor_linspace(&_4, &_5, &_6, &_7); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 3, &_4); zephir_check_call_status(); RETURN_MM(); } @@ -746,7 +766,7 @@ PHP_METHOD(Tensor_Vector, __construct) ZEPHIR_CONCAT_SS(&_2$$3, "Argument must wrap a buffer of", " type double."); ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 2, &_2$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_1$$3, "tensor/vector.zep", 273); + zephir_throw_exception_debug(&_1$$3, "tensor/vector.zep", 276); ZEPHIR_MM_RESTORE(); return; } @@ -1005,7 +1025,7 @@ PHP_METHOD(Tensor_Vector, reshape) ZEPHIR_CONCAT_SS(&_2$$3, "The number of rows", " and/or columns cannot be less than 0."); ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 2, &_2$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_1$$3, "tensor/vector.zep", 384); + zephir_throw_exception_debug(&_1$$3, "tensor/vector.zep", 387); ZEPHIR_MM_RESTORE(); return; } @@ -1022,7 +1042,7 @@ PHP_METHOD(Tensor_Vector, reshape) ZEPHIR_CONCAT_VSSVS(&_7$$4, &_6$$4, " elements", " are needed but vector only has ", &_5$$4, "."); ZEPHIR_CALL_METHOD(NULL, &_4$$4, "__construct", NULL, 2, &_7$$4); zephir_check_call_status(); - zephir_throw_exception_debug(&_4$$4, "tensor/vector.zep", 391); + zephir_throw_exception_debug(&_4$$4, "tensor/vector.zep", 394); ZEPHIR_MM_RESTORE(); return; } @@ -1094,7 +1114,7 @@ PHP_METHOD(Tensor_Vector, map) zephir_read_property_cached(&_0, this_ptr, _zephir_prop_0, 1, PH_NOISY_CC | PH_READONLY); ZEPHIR_CALL_METHOD(&_1, &_0, "toArray", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_2, "array_map", NULL, 9, callback, &_1); + ZEPHIR_CALL_FUNCTION(&_2, "array_map", NULL, 7, callback, &_1); zephir_check_call_status(); ZVAL_BOOL(&_3, 0); ZEPHIR_RETURN_CALL_STATIC("fromArray", NULL, 0, &_2, &_3); @@ -1144,7 +1164,7 @@ PHP_METHOD(Tensor_Vector, reduce) ZEPHIR_CALL_METHOD(&_1, &_0, "toArray", NULL, 0); zephir_check_call_status(); ZVAL_DOUBLE(&_2, initial); - ZEPHIR_RETURN_CALL_FUNCTION("array_reduce", NULL, 10, &_1, callback, &_2); + ZEPHIR_RETURN_CALL_FUNCTION("array_reduce", NULL, 8, &_1, callback, &_2); zephir_check_call_status(); RETURN_MM(); } @@ -1206,7 +1226,7 @@ PHP_METHOD(Tensor_Vector, dot) ZEPHIR_CONCAT_SVSVS(&_7$$3, "Vector A expects ", &_4$$3, " elements but vector B has ", &_6$$3, "."); ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 2, &_7$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 446); + zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 449); ZEPHIR_MM_RESTORE(); return; } @@ -1295,7 +1315,7 @@ PHP_METHOD(Tensor_Vector, convolve) ZEPHIR_CALL_METHOD(&_0, b, "size", NULL, 0); zephir_check_call_status(); if (UNEXPECTED(ZEPHIR_LT_LONG(&_0, 1))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(tensor_exceptions_invalidargumentexception_ce, "Vector B cannot be empty.", "tensor/vector.zep", 471); + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(tensor_exceptions_invalidargumentexception_ce, "Vector B cannot be empty.", "tensor/vector.zep", 474); return; } if (UNEXPECTED(stride < 1)) { @@ -1308,7 +1328,7 @@ PHP_METHOD(Tensor_Vector, convolve) ZEPHIR_CONCAT_SSVS(&_5$$4, "Stride cannot be", " less than 1, ", &_3$$4, " given."); ZEPHIR_CALL_METHOD(NULL, &_1$$4, "__construct", NULL, 2, &_5$$4); zephir_check_call_status(); - zephir_throw_exception_debug(&_1$$4, "tensor/vector.zep", 476); + zephir_throw_exception_debug(&_1$$4, "tensor/vector.zep", 479); ZEPHIR_MM_RESTORE(); return; } @@ -1322,7 +1342,7 @@ PHP_METHOD(Tensor_Vector, convolve) ZEPHIR_CONCAT_SSVS(&_9$$5, "Padding cannot be", " negative, ", &_8$$5, " given."); ZEPHIR_CALL_METHOD(NULL, &_6$$5, "__construct", NULL, 2, &_9$$5); zephir_check_call_status(); - zephir_throw_exception_debug(&_6$$5, "tensor/vector.zep", 481); + zephir_throw_exception_debug(&_6$$5, "tensor/vector.zep", 484); ZEPHIR_MM_RESTORE(); return; } @@ -1354,7 +1374,7 @@ PHP_METHOD(Tensor_Vector, convolve) ZEPHIR_CONCAT_SSVS(&_21$$6, "Vector B cannot be larger than", " Vector A plus the padding of ", &_20$$6, "."); ZEPHIR_CALL_METHOD(NULL, &_18$$6, "__construct", NULL, 2, &_21$$6); zephir_check_call_status(); - zephir_throw_exception_debug(&_18$$6, "tensor/vector.zep", 491); + zephir_throw_exception_debug(&_18$$6, "tensor/vector.zep", 494); ZEPHIR_MM_RESTORE(); return; } @@ -1567,7 +1587,7 @@ PHP_METHOD(Tensor_Vector, pNorm) ZEPHIR_CONCAT_SSVS(&_3$$3, "P must be greater", " than 0, ", &_2$$3, " given."); ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 2, &_3$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_0$$3, "tensor/vector.zep", 563); + zephir_throw_exception_debug(&_0$$3, "tensor/vector.zep", 566); ZEPHIR_MM_RESTORE(); return; } @@ -1579,7 +1599,7 @@ PHP_METHOD(Tensor_Vector, pNorm) ZEPHIR_CALL_METHOD(&_7, &_5, "sum", NULL, 0); zephir_check_call_status(); ZVAL_DOUBLE(&_6, zephir_safe_div_double_double(1.0, p)); - ZEPHIR_RETURN_CALL_FUNCTION("pow", NULL, 11, &_7, &_6); + ZEPHIR_RETURN_CALL_FUNCTION("pow", NULL, 9, &_7, &_6); zephir_check_call_status(); RETURN_MM(); } @@ -1660,7 +1680,7 @@ PHP_METHOD(Tensor_Vector, multiply) ZEPHIR_CONCAT_SS(&_2, "Cannot multiply", " vector by the given input."); ZEPHIR_CALL_METHOD(NULL, &_1, "__construct", NULL, 2, &_2); zephir_check_call_status(); - zephir_throw_exception_debug(&_1, "tensor/vector.zep", 603); + zephir_throw_exception_debug(&_1, "tensor/vector.zep", 606); ZEPHIR_MM_RESTORE(); return; } @@ -1717,7 +1737,7 @@ PHP_METHOD(Tensor_Vector, divide) ZEPHIR_CONCAT_SS(&_2, "Cannot divide", " vector by the given input."); ZEPHIR_CALL_METHOD(NULL, &_1, "__construct", NULL, 2, &_2); zephir_check_call_status(); - zephir_throw_exception_debug(&_1, "tensor/vector.zep", 630); + zephir_throw_exception_debug(&_1, "tensor/vector.zep", 633); ZEPHIR_MM_RESTORE(); return; } @@ -1775,7 +1795,7 @@ PHP_METHOD(Tensor_Vector, add) ZEPHIR_CONCAT_SS(&_2, "Cannot add", " vector by the given input."); ZEPHIR_CALL_METHOD(NULL, &_1, "__construct", NULL, 2, &_2); zephir_check_call_status(); - zephir_throw_exception_debug(&_1, "tensor/vector.zep", 658); + zephir_throw_exception_debug(&_1, "tensor/vector.zep", 661); ZEPHIR_MM_RESTORE(); return; } @@ -1833,7 +1853,7 @@ PHP_METHOD(Tensor_Vector, subtract) ZEPHIR_CONCAT_SS(&_2, "Cannot subtract", " vector from the given input."); ZEPHIR_CALL_METHOD(NULL, &_1, "__construct", NULL, 2, &_2); zephir_check_call_status(); - zephir_throw_exception_debug(&_1, "tensor/vector.zep", 686); + zephir_throw_exception_debug(&_1, "tensor/vector.zep", 689); ZEPHIR_MM_RESTORE(); return; } @@ -1891,7 +1911,7 @@ PHP_METHOD(Tensor_Vector, pow) ZEPHIR_CONCAT_SS(&_2, "Cannot raise", " vector to the power of the given input."); ZEPHIR_CALL_METHOD(NULL, &_1, "__construct", NULL, 2, &_2); zephir_check_call_status(); - zephir_throw_exception_debug(&_1, "tensor/vector.zep", 714); + zephir_throw_exception_debug(&_1, "tensor/vector.zep", 717); ZEPHIR_MM_RESTORE(); return; } @@ -1949,7 +1969,7 @@ PHP_METHOD(Tensor_Vector, mod) ZEPHIR_CONCAT_SS(&_2, "Cannot mod", " vector with the given input."); ZEPHIR_CALL_METHOD(NULL, &_1, "__construct", NULL, 2, &_2); zephir_check_call_status(); - zephir_throw_exception_debug(&_1, "tensor/vector.zep", 742); + zephir_throw_exception_debug(&_1, "tensor/vector.zep", 745); ZEPHIR_MM_RESTORE(); return; } @@ -2007,7 +2027,7 @@ PHP_METHOD(Tensor_Vector, equal) ZEPHIR_CONCAT_SS(&_2, "Cannot compare", " vector to the given input."); ZEPHIR_CALL_METHOD(NULL, &_1, "__construct", NULL, 2, &_2); zephir_check_call_status(); - zephir_throw_exception_debug(&_1, "tensor/vector.zep", 770); + zephir_throw_exception_debug(&_1, "tensor/vector.zep", 773); ZEPHIR_MM_RESTORE(); return; } @@ -2065,7 +2085,7 @@ PHP_METHOD(Tensor_Vector, notEqual) ZEPHIR_CONCAT_SS(&_2, "Cannot compare", " vector to the given input."); ZEPHIR_CALL_METHOD(NULL, &_1, "__construct", NULL, 2, &_2); zephir_check_call_status(); - zephir_throw_exception_debug(&_1, "tensor/vector.zep", 798); + zephir_throw_exception_debug(&_1, "tensor/vector.zep", 801); ZEPHIR_MM_RESTORE(); return; } @@ -2123,7 +2143,7 @@ PHP_METHOD(Tensor_Vector, greater) ZEPHIR_CONCAT_SS(&_2, "Cannot compare", " vector to the given input."); ZEPHIR_CALL_METHOD(NULL, &_1, "__construct", NULL, 2, &_2); zephir_check_call_status(); - zephir_throw_exception_debug(&_1, "tensor/vector.zep", 826); + zephir_throw_exception_debug(&_1, "tensor/vector.zep", 829); ZEPHIR_MM_RESTORE(); return; } @@ -2181,7 +2201,7 @@ PHP_METHOD(Tensor_Vector, greaterEqual) ZEPHIR_CONCAT_SS(&_2, "Cannot compare", " vector to the given input."); ZEPHIR_CALL_METHOD(NULL, &_1, "__construct", NULL, 2, &_2); zephir_check_call_status(); - zephir_throw_exception_debug(&_1, "tensor/vector.zep", 854); + zephir_throw_exception_debug(&_1, "tensor/vector.zep", 857); ZEPHIR_MM_RESTORE(); return; } @@ -2239,7 +2259,7 @@ PHP_METHOD(Tensor_Vector, less) ZEPHIR_CONCAT_SS(&_2, "Cannot compare", " vector to the given input."); ZEPHIR_CALL_METHOD(NULL, &_1, "__construct", NULL, 2, &_2); zephir_check_call_status(); - zephir_throw_exception_debug(&_1, "tensor/vector.zep", 882); + zephir_throw_exception_debug(&_1, "tensor/vector.zep", 885); ZEPHIR_MM_RESTORE(); return; } @@ -2297,7 +2317,7 @@ PHP_METHOD(Tensor_Vector, lessEqual) ZEPHIR_CONCAT_SS(&_2, "Cannot compare", " vector to the given input."); ZEPHIR_CALL_METHOD(NULL, &_1, "__construct", NULL, 2, &_2); zephir_check_call_status(); - zephir_throw_exception_debug(&_1, "tensor/vector.zep", 910); + zephir_throw_exception_debug(&_1, "tensor/vector.zep", 913); ZEPHIR_MM_RESTORE(); return; } @@ -2518,7 +2538,7 @@ PHP_METHOD(Tensor_Vector, log) ZEPHIR_CONCAT_SSVS(&_3$$3, "Log base must be greater", " than 0, ", &_2$$3, " given."); ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 2, &_3$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_0$$3, "tensor/vector.zep", 984); + zephir_throw_exception_debug(&_0$$3, "tensor/vector.zep", 987); ZEPHIR_MM_RESTORE(); return; } @@ -2992,7 +3012,7 @@ PHP_METHOD(Tensor_Vector, min) ZEPHIR_CONCAT_SS(&_2$$3, "Cannot compute", " the minimum of an empty vector."); ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 2, &_2$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_1$$3, "tensor/vector.zep", 1137); + zephir_throw_exception_debug(&_1$$3, "tensor/vector.zep", 1140); ZEPHIR_MM_RESTORE(); return; } @@ -3048,7 +3068,7 @@ PHP_METHOD(Tensor_Vector, max) ZEPHIR_CONCAT_SS(&_2$$3, "Cannot compute", " the maximum of an empty vector."); ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 2, &_2$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_1$$3, "tensor/vector.zep", 1154); + zephir_throw_exception_debug(&_1$$3, "tensor/vector.zep", 1157); ZEPHIR_MM_RESTORE(); return; } @@ -3104,7 +3124,7 @@ PHP_METHOD(Tensor_Vector, argmin) ZEPHIR_CONCAT_SS(&_2$$3, "Cannot compute", " the argmin of an empty vector."); ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 2, &_2$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_1$$3, "tensor/vector.zep", 1171); + zephir_throw_exception_debug(&_1$$3, "tensor/vector.zep", 1174); ZEPHIR_MM_RESTORE(); return; } @@ -3160,7 +3180,7 @@ PHP_METHOD(Tensor_Vector, argmax) ZEPHIR_CONCAT_SS(&_2$$3, "Cannot compute", " the argmax of an empty vector."); ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 2, &_2$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_1$$3, "tensor/vector.zep", 1188); + zephir_throw_exception_debug(&_1$$3, "tensor/vector.zep", 1191); ZEPHIR_MM_RESTORE(); return; } @@ -3243,7 +3263,7 @@ PHP_METHOD(Tensor_Vector, median) ZEPHIR_CONCAT_SS(&_2$$3, "Cannot compute", " the median of an empty vector."); ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 2, &_2$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_1$$3, "tensor/vector.zep", 1215); + zephir_throw_exception_debug(&_1$$3, "tensor/vector.zep", 1218); ZEPHIR_MM_RESTORE(); return; } @@ -3306,7 +3326,7 @@ PHP_METHOD(Tensor_Vector, quantile) zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &q_param); ZVAL_DOUBLE(&_0, q); - ZEPHIR_CALL_FUNCTION(&_1, "is_finite", NULL, 12, &_0); + ZEPHIR_CALL_FUNCTION(&_1, "is_finite", NULL, 10, &_0); zephir_check_call_status(); if (UNEXPECTED(!zephir_is_true(&_1))) { ZEPHIR_INIT_VAR(&_2$$3); @@ -3315,7 +3335,7 @@ PHP_METHOD(Tensor_Vector, quantile) ZEPHIR_CONCAT_SS(&_3$$3, "Q must be a finite value", " between 0 and 1."); ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 2, &_3$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1234); + zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1237); ZEPHIR_MM_RESTORE(); return; } @@ -3333,7 +3353,7 @@ PHP_METHOD(Tensor_Vector, quantile) ZEPHIR_CONCAT_SSVS(&_8$$4, "Q must be", " between 0 and 1, ", &_7$$4, " given."); ZEPHIR_CALL_METHOD(NULL, &_5$$4, "__construct", NULL, 2, &_8$$4); zephir_check_call_status(); - zephir_throw_exception_debug(&_5$$4, "tensor/vector.zep", 1239); + zephir_throw_exception_debug(&_5$$4, "tensor/vector.zep", 1242); ZEPHIR_MM_RESTORE(); return; } @@ -3345,7 +3365,7 @@ PHP_METHOD(Tensor_Vector, quantile) ZEPHIR_CONCAT_SS(&_10$$5, "Cannot compute", " the quantile of an empty vector."); ZEPHIR_CALL_METHOD(NULL, &_9$$5, "__construct", NULL, 2, &_10$$5); zephir_check_call_status(); - zephir_throw_exception_debug(&_9$$5, "tensor/vector.zep", 1244); + zephir_throw_exception_debug(&_9$$5, "tensor/vector.zep", 1247); ZEPHIR_MM_RESTORE(); return; } @@ -3454,7 +3474,7 @@ PHP_METHOD(Tensor_Vector, variance) ZEPHIR_CONCAT_SSVS(&_3$$4, "Mean scalar must be", " a floating point number ", &_2$$4, " given."); ZEPHIR_CALL_METHOD(NULL, &_1$$4, "__construct", NULL, 2, &_3$$4); zephir_check_call_status(); - zephir_throw_exception_debug(&_1$$4, "tensor/vector.zep", 1277); + zephir_throw_exception_debug(&_1$$4, "tensor/vector.zep", 1280); ZEPHIR_MM_RESTORE(); return; } @@ -3520,7 +3540,7 @@ PHP_METHOD(Tensor_Vector, round) ZEPHIR_CONCAT_SSVS(&_3$$3, "Decimal precision cannot", " be less than 0, ", &_2$$3, " given."); ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 2, &_3$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_0$$3, "tensor/vector.zep", 1301); + zephir_throw_exception_debug(&_0$$3, "tensor/vector.zep", 1304); ZEPHIR_MM_RESTORE(); return; } @@ -3697,7 +3717,7 @@ PHP_METHOD(Tensor_Vector, clip) ZEPHIR_CONCAT_SS(&_1$$3, "Minimum cannot be", " greater than maximum."); ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 2, &_1$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_0$$3, "tensor/vector.zep", 1360); + zephir_throw_exception_debug(&_0$$3, "tensor/vector.zep", 1363); ZEPHIR_MM_RESTORE(); return; } @@ -3849,7 +3869,7 @@ PHP_METHOD(Tensor_Vector, multiplyMatrix) ZEPHIR_CONCAT_SVSVS(&_7$$3, "Vector A expects ", &_4$$3, " columns but Matrix B has ", &_6$$3, "."); ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 2, &_7$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1400); + zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1403); ZEPHIR_MM_RESTORE(); return; } @@ -3929,7 +3949,7 @@ PHP_METHOD(Tensor_Vector, divideMatrix) ZEPHIR_CONCAT_SVSVS(&_7$$3, "Vector A expects ", &_4$$3, " columns but Matrix B has ", &_6$$3, "."); ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 2, &_7$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1420); + zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1423); ZEPHIR_MM_RESTORE(); return; } @@ -4009,7 +4029,7 @@ PHP_METHOD(Tensor_Vector, addMatrix) ZEPHIR_CONCAT_SVSVS(&_7$$3, "Vector A expects ", &_4$$3, " columns but Matrix B has ", &_6$$3, "."); ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 2, &_7$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1440); + zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1443); ZEPHIR_MM_RESTORE(); return; } @@ -4089,7 +4109,7 @@ PHP_METHOD(Tensor_Vector, subtractMatrix) ZEPHIR_CONCAT_SVSVS(&_7$$3, "Vector A expects ", &_4$$3, " columns but Matrix B has ", &_6$$3, "."); ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 2, &_7$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1460); + zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1463); ZEPHIR_MM_RESTORE(); return; } @@ -4169,7 +4189,7 @@ PHP_METHOD(Tensor_Vector, powMatrix) ZEPHIR_CONCAT_SVSVS(&_7$$3, "Vector A expects ", &_4$$3, " columns but Matrix B has ", &_6$$3, "."); ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 2, &_7$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1480); + zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1483); ZEPHIR_MM_RESTORE(); return; } @@ -4249,7 +4269,7 @@ PHP_METHOD(Tensor_Vector, modMatrix) ZEPHIR_CONCAT_SVSVS(&_7$$3, "Vector A expects ", &_4$$3, " columns but Matrix B has ", &_6$$3, "."); ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 2, &_7$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1500); + zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1503); ZEPHIR_MM_RESTORE(); return; } @@ -4329,7 +4349,7 @@ PHP_METHOD(Tensor_Vector, equalMatrix) ZEPHIR_CONCAT_SVSVS(&_7$$3, "Vector A expects ", &_4$$3, " columns but Matrix B has ", &_6$$3, "."); ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 2, &_7$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1520); + zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1523); ZEPHIR_MM_RESTORE(); return; } @@ -4409,7 +4429,7 @@ PHP_METHOD(Tensor_Vector, notEqualMatrix) ZEPHIR_CONCAT_SVSVS(&_7$$3, "Vector A expects ", &_4$$3, " columns but Matrix B has ", &_6$$3, "."); ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 2, &_7$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1540); + zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1543); ZEPHIR_MM_RESTORE(); return; } @@ -4489,7 +4509,7 @@ PHP_METHOD(Tensor_Vector, greaterMatrix) ZEPHIR_CONCAT_SVSVS(&_7$$3, "Vector A expects ", &_4$$3, " columns but Matrix B has ", &_6$$3, "."); ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 2, &_7$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1560); + zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1563); ZEPHIR_MM_RESTORE(); return; } @@ -4569,7 +4589,7 @@ PHP_METHOD(Tensor_Vector, greaterEqualMatrix) ZEPHIR_CONCAT_SVSVS(&_7$$3, "Vector A expects ", &_4$$3, " columns but Matrix B has ", &_6$$3, "."); ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 2, &_7$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1580); + zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1583); ZEPHIR_MM_RESTORE(); return; } @@ -4649,7 +4669,7 @@ PHP_METHOD(Tensor_Vector, lessMatrix) ZEPHIR_CONCAT_SVSVS(&_7$$3, "Vector A expects ", &_4$$3, " columns but Matrix B has ", &_6$$3, "."); ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 2, &_7$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1600); + zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1603); ZEPHIR_MM_RESTORE(); return; } @@ -4729,7 +4749,7 @@ PHP_METHOD(Tensor_Vector, lessEqualMatrix) ZEPHIR_CONCAT_SVSVS(&_7$$3, "Vector A expects ", &_4$$3, " columns but Matrix B has ", &_6$$3, "."); ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 2, &_7$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1620); + zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1623); ZEPHIR_MM_RESTORE(); return; } @@ -4806,7 +4826,7 @@ PHP_METHOD(Tensor_Vector, multiplyVector) ZEPHIR_CONCAT_SVSVS(&_7$$3, "Vector A requires ", &_4$$3, " elements but Vector B has ", &_6$$3, "."); ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 2, &_7$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1640); + zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1643); ZEPHIR_MM_RESTORE(); return; } @@ -4879,7 +4899,7 @@ PHP_METHOD(Tensor_Vector, divideVector) ZEPHIR_CONCAT_SVSVS(&_7$$3, "Vector A requires ", &_4$$3, " elements but Vector B has ", &_6$$3, "."); ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 2, &_7$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1658); + zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1661); ZEPHIR_MM_RESTORE(); return; } @@ -4952,7 +4972,7 @@ PHP_METHOD(Tensor_Vector, addVector) ZEPHIR_CONCAT_SVSVS(&_7$$3, "Vector A requires ", &_4$$3, " elements but Vector B has ", &_6$$3, "."); ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 2, &_7$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1676); + zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1679); ZEPHIR_MM_RESTORE(); return; } @@ -5025,7 +5045,7 @@ PHP_METHOD(Tensor_Vector, subtractVector) ZEPHIR_CONCAT_SVSVS(&_7$$3, "Vector A requires ", &_4$$3, " elements but Vector B has ", &_6$$3, "."); ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 2, &_7$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1694); + zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1697); ZEPHIR_MM_RESTORE(); return; } @@ -5098,7 +5118,7 @@ PHP_METHOD(Tensor_Vector, powVector) ZEPHIR_CONCAT_SVSVS(&_7$$3, "Vector A requires ", &_4$$3, " elements but Vector B has ", &_6$$3, "."); ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 2, &_7$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1712); + zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1715); ZEPHIR_MM_RESTORE(); return; } @@ -5171,7 +5191,7 @@ PHP_METHOD(Tensor_Vector, modVector) ZEPHIR_CONCAT_SVSVS(&_7$$3, "Vector A requires ", &_4$$3, " elements but Vector B has ", &_6$$3, "."); ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 2, &_7$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1730); + zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1733); ZEPHIR_MM_RESTORE(); return; } @@ -5245,7 +5265,7 @@ PHP_METHOD(Tensor_Vector, equalVector) ZEPHIR_CONCAT_SVSVS(&_7$$3, "Vector A requires ", &_4$$3, " elements but Vector B has ", &_6$$3, "."); ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 2, &_7$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1749); + zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1752); ZEPHIR_MM_RESTORE(); return; } @@ -5318,7 +5338,7 @@ PHP_METHOD(Tensor_Vector, notEqualVector) ZEPHIR_CONCAT_SVSVS(&_7$$3, "Vector A requires ", &_4$$3, " elements but Vector B has ", &_6$$3, "."); ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 2, &_7$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1767); + zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1770); ZEPHIR_MM_RESTORE(); return; } @@ -5391,7 +5411,7 @@ PHP_METHOD(Tensor_Vector, greaterVector) ZEPHIR_CONCAT_SVSVS(&_7$$3, "Vector A requires ", &_4$$3, " elements but Vector B has ", &_6$$3, "."); ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 2, &_7$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1785); + zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1788); ZEPHIR_MM_RESTORE(); return; } @@ -5464,7 +5484,7 @@ PHP_METHOD(Tensor_Vector, greaterEqualVector) ZEPHIR_CONCAT_SVSVS(&_7$$3, "Vector A requires ", &_4$$3, " elements but Vector B has ", &_6$$3, "."); ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 2, &_7$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1803); + zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1806); ZEPHIR_MM_RESTORE(); return; } @@ -5537,7 +5557,7 @@ PHP_METHOD(Tensor_Vector, lessVector) ZEPHIR_CONCAT_SVSVS(&_7$$3, "Vector A requires ", &_4$$3, " elements but Vector B has ", &_6$$3, "."); ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 2, &_7$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1821); + zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1824); ZEPHIR_MM_RESTORE(); return; } @@ -5610,7 +5630,7 @@ PHP_METHOD(Tensor_Vector, lessEqualVector) ZEPHIR_CONCAT_SVSVS(&_7$$3, "Vector A requires ", &_4$$3, " elements but Vector B has ", &_6$$3, "."); ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 2, &_7$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1839); + zephir_throw_exception_debug(&_2$$3, "tensor/vector.zep", 1842); ZEPHIR_MM_RESTORE(); return; } @@ -6110,7 +6130,7 @@ PHP_METHOD(Tensor_Vector, offsetSet) Z_PARAM_ZVAL(values) ZEND_PARSE_PARAMETERS_END(); zephir_fetch_params_without_memory_grow(2, 0, &index, &values); - ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(tensor_exceptions_runtimeexception_ce, "Vector cannot be mutated directly.", "tensor/vector.zep", 1996); + ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(tensor_exceptions_runtimeexception_ce, "Vector cannot be mutated directly.", "tensor/vector.zep", 1999); return; } @@ -6161,7 +6181,7 @@ PHP_METHOD(Tensor_Vector, offsetUnset) Z_PARAM_ZVAL(index) ZEND_PARSE_PARAMETERS_END(); zephir_fetch_params_without_memory_grow(1, 0, &index); - ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(tensor_exceptions_runtimeexception_ce, "Vector cannot be mutated directly.", "tensor/vector.zep", 2020); + ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(tensor_exceptions_runtimeexception_ce, "Vector cannot be mutated directly.", "tensor/vector.zep", 2023); return; } @@ -6219,7 +6239,7 @@ PHP_METHOD(Tensor_Vector, offsetGet) ZEPHIR_CONCAT_SSVS(&_5$$3, "Element not found at", " offset ", &_4$$3, "."); ZEPHIR_CALL_METHOD(NULL, &_3$$3, "__construct", NULL, 2, &_5$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_3$$3, "tensor/vector.zep", 2034); + zephir_throw_exception_debug(&_3$$3, "tensor/vector.zep", 2037); ZEPHIR_MM_RESTORE(); return; } @@ -6254,7 +6274,7 @@ PHP_METHOD(Tensor_Vector, getIterator) zephir_read_property_cached(&_0, this_ptr, _zephir_prop_0, 1, PH_NOISY_CC | PH_READONLY); ZEPHIR_CALL_METHOD(&_1, &_0, "toArray", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 13, &_1); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 11, &_1); zephir_check_call_status(); RETURN_MM(); } @@ -6330,21 +6350,21 @@ PHP_METHOD(Tensor_Vector, __unserialize) zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &data_param); zephir_get_arrval(&data, data_param); - zephir_array_fetch_string(&_0, &data, SL("a"), PH_NOISY | PH_READONLY, "tensor/vector.zep", 2075); + zephir_array_fetch_string(&_0, &data, SL("a"), PH_NOISY | PH_READONLY, "tensor/vector.zep", 2078); ZVAL_BOOL(&_1, 0); ZEPHIR_CALL_SELF(&a, "fromArray", NULL, 0, &_0, &_1); zephir_check_call_status(); - zephir_array_fetch_string(&_2, &data, SL("n"), PH_NOISY | PH_READONLY, "tensor/vector.zep", 2077); + zephir_array_fetch_string(&_2, &data, SL("n"), PH_NOISY | PH_READONLY, "tensor/vector.zep", 2080); ZEPHIR_CALL_METHOD(&_3, &a, "size", NULL, 0); zephir_check_call_status(); if (UNEXPECTED(!ZEPHIR_IS_EQUAL(&_2, &_3))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(tensor_exceptions_runtimeexception_ce, "Invalid vector data.", "tensor/vector.zep", 2078); + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(tensor_exceptions_runtimeexception_ce, "Invalid vector data.", "tensor/vector.zep", 2081); return; } ZEPHIR_CALL_METHOD(&_4, &a, "buffer", NULL, 0); zephir_check_call_status(); zephir_update_property_zval_cached(this_ptr, _zephir_prop_0, 1, &_4); - zephir_array_fetch_string(&_5, &data, SL("n"), PH_NOISY | PH_READONLY, "tensor/vector.zep", 2082); + zephir_array_fetch_string(&_5, &data, SL("n"), PH_NOISY | PH_READONLY, "tensor/vector.zep", 2085); zephir_update_property_zval_cached(this_ptr, _zephir_prop_1, 2, &_5); ZEPHIR_MM_RESTORE(); } diff --git a/optimizers/TensorLinspaceOptimizer.php b/optimizers/TensorLinspaceOptimizer.php new file mode 100644 index 0000000..f2dc14a --- /dev/null +++ b/optimizers/TensorLinspaceOptimizer.php @@ -0,0 +1,76 @@ +processExpectedReturn($context); + + $symbolVariable = $call->getSymbolVariable(); + + if (empty($symbolVariable)) { + throw new CompilerException('Missing symbol variable.'); + } + + if ($symbolVariable->getType() !== 'variable') { + throw new CompilerException( + 'Return value must only be assigned to a dynamic variable.', + $expression + ); + } + + if ($call->mustInitSymbolVariable()) { + $symbolVariable->initVariant($context); + } + + $context->headersManager->add( + 'include/factories', + HeadersManager::POSITION_LAST + ); + + $resolvedParams = $call->getResolvedParams( + $expression['parameters'], + $context, + $expression + ); + + $symbol = $context->backend->getVariableCode($symbolVariable); + + $context->codePrinter->output( + "tensor_linspace($symbol, {$resolvedParams[0]}, {$resolvedParams[1]}, {$resolvedParams[2]});" + ); + + return new CompiledExpression( + 'variable', + $symbolVariable->getRealName(), + $expression + ); + } +} diff --git a/optimizers/TensorRangeOptimizer.php b/optimizers/TensorRangeOptimizer.php new file mode 100644 index 0000000..cf425da --- /dev/null +++ b/optimizers/TensorRangeOptimizer.php @@ -0,0 +1,76 @@ +processExpectedReturn($context); + + $symbolVariable = $call->getSymbolVariable(); + + if (empty($symbolVariable)) { + throw new CompilerException('Missing symbol variable.'); + } + + if ($symbolVariable->getType() !== 'variable') { + throw new CompilerException( + 'Return value must only be assigned to a dynamic variable.', + $expression + ); + } + + if ($call->mustInitSymbolVariable()) { + $symbolVariable->initVariant($context); + } + + $context->headersManager->add( + 'include/factories', + HeadersManager::POSITION_LAST + ); + + $resolvedParams = $call->getResolvedParams( + $expression['parameters'], + $context, + $expression + ); + + $symbol = $context->backend->getVariableCode($symbolVariable); + + $context->codePrinter->output( + "tensor_range($symbol, {$resolvedParams[0]}, {$resolvedParams[1]}, {$resolvedParams[2]});" + ); + + return new CompiledExpression( + 'variable', + $symbolVariable->getRealName(), + $expression + ); + } +} diff --git a/tensor/vector.zep b/tensor/vector.zep index fd8920e..4d38748 100644 --- a/tensor/vector.zep +++ b/tensor/vector.zep @@ -207,11 +207,30 @@ class Vector implements Tensor * @param float start * @param float end * @param float interval + * @throws \Tensor\Exceptions\InvalidArgumentException * @return self */ public static function range(const float start, const float end, const float interval = 1.0) -> { - return static::fromArray(range(start, end, interval), false); + if unlikely interval == 0.0 { + throw new InvalidArgumentException("Interval cannot be zero."); + } + + if unlikely end > start && interval < 0.0 { + throw new InvalidArgumentException("Interval must be positive" + . " when the end is greater than the start."); + } + +if unlikely !is_finite(start) || !is_finite(end) || !is_finite(interval) { + throw new InvalidArgumentException("Start, end, and interval must be finite."); + } + + if unlikely start != end && abs(end - start) < abs(interval) { + throw new InvalidArgumentException("Interval must be smaller" + . " than the range spanned by the start and end."); + } + + return new static(tensor_range(start, end, interval)); } /** @@ -234,19 +253,7 @@ class Vector implements Tensor . " must be greater than 1, " . strval(n) . " given."); } - int k = n - 1; - - float interval = abs(max - min) / k; - - array a = [min]; - - while count(a) < k { - let a[] = end(a) + interval; - } - - let a[] = max; - - return self::fromArray(a, false); + return new static(tensor_linspace(min, max, n)); } /** diff --git a/tests/VectorTest.php b/tests/VectorTest.php index c22942c..d161ca5 100644 --- a/tests/VectorTest.php +++ b/tests/VectorTest.php @@ -493,6 +493,147 @@ public function linspace() : void $this->assertEquals($expected->asArray(), $vector->asArray()); } + /** + * @test + */ + public function linspaceEndpoints() : void + { + $vector = Vector::linspace(0.0, 10.0, 11); + + $expected = Vector::fromArray([0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0]); + + $this->assertEquals($expected->asArray(), $vector->asArray()); + $this->assertSame(11, count($vector->asArray())); + $this->assertSame(0.0, $vector->asArray()[0]); + $this->assertSame(10.0, $vector->asArray()[10]); + } + + /** + * @test + */ + public function rangeDescending() : void + { + $vector = Vector::range(5.0, 1.0, 2.0); + + $expected = Vector::fromArray([5.0, 3.0, 1.0]); + + $this->assertEquals($expected->asArray(), $vector->asArray()); + } + + /** + * @test + */ + public function rangeDescendingNegativeStep() : void + { + $vector = Vector::range(5.0, 1.0, -1.0); + + $expected = Vector::fromArray([5.0, 4.0, 3.0, 2.0, 1.0]); + + $this->assertEquals($expected->asArray(), $vector->asArray()); + } + + /** + * @test + */ + public function rangeEqualEndpoints() : void + { + $vector = Vector::range(3.5, 3.5, 2.0); + + $expected = Vector::fromArray([3.5]); + + $this->assertEquals($expected->asArray(), $vector->asArray()); + } + + /** + * @test + */ + public function rangeFloatStep() : void + { + $vector = Vector::range(0.0, 1.0, 0.25); + + $expected = Vector::fromArray(array_map('floatval', array_values(range(0.0, 1.0, 0.25)))); + + $this->assertEquals($expected->asArray(), $vector->asArray()); + } + + /** + * @test + */ + public function rangeNegativeIntervalOnIncreasingThrows() : void + { + $this->expectException(InvalidArgumentException::class); + + Vector::range(1.0, 5.0, -1.0); + } + + /** + * @test + */ + public function rangeZeroIntervalThrows() : void + { + $this->expectException(InvalidArgumentException::class); + + Vector::range(1.0, 5.0, 0.0); + } + + /** + * @test + */ + public function rangeIntervalSpansMoreThanTheRangeThrows() : void + { + $this->expectException(InvalidArgumentException::class); + + Vector::range(1.0, 5.0, 10.0); + } + + /** + * @test + */ + public function rangeMatchesPhpRangeAcrossGrid() : void + { + $starts = [0.0, 1.0, 5.0, -5.0, 10.0, 2.5]; + $ends = [1.0, 5.0, 12.0, 0.0, 10.0, 1.0]; + $steps = [1.0, 0.5, 2.0, 2.5, 0.3, 0.1]; + + foreach ($starts as $start) { + foreach ($ends as $end) { + foreach ($steps as $step) { + if ($start > $end && $step < 0.0) { + continue; + } + + if ($start < $end && $step < 0.0) { + continue; + } + + if ($start == $end) { + continue; + } + + if (abs($end - $start) < abs($step)) { + continue; + } + + $expected = array_map('floatval', array_values(range($start, $end, $step))); + $actual = Vector::range($start, $end, $step)->asArray(); + + $this->assertSame( + $expected, + $actual, + sprintf( + 'range(%s, %s, %s) mismatch: %s !== %s', + $start, + $end, + $step, + json_encode($actual), + json_encode($expected) + ) + ); + } + } + } + } + /** * @test * @dataProvider shapeProvider