GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Macros | Functions | Variables
cellfun.cc File Reference
#include <string>
#include <vector>
#include <list>
#include <memory>
#include "lo-mappers.h"
#include "oct-locbuf.h"
#include "oct-string.h"
#include "Cell.h"
#include "oct-map.h"
#include "defun.h"
#include "interpreter.h"
#include "parse.h"
#include "variables.h"
#include "unwind-prot.h"
#include "errwarn.h"
#include "utils.h"
#include "ov-bool.h"
#include "ov-class.h"
#include "ov-colon.h"
#include "ov-complex.h"
#include "ov-float.h"
#include "ov-flt-complex.h"
#include "ov-int16.h"
#include "ov-int32.h"
#include "ov-int64.h"
#include "ov-int8.h"
#include "ov-scalar.h"
#include "ov-uint16.h"
#include "ov-uint32.h"
#include "ov-uint64.h"
#include "ov-uint8.h"
#include "ov-fcn-handle.h"
Include dependency graph for cellfun.cc:

Go to the source code of this file.

Macros

#define BTYP_BRANCH(X, Y)
 

Functions

then the function must return
scalars which will be
concatenated into the return 
array (s).If code
 
is the outputs are
concatenated into a cell array(or
cell arrays).For example
endfunction 
cellfun ("factorial",-1, 2,"ErrorHandler",@foo) esult
 
OCTAVE_EXPORT octave_value_list Fcellfun (const octave_value_list &args, int nargout) ots
 
static void get_mapper_fun_options (const octave_value_list &args, int &nargin, bool &uniform_output, octave_value &error_handler)
 
static octave_value_list get_output_list (octave_idx_type count, octave_idx_type nargout, const octave_value_list &inputlist, octave_value &func, octave_value &error_handler)
 
 if (nargin< 2) print_usage()
 
 if (ptr_func) func
 
template<typename BNDA , typename NDA >
static octave_value_list try_cellfun_internal_ops (const octave_value_list &args, int nargin)
 

Variables

calling an anonymous function
involves an overhead quite
comparable to the overhead of
an m file function Passing a
handle to a built in function
is because the interpreter is
not involved in the internal
loop For 
a
 
 b = twoouts (x) a = x
 
 else
 
 endfunction [aa, bb] = cellfun (@twoouts, 1, 2, 3) esult{} aa = 1 2 3 bb = 1 4 9 nd group nd example Note that per default the output argument(s) are arrays of the same size as the input arguments. Input arguments that are singleton (1x1) cells will be automatically expanded to the size of the other arguments. If the parameter code{"UniformOutput"} is set to true (the default)
 
calling an anonymous function
involves an overhead quite
comparable to the overhead of
an m file function Passing a
handle to a built in function
is because the interpreter is
not involved in the internal
loop For 
example
 
is false
 
calling an anonymous function
involves an overhead quite
comparable to the overhead of
an m file function Passing a
handle to a built in function
is 
faster
 
 however
 
nd group nd example Use ode {cellfun} intelligently. The ode{cellfun} function is a useful tool for avoiding loops. It is often used with anonymous function handles
 

Macro Definition Documentation

