# OpenGraph DrawingFramework

v. 2023.09 (Elderberry)

Searching...
No Matches
ogdf::Array2D< E > Class Template Reference

The parameterized class Array2D implements dynamic two-dimensional arrays. More...

#include <ogdf/basic/Array2D.h>

## Public Member Functions

Array2D ()
Creates a two-dimensional array with empty index set.

Array2D (Array2D< E > &&A)
Creates a two-dimensional array containing the elements of A (move semantics).

Array2D (const Array2D< E > &A)
Creates a two-dimensional array that is a copy of A.

Array2D (int a, int b, int c, int d)
Creates a two-dimensional array with index set [a, ..., b]*[c, ..., d].

Array2D (int a, int b, int c, int d, const E &x)
Creates a two-dimensional array with index set [a, ..., b]*[c, ..., d] and initailizes all elements with x.

~Array2D ()
Destructor.

float det () const
Returns the determinant of the matrix.

void fill (const E &x)
Sets all elements to x.

int high1 () const
Returns the maximal array index in dimension 1.

int high2 () const
Returns the maximal array index in dimension 2.

void init ()
Reinitializes the array to an array with empty index set.

void init (int a, int b, int c, int d)
Reinitializes the array to an array with index set [a, ..., b]*[c, ..., d].

void init (int a, int b, int c, int d, const E &x)
Reinitializes the array to an array with index set [a, ..., b]*[c, ..., d] and initializes all entries with x.

int low1 () const
Returns the minimal array index in dimension 1.

int low2 () const
Returns the minimal array index in dimension 2.

E & operator() (int i, int j)
Returns a reference to the element with index (i,j).

const E & operator() (int i, int j) const
Returns a reference to the element with index (i,j).

Array2D< E > & operator= (Array2D< E > &&A)
Assignment operator (move semantics).

Array2D< E > & operator= (const Array2D< E > &array2)
Assignment operator.

int size () const
Returns the size (number of elements) of the array.

int size1 () const
Returns the length of the index interval (number of entries) in dimension 1.

int size2 () const
Returns the length of the index interval (number of entries) in dimension 2.

## Private Member Functions

void construct (int a, int b, int c, int d)
Constructs the array with index set [a, ..., b]*[c, ..., d].

void copy (const Array2D< E > &array2)
Copy array2.

void deconstruct ()
Call destructor of all elements.

void initialize ()
Initializes the array with default constructor of E.

void initialize (const E &x)
Initializes the array with x.

## Private Attributes

int m_a
The lowest index in dimension 1.

int m_b
The highest index in dimension 1.

int m_c
The lowest index in dimension 2.

int m_d
The highest index in dimension 2.

int m_lenDim2
The number of elements in dimension 2.

E * m_pStart
The real start of the array (address of A[low1,low2]).

E * m_pStop
Successor of last element (address of A[high1,high2+1]).

E * m_vpStart
The virtual start of the array (address of A[0,0]).

## Detailed Description

template<class E>
class ogdf::Array2D< E >

The parameterized class Array2D implements dynamic two-dimensional arrays.

Template Parameters
 E denotes the element type.

Definition at line 47 of file Array2D.h.

## ◆ Array2D() [1/5]

template<class E >
 ogdf::Array2D< E >::Array2D ( )
inline

Creates a two-dimensional array with empty index set.

Definition at line 52 of file Array2D.h.

## ◆ Array2D() [2/5]

template<class E >
 ogdf::Array2D< E >::Array2D ( int a, int b, int c, int d )
inline

Creates a two-dimensional array with index set [a, ..., b]*[c, ..., d].

Definition at line 55 of file Array2D.h.

## ◆ Array2D() [3/5]

template<class E >
 ogdf::Array2D< E >::Array2D ( int a, int b, int c, int d, const E & x )
inline

Creates a two-dimensional array with index set [a, ..., b]*[c, ..., d] and initailizes all elements with x.

Definition at line 61 of file Array2D.h.

## ◆ Array2D() [4/5]

template<class E >
 ogdf::Array2D< E >::Array2D ( const Array2D< E > & A )
inline

Creates a two-dimensional array that is a copy of A.

Definition at line 67 of file Array2D.h.

## ◆ Array2D() [5/5]

template<class E >
 ogdf::Array2D< E >::Array2D ( Array2D< E > && A )
inline

Creates a two-dimensional array containing the elements of A (move semantics).

The array A is empty afterwards.

Definition at line 73 of file Array2D.h.

## ◆ ~Array2D()

template<class E >
 ogdf::Array2D< E >::~Array2D ( )
inline

Destructor.

Definition at line 86 of file Array2D.h.

## ◆ construct()

template<class E >
 void ogdf::Array2D< E >::construct ( int a, int b, int c, int d )
private

Constructs the array with index set [a, ..., b]*[c, ..., d].

Definition at line 206 of file Array2D.h.

## ◆ copy()

template<class E >
 void ogdf::Array2D< E >::copy ( const Array2D< E > & array2 )
private

Copy array2.

Definition at line 277 of file Array2D.h.

## ◆ deconstruct()

template<class E >
 void ogdf::Array2D< E >::deconstruct ( )
private

Call destructor of all elements.

Definition at line 266 of file Array2D.h.

## ◆ det()

