GNU Octave 7.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
Range Class Reference

#include "Range.h"

Collaboration diagram for Range:

Public Member Functions

 Range (const octave::range< double > &r)
 
 Range (const Range &r)=default
 
 Range (double b, double i, octave_idx_type n)
 
 Range (double b, double l)
 
 Range (double b, double l, double i)
 
 Range (void)
 
 ~Range (void)=default
 
OCTAVE_API bool all_elements_are_ints (void) const
 
double base (void) const
 
OCTAVE_API double checkelem (octave_idx_type i) const
 
OCTAVE_API double checkelem (octave_idx_type i, octave_idx_type j) const
 
octave_idx_type cols (void) const
 
octave_idx_type columns (void) const
 
OCTAVE_API Matrix diag (octave_idx_type k=0) const
 
dim_vector dims (void) const
 
OCTAVE_API double elem (octave_idx_type i) const
 
double elem (octave_idx_type, octave_idx_type j) const
 
double final_value (void) const
 
double inc (void) const
 
double increment (void) const
 
OCTAVE_API Array< doubleindex (const octave::idx_vector &i) const
 
bool isempty (void) const
 
OCTAVE_API sortmode issorted (sortmode mode=ASCENDING) const
 
double limit (void) const
 
OCTAVE_API Matrix matrix_value (void) const
 
OCTAVE_API double max (void) const
 
OCTAVE_API double min (void) const
 
OCTAVE_API octave_idx_type nnz (void) const
 
octave_idx_type numel (void) const
 
bool ok (void) const
 
double operator() (octave_idx_type i) const
 
double operator() (octave_idx_type i, octave_idx_type j) const
 
Rangeoperator= (const Range &r)=default
 
octave_idx_type rows (void) const
 
OCTAVE_API void set_base (double b)
 
OCTAVE_API void set_inc (double i)
 
OCTAVE_API void set_limit (double l)
 
OCTAVE_API Range sort (Array< octave_idx_type > &sidx, octave_idx_type dim=0, sortmode mode=ASCENDING) const
 
OCTAVE_API Range sort (octave_idx_type dim=0, sortmode mode=ASCENDING) const
 
OCTAVE_API void sort_internal (Array< octave_idx_type > &sidx, bool ascending=true)
 
OCTAVE_API void sort_internal (bool ascending=true)
 

Protected Member Functions

 Range (double b, double l, double i, octave_idx_type n)
 

Private Member Functions

OCTAVE_API void init (void)
 
OCTAVE_API double limit_internal (void) const
 
OCTAVE_API octave_idx_type numel_internal (void) const
 

Private Attributes

double m_base
 
double m_inc
 
double m_limit
 
octave_idx_type m_numel
 

Friends

OCTAVE_API Range operator* (const Range &r, double x)
 
OCTAVE_API Range operator* (double x, const Range &r)
 
OCTAVE_API Range operator+ (const Range &r, double x)
 
OCTAVE_API Range operator+ (double x, const Range &r)
 
OCTAVE_API Range operator- (const Range &r)
 
OCTAVE_API Range operator- (const Range &r, double x)
 
OCTAVE_API Range operator- (double x, const Range &r)
 
OCTAVE_API std::ostream & operator<< (std::ostream &os, const Range &r)
 
OCTAVE_API std::istream & operator>> (std::istream &is, Range &r)
 

Detailed Description

Definition at line 398 of file Range.h.

Constructor & Destructor Documentation

◆ Range() [1/7]

Range::Range ( void  )
inline

Definition at line 404 of file Range.h.

◆ Range() [2/7]

Range::Range ( const octave::range< double > &  r)
inline

Definition at line 414 of file Range.h.

◆ Range() [3/7]

Range::Range ( const Range r)
default

◆ ~Range()

Range::~Range ( void  )
default

◆ Range() [4/7]

Range::Range ( double  b,
double  l 
)
inline

Definition at line 426 of file Range.h.

References octave::math::isinf().

◆ Range() [5/7]

Range::Range ( double  b,
double  l,
double  i 
)
inline

Definition at line 434 of file Range.h.

References octave::math::isinf().

◆ Range() [6/7]