#define BTYP_BRANCH (   X,
  Y 
)
Value:
case btyp_ ## X: \
retval = do_mat2cell (a.Y ## _value (), d, nargin - 1); \
break
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
Definition: cellfun.cc:398
int nargin
Definition: graphics.cc:10115
octave_value retval
Definition: data.cc:6294

Function Documentation

then the function must return scalars which will be concatenated into the return array ( s  )
is the outputs are concatenated into a cell array (or cell arrays). For example endfunction cellfun ( "factorial"  ,
1,
,
"ErrorHandler"  ,
foo 
)

Definition at line 398 of file cellfun.cc.

OCTAVE_EXPORT octave_value_list Fcellfun ( const octave_value_list args,
int  nargout 
)

Definition at line 398 of file cellfun.cc.

Referenced by install_cellfun_fcns().

static void get_mapper_fun_options ( const octave_value_list args,
int nargin,
bool uniform_output,
octave_value error_handler 
)
static
static octave_value_list get_output_list ( octave_idx_type  count,
octave_idx_type  nargout,
const octave_value_list inputlist,
octave_value func,
octave_value error_handler 
)
static
if ( )

Definition at line 405 of file cellfun.cc.

Referenced by load_path::do_files(), and yyunput().

if ( ptr_func  )
template<typename BNDA , typename NDA >
static octave_value_list try_cellfun_internal_ops ( const octave_value_list args,
int  nargin 
)
static

Variable Documentation

calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a

Definition at line 398 of file cellfun.cc.

Referenced by main_window::add_action(), file_editor::add_action(), QtHandles::addEmptyAction(), octave::math::airy(), octave::math::betainc(), octave::math::betaincinv(), octave::math::biry(), axes::properties::calc_tick_sep(), ComplexNDArray::ComplexNDArray(), conj(), octave_qscintilla::contextMenuEvent(), conv_to_int_array(), convert_cdata(), convolve_nd(), octave::opengl_texture::create(), file_editor::create_context_menu(), cunhj(), cunik(), default_numeric_conversion_function(), default_numeric_demotion_function(), DEFUN(), dgamln(), do_add_dm_sm(), do_add_sm_dm(), do_commutative_add_dm_sm(), octave::math::do_erfcinv(), octave::math::do_erfinv(), do_extended_gcd(), octave_rand::do_float_nd_array(), octave_rand::do_float_scalar(), octave_rand::do_float_vector(), octave_rand::do_nd_array(), do_rand(), do_rc_map(), octave_rand::do_scalar(), do_simple_gcd(), do_sub_dm_sm(), do_sub_sm_dm(), do_tril(), do_triu(), octave_rand::do_vector(), octave::opengl_renderer::draw_image(), octave::opengl_renderer::draw_patch(), octave::opengl_renderer::draw_surface(), elem_xpow(), octave::math::ellipj(), QtHandles::Figure::eventNotifyAfter(), QtHandles::Figure::eventNotifyBefore(), extended_gcd(), Faddeeva_w(), Fbetainc(), Fconv2(), Ffilter(), octave_rand::fill(), filter(), octave_rand::float_nd_array(), octave_rand::float_scalar(), octave_rand::float_vector(), FloatComplexNDArray::FloatComplexNDArray(), FloatNDArray::FloatNDArray(), G__glpk__(), gamln(), octave::math::gammainc(), octave_sort< T >::MergeState::getmemi(), Gsymbfact(), EIG::hermitian_init(), FloatEIG::hermitian_init(), imag(), hess< T >::init(), gepbalance< T >::init(), qrp< T >::init(), schur< T >::init(), EIG::init(), FloatEIG::init(), chol< T >::init(), qr< T >::init(), cdef_class::cdef_class_rep::install_method(), octave_value::int_vector_value(), lu< T >::lu(), octave::base_parser::make_classdef(), octave::base_parser::make_classdef_enum_block(), octave::base_parser::make_classdef_events_block(), octave::base_parser::make_classdef_methods_block(), octave::base_parser::make_classdef_properties_block(), QtHandles::Utils::makeImageFromCData(), mark_upper_triangular(), matrix_complex_probe(), max(), maybe_compound_binary_expression(), QtHandles::Menu::Menu(), min(), QtHandles::MouseModeActionGroup::MouseModeActionGroup(), mx_el_and_assign(), mx_el_or_assign(), octave_rand::nd_array(), NDArray::NDArray(), oct_conv_bool_matrix_conv(), oct_conv_complex_diag_matrix_to_complex_matrix(), oct_conv_complex_matrix_conv(), oct_conv_diag_matrix_to_matrix(), oct_conv_float_complex_diag_matrix_to_complex_diag_matrix(), oct_conv_float_complex_matrix_conv(), oct_conv_float_diag_matrix_to_float_matrix(), oct_conv_matrix_conv(), oct_conv_perm_matrix_to_matrix(), oct_conv_range_to_matrix(), oct_conv_sparse_bool_matrix_conv(), oct_conv_sparse_complex_matrix_conv(), oct_conv_sparse_matrix_conv(), oct_fill_float_randg(), oct_fill_randg(), oct_unop_hermitian(), oct_unop_not(), oct_unop_scalar_transpose(), oct_unop_transpose(), oct_unop_uminus(), oct_unop_uplus(), octave_value::octave_idx_type_vector_value(), octinternal_do_mul_pm_sm(), boolMatrix::operator!=(), RowVector::operator!=(), ColumnVector::operator!=(), FloatRowVector::operator!=(), FloatColumnVector::operator!=(), ComplexRowVector::operator!=(), DiagMatrix::operator!=(), FloatDiagMatrix::operator!=(), ComplexColumnVector::operator!=(), FloatComplexRowVector::operator!=(), FloatComplexColumnVector::operator!=(), charMatrix::operator!=(), ComplexDiagMatrix::operator!=(), FloatComplexDiagMatrix::operator!=(), SparseBoolMatrix::operator!=(), Matrix::operator!=(), FloatMatrix::operator!=(), SparseMatrix::operator!=(), ComplexMatrix::operator!=(), SparseComplexMatrix::operator!=(), FloatComplexMatrix::operator!=(), base_properties::cmp_caseless_str::operator()(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/=(), operator<<(), operator==(), operator>>(), symbol_info_list::parse_whos_line_format(), permute_vector_compare(), plus_or_minus(), pow(), print_descriptor(), product(), product_eq(), octave::math::qrsolve(), quotient(), quotient_eq(), randu53(), read_mat5_binary_element(), real(), replace(), axes::properties::rotate3d(), tree_compound_binary_expression::rvalue1(), tree_binary_expression::rvalue1(), tree_boolean_expression::rvalue1(), safe_comparator(), octave_rand::scalar(), SelfListener::SelfListener(), QtHandles::Figure::showMenuBar(), simple_gcd(), Sparse< T >::Sparse(), sparse_ascending_compare< Complex >(), sparse_ascending_compare< double >(), sparse_descending_compare< Complex >(), sparse_descending_compare< double >(), SparseComplexMatrix::SparseComplexMatrix(), SparseMatrix::SparseMatrix(), cdef_object_array::subsasgn(), octave::math::svd< T >::svd(), EIG::symmetric_init(), FloatEIG::symmetric_init(), umul128(), QtHandles::Menu::update(), QtHandles::Menu::updateSiblingPositions(), octave_rand::vector(), xdiv(), xleftdiv(), xpow(), zunhj(), zunik(), and octave_sort< T >::MergeState::~MergeState().

b = twoouts (x) a = x

Definition at line 398 of file cellfun.cc.

Referenced by HistoryScrollBlockArray::addCells(), octave::math::betainc(), octave::math::betaincinv(), SparseMatrix::bsolve(), SparseComplexMatrix::bsolve(), axes::properties::calc_tick_sep(), color_values::color_values(), jit_infer::construct_ssa(), convolve_nd(), cunhj(), cunik(), DEFUN(), dgamln(), divide(), octave::math::do_erfcinv(), octave::math::do_erfinv(), do_extended_gcd(), do_simple_gcd(), SparseComplexMatrix::dsolve(), SparseMatrix::dsolve(), EigsComplexNonSymmetricMatrix(), EigsComplexNonSymmetricMatrixShift(), EigsRealNonSymmetricMatrix(), EigsRealNonSymmetricMatrixShift(), EigsRealSymmetricMatrix(), EigsRealSymmetricMatrixShift(), elem_xpow(), octave::math::ellipj(), extended_gcd(), Fbetainc(), Fconv2(), Ffilter(), filter(), jit_convert::finish_breaks(), Matrix::fsolve(), FloatMatrix::fsolve(), ComplexMatrix::fsolve(), FloatComplexMatrix::fsolve(), SparseMatrix::fsolve(), SparseComplexMatrix::fsolve(), G__glpk__(), gamln(), HistoryScrollBlockArray::getCells(), octave_dock_widget::handle_settings(), EIG::hermitian_init(), FloatEIG::hermitian_init(), ichol_mult_complex(), ichol_mult_real(), idx_vector::idx_range_rep::idx_range_rep(), gepbalance< T >::init(), EIG::init(), FloatEIG::init(), Matrix::lssolve(), FloatMatrix::lssolve(), ComplexMatrix::lssolve(), FloatComplexMatrix::lssolve(), Matrix::ltsolve(), FloatMatrix::ltsolve(), SparseMatrix::ltsolve(), SparseComplexMatrix::ltsolve(), ComplexMatrix::ltsolve(), FloatComplexMatrix::ltsolve(), LuAminusSigmaB(), main(), cdef_class::make_meta_class(), QtHandles::Utils::makeImageFromCData(), Range::matrix_value(), max(), maybe_compound_binary_expression(), min(), mx_el_and_assign(), mx_el_or_assign(), octave__create_buffer(), octave__scan_buffer(), octave__scan_bytes(), octave_tex__create_buffer(), octave_tex__scan_buffer(), octave_tex__scan_bytes(), intNDArray< T >::operator!(), boolMatrix::operator!(), base_properties::cmp_caseless_str::operator()(), operator+=(), operator-=(), operator<<(), operator==(), symbol_info_list::parse_whos_line_format(), permute_vector_compare(), plus_or_minus(), pow(), powf(), print_descriptor(), news_reader::process(), product(), product_eq(), octave::math::qrsolve(), quotient(), quotient_eq(), randu53(), jit_infer::remove_dead(), octave::opengl_renderer::render_ticktexts(), Screen::reverseRendition(), tree_compound_binary_expression::rvalue1(), tree_binary_expression::rvalue1(), tree_boolean_expression::rvalue1(), octave_struct::save_ascii(), octave_cell::save_ascii(), octave_class::save_ascii(), octave_scalar_struct::save_ascii(), octave_struct::save_binary(), octave_cell::save_binary(), octave_class::save_binary(), octave_scalar_struct::save_binary(), figure::properties::set___graphics_toolkit__(), Range::set_base(), ODESFunc::set_bsub_function(), figure::properties::set_toolkit(), TerminalModel::setAutoClose(), simple_gcd(), octave::math::sparse_qr< SPARSE_T >::solve(), SparseMatrix::solve(), SparseComplexMatrix::solve(), sparse_ascending_compare< Complex >(), sparse_ascending_compare< double >(), sparse_descending_compare< Complex >(), sparse_descending_compare< double >(), EIG::symmetric_init(), FloatEIG::symmetric_init(), octave::math::sparse_qr< SPARSE_T >::tall_solve(), text_element_color::text_element_color(), SparseMatrix::trisolve(), SparseComplexMatrix::trisolve(), Matrix::utsolve(), FloatMatrix::utsolve(), SparseComplexMatrix::utsolve(), SparseMatrix::utsolve(), ComplexMatrix::utsolve(), FloatComplexMatrix::utsolve(), octave::math::sparse_qr< SPARSE_T >::wide_solve(), x_el_div(), xdiv(), xpow(), yy_get_next_buffer(), zunhj(), and zunik().

else
Initial value:
{
static octave_value find_function(const std::string &name, const octave_value_list &args=octave_value_list(), bool local_funcs=true)
Definition: symtab.cc:1276
OCTAVE_EXPORT octave_value_list any number nd example oindent prints the prompt xample Pick a any number!nd example oindent and waits for the user to enter a value The string entered by the user is evaluated as an so it may be a literal a variable name
Definition: input.cc:871

Definition at line 437 of file cellfun.cc.

if (! args(1).is_cell ()) error ("cellfun endfunction = cellfun (@twoouts, 1, 2, 3) esult{} aa = 1 2 3 bb = 1 4 9 nd group nd example Note that per default the output argument(s) are arrays of the same size as the input arguments. Input arguments that are singleton (1x1) cells will be automatically expanded to the size of the other arguments. If the parameter code{"UniformOutput"} is set to true (the default)

Definition at line 398 of file cellfun.cc.

identity matrix If supplied two scalar respectively For example

Definition at line 398 of file cellfun.cc.

is false
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is faster

Definition at line 398 of file cellfun.cc.

however

Definition at line 398 of file cellfun.cc.

or ode {cellfun} intelligently. The ode{cellfun} function is a useful tool for avoiding loops. It is often used with anonymous function handles

Definition at line 398 of file cellfun.cc.

Referenced by DEFUN().