template<class E >
 float ogdf::Array2D< E >::det ( ) const

Returns the determinant of the matrix.

Computes the determinant via row expansion.

Note
use only for square matrices and floating point values

Definition at line 291 of file Array2D.h.

## ◆ fill()

template<class E >
 void ogdf::Array2D< E >::fill ( const E & x )
inline

Sets all elements to x.

Definition at line 176 of file Array2D.h.

## ◆ high1()

template<class E >
 int ogdf::Array2D< E >::high1 ( ) const
inline

Returns the maximal array index in dimension 1.

Definition at line 92 of file Array2D.h.

## ◆ high2()

template<class E >
 int ogdf::Array2D< E >::high2 ( ) const
inline

Returns the maximal array index in dimension 2.

Definition at line 98 of file Array2D.h.

## ◆ init() [1/3]

template<class E >
 void ogdf::Array2D< E >::init ( )
inline

Reinitializes the array to an array with empty index set.

Definition at line 132 of file Array2D.h.

## ◆ init() [2/3]

template<class E >
 void ogdf::Array2D< E >::init ( int a, int b, int c, int d )
inline

Reinitializes the array to an array with index set [a, ..., b]*[c, ..., d].

Definition at line 135 of file Array2D.h.

## ◆ init() [3/3]

template<class E >
 void ogdf::Array2D< E >::init ( int a, int b, int c, int d, const E & x )
inline

Reinitializes the array to an array with index set [a, ..., b]*[c, ..., d] and initializes all entries with x.

Definition at line 142 of file Array2D.h.

## ◆ initialize() [1/2]

template<class E >
 void ogdf::Array2D< E >::initialize ( )
private

Initializes the array with default constructor of E.

Definition at line 232 of file Array2D.h.

## ◆ initialize() [2/2]

template<class E >
 void ogdf::Array2D< E >::initialize ( const E & x )
private

Initializes the array with x.

Definition at line 249 of file Array2D.h.

## ◆ low1()

template<class E >
 int ogdf::Array2D< E >::low1 ( ) const
inline

Returns the minimal array index in dimension 1.

Definition at line 89 of file Array2D.h.

## ◆ low2()

template<class E >
 int ogdf::Array2D< E >::low2 ( ) const
inline

Returns the minimal array index in dimension 2.

Definition at line 95 of file Array2D.h.

## ◆ operator()() [1/2]

template<class E >
 E & ogdf::Array2D< E >::operator() ( int i, int j )
inline

Returns a reference to the element with index (i,j).

Definition at line 123 of file Array2D.h.

## ◆ operator()() [2/2]

template<class E >
 const E & ogdf::Array2D< E >::operator() ( int i, int j ) const
inline

Returns a reference to the element with index (i,j).

Definition at line 114 of file Array2D.h.

## ◆ operator=() [1/2]

template<class E >
 Array2D< E > & ogdf::Array2D< E >::operator= ( Array2D< E > && A )
inline

Assignment operator (move semantics).

Array A is empty afterwards.

Definition at line 159 of file Array2D.h.

## ◆ operator=() [2/2]

template<class E >
 Array2D< E > & ogdf::Array2D< E >::operator= ( const Array2D< E > & array2 )
inline

Assignment operator.

Definition at line 149 of file Array2D.h.

## ◆ size()

template<class E >
 int ogdf::Array2D< E >::size ( ) const
inline

Returns the size (number of elements) of the array.

Definition at line 101 of file Array2D.h.

## ◆ size1()

template<class E >
 int ogdf::Array2D< E >::size1 ( ) const
inline

Returns the length of the index interval (number of entries) in dimension 1.

Definition at line 104 of file Array2D.h.

## ◆ size2()

template<class E >
 int ogdf::Array2D< E >::size2 ( ) const
inline

Returns the length of the index interval (number of entries) in dimension 2.

Definition at line 107 of file Array2D.h.

## ◆ m_a

template<class E >
 int ogdf::Array2D< E >::m_a
private

The lowest index in dimension 1.

Definition at line 189 of file Array2D.h.

## ◆ m_b

template<class E >
 int ogdf::Array2D< E >::m_b
private

The highest index in dimension 1.

Definition at line 190 of file Array2D.h.

## ◆ m_c

template<class E >
 int ogdf::Array2D< E >::m_c
private

The lowest index in dimension 2.

Definition at line 191 of file Array2D.h.

## ◆ m_d

template<class E >
 int ogdf::Array2D< E >::m_d
private

The highest index in dimension 2.

Definition at line 192 of file Array2D.h.

## ◆ m_lenDim2

template<class E >
 int ogdf::Array2D< E >::m_lenDim2
private

The number of elements in dimension 2.

Definition at line 185 of file Array2D.h.

## ◆ m_pStart

template<class E >
 E* ogdf::Array2D< E >::m_pStart
private

The real start of the array (address of A[low1,low2]).

Definition at line 186 of file Array2D.h.

## ◆ m_pStop

template<class E >
 E* ogdf::Array2D< E >::m_pStop
private

Successor of last element (address of A[high1,high2+1]).

Definition at line 187 of file Array2D.h.

## ◆ m_vpStart

template<class E >
 E* ogdf::Array2D< E >::m_vpStart
private

The virtual start of the array (address of A[0,0]).

Definition at line 184 of file Array2D.h.

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