48 #ifndef OGDF_ARRAY2D_H
49 #define OGDF_ARRAY2D_H
77 Array2D(
int a,
int b,
int c,
int d,
const E &x) {
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) {
169 void construct(
int a,
int b,
int c,
int d);
193 if (lenDim1 < 1 || m_lenDim2 < 1) {
194 m_pStart = m_vpStart = m_pStop = 0;
197 int len = lenDim1*m_lenDim2;
198 m_pStart = (E *)malloc(len*
sizeof(E));
202 m_vpStart = m_pStart - c;
203 m_pStop = m_pStart + len;
213 for (; pDest < m_pStop; pDest++)
216 while(--pDest >= m_pStart)
229 for (; pDest < m_pStop; pDest++)
232 while(--pDest >= m_pStart)
244 for (E *pDest = m_pStart; pDest < m_pStop; pDest++)
254 construct(array2.
m_a, array2.
m_b, array2.
m_c, array2.
m_d);
259 while(pDest > m_pStart)
260 new (--pDest) E(*--pSrc);
273 int m = m_b - m_a + 1;
277 int rem_i, rem_j, column;
279 float determinant = 0.0;
287 determinant = (float)((*
this)(a, c));
290 determinant = (float)((*
this)(a, c) * (*
this)(b, d) - (*
this)(a, d) * (*
this)(b, c));
296 for(column = c; column <= d; column++) {
299 for(i = a; i <= b; i++) {
300 for(j = c; j <= d; j++) {
301 if(i != a && j != column) {
302 remMatrix(rem_i, rem_j) = (*this)(i, j);
313 determinant += pow(-1.0,(a+column)) * (*this)(a,column) * remMatrix.
det();