Mercurial > octave
diff scripts/legacy/@inline/vectorize.m @ 30911:b7edac56a810
Add functions to @inline class for Matlab compatibility (Bug #62260).
* scripts/legacy/@inline/cat.m, scripts/legacy/@inline/cat.m,
scripts/legacy/@inline/disp.m, scripts/legacy/@inline/exist.m,
scripts/legacy/@inline/horzcat.m, scripts/legacy/@inline/nargin.m,
scripts/legacy/@inline/nargout.m, scripts/legacy/@inline/symvar.m,
scripts/legacy/@inline/vertcat.m: New functions
* scripts/legacy/module.mk: Add new functions to build system.
* scripts/legacy/@inline/argnames.m: scripts/legacy/@inline/char.m,
scripts/legacy/@inline/feval.m, scripts/legacy/@inline/formula.m,
scripts/legacy/@inline/subsref.m, scripts/legacy/@inline/vectorize.m:
Redo documentation. Change FCN input name to FOBJ.
* scripts/legacy/@inline/inline.m: Single tweak to documentation.
* scripts/legacy/__vectorize__.m: Add note that this function was translated
from C++.
* scripts/legacy/vectorize.m: Remove incorrect note about function being
translated from C++.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 06 Apr 2022 21:25:58 -0700 |
parents | 78c3dcadf130 |
children | 597f3ee61a48 |
line wrap: on
line diff
--- a/scripts/legacy/@inline/vectorize.m Wed Apr 06 16:30:23 2022 -0700 +++ b/scripts/legacy/@inline/vectorize.m Wed Apr 06 21:25:58 2022 -0700 @@ -24,8 +24,8 @@ ######################################################################## ## -*- texinfo -*- -## @deftypefn {} {@var{vfcn} =} vectorize (@var{fcn}) -## Create a vectorized version of the inline function @var{fcn} by +## @deftypefn {} {@var{vfcn} =} vectorize (@var{fobj}) +## Create a vectorized version of the inline function @var{fobj} by ## replacing all occurrences of @code{*}, @code{/}, etc., with ## @code{.*}, @code{./}, etc. ## @@ -35,23 +35,17 @@ ## ## @example ## @group -## fcn = vectorize (inline ("x^2 - 1")) -## @result{} fcn = f(x) = x.^2 - 1 -## quadv (fcn, 0, 3) +## fobj = vectorize (inline ("x^2 - 1")) +## @result{} fobj = f(x) = x.^2 - 1 +## quadv (fobj, 0, 3) ## @result{} 6 ## @end group ## @end example ## @seealso{inline, formula, argnames} ## @end deftypefn -## The following function was translated directly from the original C++ -## version. Yes, it will be slow, but the use of inline functions is -## strongly discouraged anyway, and most expressions will probably be -## short. It may also be buggy. Well, don't use this function! Use -## function handles instead! +function vfcn = vectorize (fobj) -function vfcn = vectorize (fcn) - - vfcn = inline (__vectorize__ (fcn.expr)); + vfcn = inline (__vectorize__ (fobj.expr)); endfunction