60 Array2D(
int a,
int b,
int c,
int d,
const E &x) {
77 A.construct(0,-1,0,-1);
132 void init(
int a,
int b,
int c,
int d) {
139 void init(
int a,
int b,
int c,
int d,
const E &x) {
168 A.construct(0,-1,0,-1);
190 void construct(
int a,
int b,
int c,
int d);
210 size_t lenDim1 = b-a+1;
218 m_pStart =
static_cast<E *
>( malloc(len*
sizeof(E)) );
234 for (; pDest <
m_pStop; pDest++)
251 for (; pDest <
m_pStop; pDest++)
266 if (!std::is_trivially_destructible<E>::value) {
283 new (--pDest) E(*--pSrc);
304 float determinant = 0.0;
310 determinant = (float)((*
this)(a, c));
313 determinant = (float)((*
this)(a, c) * (*
this)(b, d) - (*
this)(a, d) * (*
this)(b, c));
319 for(column = c; column <= d; column++) {
322 for(i = a; i <= b; i++) {
323 for(j = c; j <= d; j++) {
324 if(i != a && j != column) {
325 remMatrix(rem_i, rem_j) = (*this)(i, j);
336 determinant += pow(-1.0,(a+column)) * (*this)(a,column) * remMatrix.
det();
int high1() const
Returns the maximal array index in dimension 1.
void copy(const Array2D< E > &array2)
Copy array2.
void deconstruct()
Call destructor of all elements.
int size2() const
Returns the length of the index interval (number of entries) in dimension 2.
Array2D(int a, int b, int c, int d)
Creates a two-dimensional array with index set [a, ..., b]*[c, ..., d].
#define OGDF_THROW(CLASS)
Replacement for throw.
E * m_vpStart
The virtual start of the array (address of A[0,0]).
E * m_pStop
Successor of last element (address of A[high1,high2+1]).
E * m_pStart
The real start of the array (address of A[low1,low2]).
int m_lenDim2
The number of elements in dimension 2.
Array2D(const Array2D< E > &A)
Creates a two-dimensional array that is a copy of A.
Array2D(Array2D< E > &&A)
Creates a two-dimensional array containing the elements of A (move semantics).
void init(int a, int b, int c, int d)
Reinitializes the array to an array with index set [a, ..., b]*[c, ..., d].
int size() const
Returns the size (number of elements) of the array.
int m_b
The highest index in dimension 1.
float det() const
Returns the determinant of the matrix.
void init()
Reinitializes the array to an array with empty index set.
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 w...
void construct(int a, int b, int c, int d)
Constructs the array with index set [a, ..., b]*[c, ..., d].
int m_c
The lowest index in dimension 2.
Definition of exception classes.
int high2() const
Returns the maximal array index in dimension 2.
The parameterized class Array2D implements dynamic two-dimensional arrays.
Exception thrown when not enough memory is available to execute an algorithm.
const E & operator()(int i, int j) const
Returns a reference to the element with index (i,j).
E & operator()(int i, int j)
Returns a reference to the element with index (i,j).
int size1() const
Returns the length of the index interval (number of entries) in dimension 1.
int low2() const
Returns the minimal array index in dimension 2.
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 entrie...
void fill(const E &x)
Sets all elements to x.
int m_a
The lowest index in dimension 1.
Array2D< E > & operator=(Array2D< E > &&A)
Assignment operator (move semantics).
The namespace for all OGDF objects.
int m_d
The highest index in dimension 2.
void initialize()
Initializes the array with default constructor of E.
Array2D< E > & operator=(const Array2D< E > &array2)
Assignment operator.
int low1() const
Returns the minimal array index in dimension 1.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Array2D()
Creates a two-dimensional array with empty index set.