diff --git a/stubs/internal/Common.php b/stubs/internal/Common.php index fc939f2..25bb6a1 100644 --- a/stubs/internal/Common.php +++ b/stubs/internal/Common.php @@ -100,4 +100,42 @@ interface Common * @return void */ function copySize($other); + + /** + * For all elements equal to $old_value, set them to $new_value. + * + * For SpMat, replacement is not done when $old_value == 0. + * + * @param number|\Arma\Complex $old_value + * @param number|\Arma\Complex $new_value + * @return void + */ + function replace($old_value, $new_value); + + /** + * Transform each element using a callback function. + * + * Transformation is done column-by-column, and for SpMat only non-zero elements will be transformed. + * + * @param callable $callback ($old_value) => $new_value + * @return void + */ + function transform($callback); + + /** + * For each element, pass its reference to a callback function. + * + * Processing is done column-by-column, and for SpMat only non-zero elements will be passed to callback. + * + * @param callable $callback + * @return void + */ + function forEach($callback); + + /** + * Reset the size to zero. The object will have no elements. + * + * @return void + */ + function reset(); } diff --git a/stubs/internal/Dense.php b/stubs/internal/Dense.php index 91b9502..a37f9be 100644 --- a/stubs/internal/Dense.php +++ b/stubs/internal/Dense.php @@ -67,9 +67,10 @@ interface Dense extends Common function notSmallerThan($other); /** - * Sets the elements to a specified value. + * Sets the elements to a specified value. The type of value must match the type of elements used by + * the container object. * - * The type of value must match the type of elements used by the container object. + * For matrices, filling is done column-by-column. * * @param number|\Arma\Complex $value * @return void @@ -77,11 +78,11 @@ interface Dense extends Common function fill($value); /** - * Fill with values provided by a functor or lambda function. + * Fill with values provided by a callback function. * * For matrices, filling is done column-by-column. * - * @param callable $callback + * @param callable $callback () => $fill_value * @return void */ function imbue($callback);