GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
sub2ind.cc File Reference
#include "Array-util.h"
#include "oct-locbuf.h"
#include "quit.h"
#include "defun.h"
#include "error.h"
#include "errwarn.h"
#include "ovl.h"
Include dependency graph for sub2ind.cc:

Go to the source code of this file.

Functions

 catch (const octave::index_exception &e)
 
OCTAVE_EXPORT octave_value_list etc The functions then then dimension (pages)
 
OCTAVE_EXPORT octave_value_list etc The functions then dimension (columns)
 
OCTAVE_EXPORT octave_value_list Fsub2ind (const octave_value_list &args, int) or they may be specified with subscripts for the row
 
static dim_vector get_dim_vector (const octave_value &val, const char *name)
 

Variables

the exceeded dimensions are set to if fewer subscripts than dimensions are the exceeding dimensions are merged into the final requested dimension For clarity
 
OCTAVE_EXPORT octave_value_list column
 
the exceeded dimensions are set to if fewer subscripts than dimensions are the exceeding dimensions are merged into the final requested dimension For consider the following dims = [3, 3]
 
dim_vector dv = get_dim_vector (args(0), "ind2sub").redim (nargout)
 
the exceeded dimensions are set to if fewer subscripts than dimensions are the exceeding dimensions are merged into the final requested dimension For consider the following examples
 
 ind
 
OCTAVE_EXPORT octave_value_list etc The functions then then etc until it has numbered all of the elements Consider the following by matrices
 
OCTAVE_EXPORT octave_value_list etc The functions ode {ind2sub} and ode{sub2ind} interconvert between the two forms. The linear index traverses dimension 1 (rows)
 
OCTAVE_EXPORT octave_value_list page
 
the exceeded dimensions are set to if fewer subscripts than dimensions are provided
 
octave_value_list retval
 
 s2 = [1, 3]
 
 try
 

Function Documentation

◆ catch()

catch ( const octave::index_exception e)

Definition at line 269 of file sub2ind.cc.

References e, and error().

◆ dimension() [1/2]

OCTAVE_EXPORT octave_value_list etc The functions then then dimension ( pages  )

◆ dimension() [2/2]

OCTAVE_EXPORT octave_value_list etc The functions then dimension ( columns  )

◆ Fsub2ind()

OCTAVE_EXPORT octave_value_list Fsub2ind ( const octave_value_list args,
int   
)

◆ get_dim_vector()

static dim_vector get_dim_vector ( const octave_value val,
const char *  name 
)
static

Definition at line 38 of file sub2ind.cc.

References dv, error(), i, max(), name, Array< T >::numel(), dim_vector::resize(), and val.

Variable Documentation

◆ clarity

the exceeded dimensions are set to if fewer subscripts than dimensions are the exceeding dimensions are merged into the final requested dimension For clarity

Definition at line 255 of file sub2ind.cc.

◆ column

OCTAVE_EXPORT octave_value_list column

Definition at line 107 of file sub2ind.cc.

◆ dims

the exceeded dimensions are set to if fewer subscripts than dimensions are the exceeding dimensions are merged into the final requested dimension For consider the following dims = [3, 3]

Definition at line 255 of file sub2ind.cc.