Range::Range ( double  b,
double  i,
octave_idx_type  n 
)
inline

Definition at line 448 of file Range.h.

References octave::math::isinf().

◆ Range() [7/7]

Range::Range ( double  b,
double  l,
double  i,
octave_idx_type  n 
)
inlineprotected

Definition at line 560 of file Range.h.

Member Function Documentation

◆ all_elements_are_ints()

bool Range::all_elements_are_ints ( void  ) const

Definition at line 457 of file Range.cc.

References octave::math::isnan(), m_base, m_inc, m_numel, and octave::math::nint_big().

Referenced by limit_internal().

◆ base()

double Range::base ( void  ) const
inline

Definition at line 462 of file Range.h.

Referenced by octave_legacy_range::try_narrowing_conversion().

◆ checkelem() [1/2]

double Range::checkelem ( octave_idx_type  i) const

Definition at line 526 of file Range.cc.

References dims(), octave::err_index_out_of_range(), m_base, m_inc, m_limit, and m_numel.

Referenced by checkelem().

◆ checkelem() [2/2]

double Range::checkelem ( octave_idx_type  i,
octave_idx_type  j 
) const

Definition at line 540 of file Range.cc.

References checkelem(), dims(), octave::err_index_out_of_range(), and m_numel.

◆ cols()

octave_idx_type Range::cols ( void  ) const
inline

Definition at line 482 of file Range.h.

References numel().

◆ columns()

octave_idx_type Range::columns ( void  ) const
inline

Definition at line 483 of file Range.h.

References numel().

◆ diag()

Matrix Range::diag ( octave_idx_type  k = 0) const

Definition at line 692 of file Range.cc.

References Matrix::diag(), and matrix_value().

◆ dims()

dim_vector Range::dims ( void  ) const
inline

Definition at line 478 of file Range.h.

Referenced by checkelem(), and index().

◆ elem() [1/2]

double Range::elem ( octave_idx_type  i) const

Definition at line 550 of file Range.cc.

References m_base, m_inc, m_limit, and m_numel.

◆ elem() [2/2]

double Range::elem ( octave_idx_type  ,
octave_idx_type  j 
) const
inline

Definition at line 513 of file Range.h.

References elem.

◆ final_value()

double Range::final_value ( void  ) const
inline

Definition at line 474 of file Range.h.

◆ inc()

double Range::inc ( void  ) const
inline

Definition at line 464 of file Range.h.

◆ increment()

double Range::increment ( void  ) const
inline

Definition at line 465 of file Range.h.

Referenced by matrix_value(), and octave_legacy_range::try_narrowing_conversion().

◆ index()

◆ init()

void Range::init ( void  )
private

Definition at line 998 of file Range.cc.

References octave::math::isinf(), limit_internal(), m_limit, m_numel, and numel_internal().

Referenced by set_base(), set_inc(), and set_limit().

◆ isempty()

bool Range::isempty ( void  ) const
inline

Definition at line 485 of file Range.h.

References numel().

Referenced by nnz().

◆ issorted()

sortmode Range::issorted ( sortmode  mode = ASCENDING) const

Definition at line 735 of file Range.cc.

References ASCENDING, DESCENDING, m_inc, m_numel, and UNSORTED.

◆ limit()

double Range::limit ( void  ) const
inline

Definition at line 463 of file Range.h.

Referenced by octave_legacy_range::try_narrowing_conversion().

◆ limit_internal()

double Range::limit_internal ( void  ) const
private

Definition at line 986 of file Range.cc.

References all_elements_are_ints(), m_inc, max(), min(), and octave::math::round().

Referenced by init().

◆ matrix_value()

Matrix Range::matrix_value ( void  ) const

◆ max()

double Range::max ( void  ) const

Definition at line 629 of file Range.cc.

References m_base, m_inc, m_limit, and m_numel.

Referenced by limit_internal().

◆ min()

double Range::min ( void  ) const

Definition at line 608 of file Range.cc.

References m_base, m_inc, m_limit, and m_numel.

Referenced by limit_internal().

◆ nnz()

octave_idx_type Range::nnz ( void  ) const

Definition at line 469 of file Range.cc.

