61 Array2D(
int a,
int b,
int c,
int d,
const E& x) {
82 A.construct(0, -1, 0, -1);
135 void init(
int a,
int b,
int c,
int d) {
142 void init(
int a,
int b,
int c,
int d,
const E& x) {
171 A.construct(0, -1, 0, -1);
213 m_lenDim2 =
d - c + 1;
215 if (
lenDim1 < 1 || m_lenDim2 < 1) {
216 m_pStart = m_vpStart = m_pStop =
nullptr;
219 size_t len =
lenDim1 * m_lenDim2;
220 m_pStart =
static_cast<E*
>(
malloc(len *
sizeof(E)));
221 if (m_pStart ==
nullptr) {
225 m_vpStart = m_pStart - c;
226 m_pStop = m_pStart + len;
239 while (--
pDest >= m_pStart) {
256 while (--
pDest >= m_pStart) {
267 if (!std::is_trivially_destructible<E>::value) {
283 while (
pDest > m_pStart) {
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) {
335 determinant +=
pow(-1.0, (a + column)) * (*this)(a, column) *
remMatrix.det();
The parameterized class Array2D implements dynamic two-dimensional arrays.
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...
Array2D(int a, int b, int c, int d)
Creates a two-dimensional array with index set [a, ..., b]*[c, ..., d].
E * m_vpStart
The virtual start of the array (address of A[0,0]).
int size2() const
Returns the length of the index interval (number of entries) in dimension 2.
int high2() const
Returns the maximal array index in dimension 2.
Array2D(Array2D< E > &&A)
Creates a two-dimensional array containing the elements of A (move semantics).
int m_d
The highest index in dimension 2.
void init(int a, int b, int c, int d)
Reinitializes the array to an array with index set [a, ..., b]*[c, ..., d].
E * m_pStop
Successor of last element (address of A[high1,high2+1]).
void initialize()
Initializes the array with default constructor of E.
int m_lenDim2
The number of elements in dimension 2.
void deconstruct()
Call destructor of all elements.
int m_c
The lowest index in dimension 2.
E * m_pStart
The real start of the array (address of A[low1,low2]).
int high1() const
Returns the maximal array index in dimension 1.
const E & operator()(int i, int j) const
Returns a reference to the element with index (i,j).
void copy(const Array2D< E > &array2)
Copy array2.
float det() const
Returns the determinant of the matrix.
Array2D< E > & operator=(const Array2D< E > &array2)
Assignment operator.
int size1() const
Returns the length of the index interval (number of entries) in dimension 1.
void initialize(const E &x)
Initializes the array with x.
int low1() const
Returns the minimal array index in dimension 1.
E & operator()(int i, int j)
Returns a reference to the element with index (i,j).
Array2D< E > & operator=(Array2D< E > &&A)
Assignment operator (move semantics).
Array2D(const Array2D< E > &A)
Creates a two-dimensional array that is a copy of A.
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...
int size() const
Returns the size (number of elements) of the array.
Array2D()
Creates a two-dimensional array with empty index set.
void construct(int a, int b, int c, int d)
Constructs the array with index set [a, ..., b]*[c, ..., d].
int m_b
The highest index in dimension 1.
int low2() const
Returns the minimal array index in dimension 2.
int m_a
The lowest index in dimension 1.
void fill(const E &x)
Sets all elements to x.
Exception thrown when not enough memory is available to execute an algorithm.
Definition of exception classes.
#define OGDF_THROW(CLASS)
Replacement for throw.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.