Referenced by intNDArray< OCTAVE_INT_T >::abs(), array_property::add_constraint(), row_vector_property::add_constraint(), add_hdf5_data(), octave_value::all_zero_dims(), DiagArray2< Complex >::array_value(), Sparse< bool >::array_value(), OCTAVE_VALUE_INT_MATRIX_T::as_mxArray(), OCTAVE_VALUE_INT_MATRIX_T::bool_array_value(), calc_single_subscript_internal(), octave_bool_matrix::char_array_value(), OCTAVE_VALUE_INT_MATRIX_T::char_array_value(), DiagArray2< Complex >::check_idx(), octave_base_value::columns(), OCTAVE_VALUE_INT_MATRIX_T::complex_matrix_value(), compute_index(), octave_base_int_matrix< intNDArray< OCTAVE_INT_T > >::convert_to_str_internal(), octave::fftw_planner::create_plan(), octave::float_fftw_planner::create_plan(), Array< octave_value >::diag(), octave::fftw_planner::do_create_plan(), octave::float_fftw_planner::do_create_plan(), do_fft(), do_fft2(), do_fftn(), octave_rand::do_float_nd_array(), do_mx_cumminmax_op(), do_mx_diff_op(), do_mx_minmax_op(), octave_rand::do_nd_array(), do_rand(), do_trilu(), F__lin_interpn__(), Array< octave_value >::find(), OCTAVE_VALUE_INT_MATRIX_T::float_complex_matrix_value(), OCTAVE_VALUE_INT_MATRIX_T::float_matrix_value(), octave_rand::float_nd_array(), get_ra_idx(), get_scalar_idx(), Sparse< bool >::index(), Array< octave_value >::index(), octave_base_diag< DiagMatrix, Matrix >::is_true(), octave_base_value::is_zero_by_zero(), octave_base_value::isempty(), lin_interpn(), load_hdf5_empty(), Array< octave_value >::map(), OCTAVE_VALUE_INT_MATRIX_T::matrix_value(), octave::tree::meets_bp_condition(), mxCreateCellArray(), mxCreateCharArray(), mxCreateLogicalArray(), mxCreateNumericArray(), mxCreateStructArray(), mxCreateUninitNumericArray(), mxSetDimensions(), octave_rand::nd_array(), octave_base_value::ndims(), Array< octave_value >::nth_element(), octave_base_sparse< SparseComplexMatrix >::numel(), octave_class::numel(), octave_base_value::numel(), octave_print_internal(), octave_print_internal_template(), intNDArray< OCTAVE_INT_T >::operator!(), Array< octave_value >::permute(), octave_base_sparse< SparseComplexMatrix >::print_as_scalar(), octave_base_matrix< boolNDArray >::print_as_scalar(), octave_base_diag< DiagMatrix, Matrix >::print_as_scalar(), print_empty_nd_array(), print_nd_array(), read_mat5_binary_element(), octave_base_value::rows(), octave_base_int_matrix< intNDArray< OCTAVE_INT_T > >::save_ascii(), octave_base_sparse< SparseComplexMatrix >::save_ascii(), octave_base_int_matrix< intNDArray< OCTAVE_INT_T > >::save_binary(), save_hdf5_empty(), octave_base_int_matrix< intNDArray< OCTAVE_INT_T > >::save_hdf5_internal(), intNDArray< OCTAVE_INT_T >::signum(), Array< octave_value >::sort(), and twosum_accum().

◆ dv

dim_vector dv = get_dim_vector (args(0), "ind2sub").redim (nargout)

Definition at line 263 of file sub2ind.cc.

Referenced by octave::math::airy(), octave_value_list::all_scalars(), mxArray_number::as_octave_value(), mxArray_sparse::as_octave_value(), mxArray_struct::as_octave_value(), mxArray_cell::as_octave_value(), octave_base_matrix< boolNDArray >::assign(), Array< octave_value >::assign(), octave::math::biry(), octave_map::cat(), Sparse< bool >::cat(), Array< octave_value >::cat(), Array< octave_value >::clear(), octave_base_value::columns(), OCTAVE_VALUE_INT_MATRIX_T::complex_matrix_value(), compute_array_dimensions(), compute_index(), octave_map::concat(), convert_cdata(), octave::convert_packcomplex_Nd(), octave_base_int_matrix< intNDArray< OCTAVE_INT_T > >::convert_to_str_internal(), octave_sparse_matrix::convert_to_str_internal(), octave_float_matrix::convert_to_str_internal(), octave_matrix::convert_to_str_internal(), octave::opengl_texture::create(), property::create(), Array< octave_value >::delete_elements(), Array< octave_value >::diag(), octave_oncleanup::dims(), octave_base_scalar< bool >::dims(), octave_fcn_handle::dims(), octave_scalar_struct::dims(), mxArray_matlab::dims_to_dim_vector(), octave::math::do_bessel(), do_extended_gcd(), octave_base_matrix< boolNDArray >::do_index_op(), octave::textscan::do_scan(), row_vector_property::do_set(), handle_property::do_set(), octave::do_single_type_concat(), octave::do_single_type_concat< octave_map >(), octave::opengl_renderer::draw_image(), octave_struct::edit_display(), octave_char_matrix_str::edit_display(), octave_scalar_struct::edit_display(), octave::base_ve_model::edit_display_sub(), octave::fftw::fft(), octave::fftw::fftNd(), OCTAVE_VALUE_INT_MATRIX_T::float_complex_matrix_value(), OCTAVE_VALUE_INT_MATRIX_T::float_matrix_value(), ComplexNDArray::fourier(), FloatComplexNDArray::fourier(), FloatNDArray::fourier(), NDArray::fourier(), ComplexNDArray::fourier2d(), FloatComplexNDArray::fourier2d(), FloatNDArray::fourier2d(), NDArray::fourier2d(), Matrix::fourier2d(), FloatMatrix::fourier2d(), ComplexMatrix::fourier2d(), FloatComplexMatrix::fourier2d(), ComplexNDArray::fourierNd(), FloatComplexNDArray::fourierNd(), FloatNDArray::fourierNd(), NDArray::fourierNd(), G__osmesa_print__(), get_dim_vector(), mxArray_octave_value::get_dimensions(), get_dims_str(), octave::printf_value_cache::get_next_value(), hdf5_read_next_data(), hdf5_read_next_data_internal(), idx_vector::idx_mask_rep::idx_mask_rep(), idx_vector::idx_vector_rep::idx_vector_rep(), octave::fftw::ifft(), octave::fftw::ifftNd(), ComplexNDArray::ifourier(), FloatComplexNDArray::ifourier(), FloatNDArray::ifourier(), NDArray::ifourier(), ComplexNDArray::ifourier2d(), FloatComplexNDArray::ifourier2d(), FloatNDArray::ifourier2d(), NDArray::ifourier2d(), Matrix::ifourier2d(), FloatMatrix::ifourier2d(), ComplexMatrix::ifourier2d(), FloatComplexMatrix::ifourier2d(), ComplexNDArray::ifourierNd(), FloatComplexNDArray::ifourierNd(), FloatNDArray::ifourierNd(), NDArray::ifourierNd(), ind2sub(), Array< octave_value >::index(), mxArray_number::int_to_ov(), octave_base_sparse< SparseComplexMatrix >::is_true(), octave_base_matrix< boolNDArray >::is_true(), isvector(), octave_base_int_matrix< intNDArray< OCTAVE_INT_T > >::load_ascii(), octave_struct::load_ascii(), octave_float_complex_matrix::load_ascii(), octave_cell::load_ascii(), octave_char_matrix_str::load_ascii(), octave_complex_matrix::load_ascii(), octave_float_matrix::load_ascii(), octave_bool_matrix::load_ascii(), octave_matrix::load_ascii(), octave_base_int_matrix< intNDArray< OCTAVE_INT_T > >::load_binary(), octave_struct::load_binary(), octave_float_complex_matrix::load_binary(), octave_cell::load_binary(), octave_char_matrix_str::load_binary(), octave_complex_matrix::load_binary(), octave_float_matrix::load_binary(), octave_bool_matrix::load_binary(), octave_matrix::load_binary(), octave_sparse_bool_matrix::load_hdf5(), octave_sparse_complex_matrix::load_hdf5(), octave_sparse_matrix::load_hdf5(), octave_float_complex_matrix::load_hdf5(), octave_cell::load_hdf5(), octave_char_matrix_str::load_hdf5(), octave_complex_matrix::load_hdf5(), octave_float_matrix::load_hdf5(), octave_bool_matrix::load_hdf5(), octave_matrix::load_hdf5(), octave_base_int_matrix< intNDArray< OCTAVE_INT_T > >::load_hdf5_internal(), octave::base_ve_model::make_description_text(), QtHandles::Utils::makeImageFromCData(), OCTAVE_VALUE_INT_MATRIX_T::matrix_value(), SparseMatrix::max(), SparseComplexMatrix::max(), SparseMatrix::min(), SparseComplexMatrix::min(), mxArray_matlab::mxArray_matlab(), mxArray_number::mxArray_number(), Array< octave_value >::nth_element(), octave_class::numel(), oct_catop_matrix_struct(), oct_catop_struct_matrix(), dim_vector::operator=(), Array< octave_value >::optimize_dimensions(), Array< octave_value >::permute(), octave_base_sparse< SparseComplexMatrix >::print_as_scalar(), octave_base_matrix< boolNDArray >::print_as_scalar(), octave_base_diag< DiagMatrix, Matrix >::print_as_scalar(), octave_perm_matrix::print_as_scalar(), octave_struct::print_raw(), octave_cell::print_raw(), octave_scalar_struct::print_raw(), octave::textscan_format_list::read_first_row(), rec_index_helper::rec_index_helper(), rec_permute_helper::rec_permute_helper(), octave_map::reshape(), octave_value::reshape(), octave_perm_matrix::resize(), octave_base_diag< DiagMatrix, Matrix >::resize(), octave_lazy_index::resize(), octave_char_matrix_str::resize(), octave_struct::resize(), octave_range::resize(), octave_base_matrix< boolNDArray >::resize(), octave_base_sparse< SparseComplexMatrix >::resize(), octave_float_complex::resize(), octave_complex::resize(), octave_class::resize(), octave_scalar::resize(), octave_float_scalar::resize(), octave_bool::resize(), octave_char_matrix_sq_str::resize(), octave_scalar_struct::resize(), octave_map::resize(), Sparse< bool >::resize(), OCTAVE_VALUE_INT_SCALAR_T::resize(), octave_value::resize(), Array< octave_value >::resize(), Array< octave_value >::resize1(), octave_base_value::rows(), octave_base_int_matrix< intNDArray< OCTAVE_INT_T > >::save_ascii(), octave_struct::save_ascii(), octave_float_complex_matrix::save_ascii(), octave_cell::save_ascii(), octave_complex_matrix::save_ascii(), octave_char_matrix_str::save_ascii(), octave_base_sparse< SparseComplexMatrix >::save_ascii(), octave_float_matrix::save_ascii(), octave_bool_matrix::save_ascii(), octave_matrix::save_ascii(), octave_scalar_struct::save_ascii(), octave_base_int_matrix< intNDArray< OCTAVE_INT_T > >::save_binary(), octave_sparse_bool_matrix::save_binary(), octave_struct::save_binary(), octave_sparse_complex_matrix::save_binary(), octave_sparse_matrix::save_binary(), octave_float_complex_matrix::save_binary(), octave_cell::save_binary(), octave_char_matrix_str::save_binary(), octave_complex_matrix::save_binary(), octave_float_matrix::save_binary(), octave_bool_matrix::save_binary(), octave_matrix::save_binary(), octave_sparse_bool_matrix::save_hdf5(), octave_sparse_complex_matrix::save_hdf5(), octave_sparse_matrix::save_hdf5(), octave_float_complex_matrix::save_hdf5(), octave_cell::save_hdf5(), octave_char_matrix_str::save_hdf5(), octave_complex_matrix::save_hdf5(), octave_float_matrix::save_hdf5(), octave_bool_matrix::save_hdf5(), octave_matrix::save_hdf5(), octave_base_int_matrix< intNDArray< OCTAVE_INT_T > >::save_hdf5_internal(), save_mat5_binary_element(), octave::single_type_concat(), octave_class::size(), octave_base_value::size(), Array< octave_value >::sort(), Sparse< bool >::Sparse(), sub2ind(), octave_base_diag< DiagMatrix, Matrix >::subsasgn(), try_cellfun_internal_ops(), update_index(), octave::workspace_model::update_table(), vector_equivalent(), octave::jit_convert::visit_constant(), octave::tree_evaluator::visit_matrix(), octave::tree_evaluator::visit_simple_for_command(), and warn_array_as_logical().

◆ examples

the exceeded dimensions are set to if fewer subscripts than dimensions are the exceeding dimensions are merged into the final requested dimension For consider the following examples

Definition at line 255 of file sub2ind.cc.

◆ ind

ind

Definition at line 107 of file sub2ind.cc.

Referenced by ichol_t(), and octave_base_diag< DiagMatrix, Matrix >::subsasgn().

◆ matrices

OCTAVE_EXPORT octave_value_list etc The functions then then etc until it has numbered all of the elements Consider the following by matrices

Definition at line 107 of file sub2ind.cc.

◆ ode

the exceeded dimensions are set to ode {ind2sub} and ode{sub2ind} interconvert between the two forms. The linear index traverses dimension 1 (rows)

Definition at line 107 of file sub2ind.cc.

◆ page

◆ provided

the exceeded dimensions are set to if fewer subscripts than dimensions are provided

Definition at line 255 of file sub2ind.cc.

◆ retval

return retval
Initial value:
{
if (args.length () != 2)
OCTINTERP_API void print_usage(void)
Definition: defun.cc:54

Definition at line 256 of file sub2ind.cc.

◆ s2

s2 = [1, 3]

◆ try

try
Initial value:
{
retval = Array<octave_value> (ind2sub (dv, args(1).index_vector ()))
octave_value_list retval
Definition: sub2ind.cc:256
Array< idx_vector > ind2sub(const dim_vector &dv, const idx_vector &idx)
Definition: Array-util.cc:618
dim_vector dv
Definition: sub2ind.cc:263

Definition at line 266 of file sub2ind.cc.