References octave::math::floor(), isempty(), m_base, m_inc, m_limit, and m_numel.

◆ numel()

octave_idx_type Range::numel ( void  ) const
inline

◆ numel_internal()

octave_idx_type Range::numel_internal ( void  ) const
private

Definition at line 935 of file Range.cc.

References octave::math::isfinite(), octave::math::isinf(), octave::math::isnan(), m_base, m_inc, m_limit, max(), teq(), and tfloor().

Referenced by init().

◆ ok()

bool Range::ok ( void  ) const
inline

Definition at line 456 of file Range.h.

References octave::math::isfinite().

◆ operator()() [1/2]

double Range::operator() ( octave_idx_type  i) const
inline

Definition at line 516 of file Range.h.

References elem.

◆ operator()() [2/2]

double Range::operator() ( octave_idx_type  i,
octave_idx_type  j 
) const
inline

Definition at line 517 of file Range.h.

References elem.

◆ operator=()

Range & Range::operator= ( const Range r)
default

◆ rows()

octave_idx_type Range::rows ( void  ) const
inline

Definition at line 480 of file Range.h.

◆ set_base()

void Range::set_base ( double  b)

Definition at line 748 of file Range.cc.

References init(), and m_base.

◆ set_inc()

void Range::set_inc ( double  i)

Definition at line 770 of file Range.cc.

References init(), and m_inc.

◆ set_limit()

void Range::set_limit ( double  l)

Definition at line 759 of file Range.cc.

References init(), and m_limit.

◆ sort() [1/2]

Range Range::sort ( Array< octave_idx_type > &  sidx,
octave_idx_type  dim = 0,
sortmode  mode = ASCENDING 
) const

Definition at line 716 of file Range.cc.

References ASCENDING, DESCENDING, and sort_internal().

◆ sort() [2/2]

Range Range::sort ( octave_idx_type  dim = 0,
sortmode  mode = ASCENDING 
) const

Definition at line 698 of file Range.cc.

References ASCENDING, DESCENDING, and sort_internal().

◆ sort_internal() [1/2]

void Range::sort_internal ( Array< octave_idx_type > &  sidx,
bool  ascending = true 
)

◆ sort_internal() [2/2]

void Range::sort_internal ( bool  ascending = true)

Definition at line 655 of file Range.cc.

References m_base, m_inc, and m_limit.

Referenced by sort().

Friends And Related Function Documentation

◆ operator* [1/2]

OCTAVE_API Range operator* ( const Range r,
double  x 
)
friend

Definition at line 857 of file Range.cc.

◆ operator* [2/2]

OCTAVE_API Range operator* ( double  x,
const Range r 
)
friend

Definition at line 851 of file Range.cc.

◆ operator+ [1/2]

OCTAVE_API Range operator+ ( const Range r,
double  x 
)
friend

Definition at line 833 of file Range.cc.

◆ operator+ [2/2]

OCTAVE_API Range operator+ ( double  x,
const Range r 
)
friend

Definition at line 827 of file Range.cc.

◆ operator- [1/3]

OCTAVE_API Range operator- ( const Range r)
friend

Definition at line 821 of file Range.cc.

◆ operator- [2/3]

OCTAVE_API Range operator- ( const Range r,
double  x 
)
friend

Definition at line 845 of file Range.cc.

◆ operator- [3/3]

OCTAVE_API Range operator- ( double  x,
const Range r 
)
friend

Definition at line 839 of file Range.cc.

◆ operator<<

OCTAVE_API std::ostream & operator<< ( std::ostream &  os,
const Range r 
)
friend

Definition at line 780 of file Range.cc.

◆ operator>>

OCTAVE_API std::istream & operator>> ( std::istream &  is,
Range r 
)
friend

Definition at line 802 of file Range.cc.

Member Data Documentation

◆ m_base

double Range::m_base
private

◆ m_inc

◆ m_limit

double Range::m_limit
private

◆ m_numel

octave_idx_type Range::m_numel
private

Definition at line 546 of file Range.h.

Referenced by all_elements_are_ints(), checkelem(), elem(), index(), init(), issorted(), matrix_value(), max(), min(), and nnz().


The documentation for this class was generated from the following files: