GNU Octave
4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
|
#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"
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 |
#define BTYP_BRANCH | ( | X, | |
Y | |||
) |
Definition at line 398 of file cellfun.cc.
Referenced by cdef_object_array::array_value(), convert_to_string(), jit_index_operation::create_arg_array(), KeyboardTranslatorReader::createEntry(), cdef_object_array::dims(), do_minmax_red_op(), do_minmax_red_op< boolNDArray >(), do_minmax_red_op< charNDArray >(), do_numeric_lookup(), do_sparse_diff(), jit_paren_subsref::generate_matrix(), jit_paren_subsasgn::generate_matrix(), generate_struct_completions(), octave_jit_paren_subsasgn_impl(), octave_jit_paren_subsasgn_matrix_range(), octave_value::octave_value(), jit_array< T, U >::operator T(), jit_typeinfo::register_generic(), unbox(), and jit_array< T, U >::update().
is the outputs are concatenated into a cell array (or cell arrays). For example endfunction cellfun | ( | "factorial" | , |
- | 1, | ||
2 | , | ||
"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 |
Definition at line 222 of file cellfun.cc.
References arg, error(), symbol_table::find_function(), octave_value::is_undefined(), max(), string, and octave::string::strncmpi().
|
static |
Definition at line 68 of file cellfun.cc.
References octave_scalar_map::assign(), buffer_error_messages, octave_value_list::clear(), octave_value::do_multi_index_op(), e, octave_value::is_defined(), last_error_id(), last_error_message(), octave_value_list::prepend(), recover_from_exception(), and tmp.
if | ( | ) |
Definition at line 405 of file cellfun.cc.
Referenced by load_path::do_files(), and yyunput().
if | ( | ptr_func | ) |
|
static |
Definition at line 123 of file cellfun.cc.
References octave_value::class_name(), d, Array< T >::dims(), octave_value::dims(), dv, Array< T >::elem(), error(), octave_value::is_bool_type(), octave_value::is_empty(), octave_value::is_numeric_type(), octave_value::is_real_type(), k, octave_value::length(), name, dim_vector::ndims(), octave_value::ndims(), Array< T >::numel(), octave_value::numel(), result, retval, and string.
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().
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 |
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.
Definition at line 398 of file cellfun.cc.
is false |
Definition at line 398 of file cellfun.cc.
Referenced by alngam(), alnrel(), asinh(), atanh(), betai(), csevl(), d1mach(), d9gmit(), d9lgit(), d9lgmc(), dasinh(), datanh(), dbetai(), dcsevl(), ddaini(), ddaspk(), ddasrt(), ddassl(), ddastp(), derf(), derfc(), dgamit(), dgamma(), dlngam(), dlnrel(), dqagie(), dqagpe(), drchek(), droots(), dsubsp(), erf(), erfc(), exchqz(), gamit(), gamma(), i1mach(), inrgcm(), TerminalView::mouseDoubleClickEvent(), TerminalView::mouseTripleClickEvent(), qagie(), qagpe(), qrgnin(), r1mach(), r9lgmc(), setall(), sexchqz(), ssubsp(), xermsg(), xerrwd(), xgammainc(), xgetf(), xgetua(), and xsgammainc().
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.