18 #include "OSParameters.h"
53 std::ostringstream outStr;
54 outStr <<
"inside MatrixNode destructor" << std::endl;
67 outStr <<
"deleting Matrixnode->m_mChildren[" << i <<
"] at "
78 inumberOfChildren = 0;
112 "First object is NULL, second is not");
123 "Second object is NULL, first is not");
169 ExpandedMatrixInRowMajorForm(NULL),
170 ExpandedMatrixInColumnMajorForm(NULL),
171 ExpandedMatrixByBlocks(NULL),
172 m_miRowPartition(NULL),
173 m_iRowPartitionSize(0),
174 m_miColumnPartition(NULL),
175 m_iColumnPartitionSize(0),
176 m_bHaveRowPartition(false),
177 m_bHaveColumnPartition(false)
316 int base_r0, base_c0, base_rN, base_cN;
351 bool isShifted = (iroff > 0 || icoff > 0);
352 bool isCropped = (base_c0 > 0 || base_r0 > 0 ||
355 bool isClipped = (iroff + base_rN - base_r0 >=
numberOfRows ||
357 bool isScaled = (scaleMult != 1);
362 if ( !isShifted && !isCropped && !isClipped && !isScaled && !reTyped )
381 for (
int i=0; i < baseMtx->
startSize; i++)
385 i < ExpandedMatrixInColumnMajorForm->startSize; i++)
394 if ( !isShifted && !isCropped && !isClipped )
413 for (
int i=0; i < baseMtx->
startSize; i++)
417 i < ExpandedMatrixInColumnMajorForm->startSize; i++)
427 for (
int i = 0; i < baseMtx->
valueSize; i++)
436 for (
int i = 0; i < baseMtx->
valueSize; i++)
452 for (
int i = 0; i < baseMtx->
valueSize; i++)
455 if (!(tmpValues->
el[i]
457 throw ErrorClass(
"failed copying linear element values in method getMatrixCoefficientsInColumnMajor()");
468 for (
int i = 0; i < baseMtx->
valueSize; i++)
482 throw ErrorClass(
"scalar multiple not defined for objReference elements in getMatrixCoefficientsInColumnMajor()");
486 throw ErrorClass(
"scalar multiple not defined for conReference elements in getMatrixCoefficientsInColumnMajor()");
500 int* tmpStarts =
new int[startSize];
501 for (
int i=0; i < startSize; i++)
504 int adjc = icoff - base_c0;
505 int lastcol = icoff + base_cN - base_c0 + 1;
510 for (
int i=icoff; i<lastcol; i++)
511 for (
int j=baseMtx->
start[i-adjc]; j<baseMtx->start[i-adjc+1];
j++)
513 if (baseMtx->
index[
j] >= base_r0 &&
514 baseMtx->
index[
j] <= base_rN &&
518 for (
int i=icoff+1; i < startSize; i++)
519 tmpStarts[i] += tmpStarts[i-1];
521 int valueSize = tmpStarts[startSize-1];
522 int* tmpIndexes =
new int[valueSize];
534 for (
int i=icoff; i<lastcol; i++)
535 for (
int j=baseMtx->
start[i-adjc]; j<baseMtx->start[i-adjc+1];
j++)
537 if (baseMtx->
index[
j] >= base_r0 &&
538 baseMtx->
index[
j] <= base_rN &&
541 tmpIndexes[ival] = baseMtx->
index[
j] - base_r0 + iroff;
559 for (
int i=icoff; i<lastcol; i++)
560 for (
int j=baseMtx->
start[i-adjc]; j<baseMtx->start[i-adjc+1];
j++)
562 if (baseMtx->
index[
j] >= base_r0 &&
565 tmpIndexes[ival] = baseMtx->
index[
j] - base_r0 + iroff;
582 for (
int i=icoff; i<lastcol; i++)
583 for (
int j=baseMtx->
start[i-adjc]; j<baseMtx->start[i-adjc+1];
j++)
585 if (baseMtx->
index[
j] >= base_r0 &&
612 for (
int i=icoff; i<lastcol; i++)
613 for (
int j=baseMtx->
start[i-adjc]; j<baseMtx->start[i-adjc+1];
j++)
615 if (baseMtx->
index[
j] >= base_r0 &&
619 if (!(tmpValues->
el[ival]
621 throw ErrorClass(
"failed copying linear element values in method getMatrixCoefficientsInColumnMajor()");
638 for (
int i=icoff; i<lastcol; i++)
639 for (
int j=baseMtx->
start[i-adjc]; j<baseMtx->start[i-adjc+1];
j++)
641 if (baseMtx->
index[
j] >= base_r0 &&
650 ->copyNodeAndDescendants();
663 for (
int i=icoff; i<lastcol; i++)
664 for (
int j=baseMtx->
start[i-adjc]; j<baseMtx->start[i-adjc+1];
j++)
666 if (baseMtx->
index[
j] >= base_r0 &&
675 ((
OSnLNodeNumber*)tmpValues->el[ival]->m_treeRoot->m_mChildren[0])->value = scaleMult;
688 throw ErrorClass(
"scalar multiple not defined for objReference elements in getMatrixCoefficientsInColumnMajor()");
692 throw ErrorClass(
"scalar multiple not defined for conReference elements in getMatrixCoefficientsInColumnMajor()");
703 throw ErrorClass(
"error processing blocks in getMatrixCoefficientsInColumnMajor()");
727 for (
int j = c0;
j < cN;
j++)
755 for (
int j = c0;
j < cN;
j++)
759 k < currentBlocks->blocks[i]->start[
j-c0+1];
k++)
761 tmpIndexes[loc] = currentBlocks->
blocks[i]->
index[
k] + row_adj;
773 throw ErrorClass(
"getMatrixCoefficientsInColumnMajor: Can only handle constant values so far in blocks");
785 throw ErrorClass(
"transformations not yet implemented in getMatrixCoefficientsInColumnMajor()");
825 throw ErrorClass(
"Unknown element type in getMatrixCoefficientsInColumnMajor()");
856 for (j = refMtx->
start->
el[i]; j < refMtx->start->el[i + 1]; j++)
879 for (j = refMtx->
start->
el[i]; j < refMtx->start->el[ i + 1 ]; j++)
898 for (j = refMtx->
start->
el[i]; j < refMtx->start->el[ i + 1 ]; j++)
920 for (j = refMtx->
start->
el[i]; j < refMtx->start->el[ i + 1 ]; j++)
946 for (j = refMtx->
start->
el[i]; j < refMtx->start->el[ i + 1 ]; j++)
965 for (j = refMtx->
start->
el[i]; j < refMtx->start->el[ i + 1 ]; j++)
987 for (j = refMtx->
start->
el[i]; j < refMtx->start->el[ i + 1 ]; j++)
1018 throw ErrorClass(
"Multiple constructors not yet implemented in getMatrixCoefficientsInColumnMajor()");
1068 int base_r0, base_c0, base_rN, base_cN;
1103 bool isShifted = (iroff > 0 || icoff > 0);
1104 bool isCropped = (base_c0 > 0 || base_r0 > 0 ||
1107 bool isClipped = (iroff + base_rN - base_r0 >=
numberOfRows ||
1109 bool isScaled = (scaleMult != 1);
1114 if ( !isShifted && !isCropped && !isClipped && !isScaled && !reTyped )
1133 for (
int i=0; i < baseMtx->
startSize; i++)
1137 i < ExpandedMatrixInRowMajorForm->startSize; i++)
1145 if ( !isShifted && !isCropped && !isClipped )
1164 for (
int i=0; i < baseMtx->
startSize; i++)
1168 i < ExpandedMatrixInRowMajorForm->startSize; i++)
1178 for (
int i = 0; i < baseMtx->
valueSize; i++)
1187 for (
int i = 0; i < baseMtx->
valueSize; i++)
1203 for (
int i = 0; i < baseMtx->
valueSize; i++)
1206 if (!(tmpValues->
el[i]
1208 throw ErrorClass(
"failed copying linear element values in method getMatrixCoefficientsInRowMajor()");
1219 for (
int i = 0; i < baseMtx->
valueSize; i++)
1233 throw ErrorClass(
"scalar multiple not defined for objReference elements in getMatrixCoefficientsInRowMajor()");
1237 throw ErrorClass(
"scalar multiple not defined for conReference elements in getMatrixCoefficientsInRowMajor()");
1251 int* tmpStarts =
new int[startSize];
1252 for (
int i=0; i < startSize; i++)
1255 int adjc = icoff - base_c0;
1256 int lastcol = icoff + base_cN - base_c0 + 1;
1261 for (
int i=icoff; i<lastcol; i++)
1262 for (
int j=baseMtx->
start[i-adjc]; j<baseMtx->start[i-adjc+1];
j++)
1264 if (baseMtx->
index[
j] >= base_r0 &&
1265 baseMtx->
index[
j] <= base_rN &&
1269 for (
int i=icoff+1; i <= startSize; i++)
1270 tmpStarts[i] += tmpStarts[i-1];
1272 int valueSize = tmpStarts[startSize-1];
1273 int* tmpIndexes =
new int[valueSize];
1285 for (
int i=icoff; i<lastcol; i++)
1286 for (
int j=baseMtx->
start[i-adjc]; j<baseMtx->start[i-adjc+1];
j++)
1288 if (baseMtx->
index[
j] >= base_r0 &&
1289 baseMtx->
index[
j] <= base_rN &&
1292 tmpIndexes[ival] = baseMtx->
index[
j] - base_r0 + iroff;
1310 for (
int i=icoff; i<lastcol; i++)
1311 for (
int j=baseMtx->
start[i-adjc]; j<baseMtx->start[i-adjc+1];
j++)
1313 if (baseMtx->
index[
j] >= base_r0 &&
1316 tmpIndexes[ival] = baseMtx->
index[
j] + base_r0 - iroff;
1333 for (
int i=icoff; i<lastcol; i++)
1334 for (
int j=baseMtx->
start[i-adjc]; j<baseMtx->start[i-adjc+1];
j++)
1336 if (baseMtx->
index[
j] >= base_r0 &&
1363 for (
int i=icoff; i<lastcol; i++)
1364 for (
int j=baseMtx->
start[i-adjc]; j<baseMtx->start[i-adjc+1];
j++)
1366 if (baseMtx->
index[
j] >= base_r0 &&
1370 if (!(tmpValues->
el[ival]
1372 throw ErrorClass(
"failed copying linear element values in method getMatrixCoefficientsInRowMajor()");
1389 for (
int i=icoff; i<lastcol; i++)
1390 for (
int j=baseMtx->
start[i-adjc]; j<baseMtx->start[i-adjc+1];
j++)
1392 if (baseMtx->
index[
j] >= base_r0 &&
1401 ->copyNodeAndDescendants();
1414 for (
int i=icoff; i<lastcol; i++)
1415 for (
int j=baseMtx->
start[i-adjc]; j<baseMtx->start[i-adjc+1];
j++)
1417 if (baseMtx->
index[
j] >= base_r0 &&
1426 ((
OSnLNodeNumber*)tmpValues->el[ival]->m_treeRoot->m_mChildren[0])->value = scaleMult;
1439 throw ErrorClass(
"scalar multiple not defined for objReference elements in getMatrixCoefficientsInRowMajor()");
1443 throw ErrorClass(
"scalar multiple not defined for conReference elements in getMatrixCoefficientsInRowMajor()");
1454 throw ErrorClass(
"error processing blocks in getMatrixCoefficientsInRowMajor()");
1478 for (
int j = c0;
j < cN;
j++)
1500 for (
int i=0; i < currentBlocks->
blockNumber; i++)
1506 for (
int j = c0;
j < cN;
j++)
1510 k < currentBlocks->blocks[i]->start[
j-c0+1];
k++)
1512 tmpIndexes[loc] = currentBlocks->
blocks[i]->
index[
k] + row_adj;
1524 throw ErrorClass(
"getMatrixCoefficientsInRowMajor: Can only handle constant values so far in blocks");
1536 throw ErrorClass(
"transformations not yet implemented in getMatrixCoefficientsInColumnMajor()");
1576 throw ErrorClass(
"Unknown element type in getMatrixCoefficientsInRowMajor()");
1608 for (j = refMtx->
start->
el[i]; j < refMtx->start->el[i + 1]; j++)
1631 for (j = refMtx->
start->
el[i]; j < refMtx->start->el[ i + 1 ]; j++)
1650 for (j = refMtx->
start->
el[i]; j < refMtx->start->el[ i + 1 ]; j++)
1672 for (j = refMtx->
start->
el[i]; j < refMtx->start->el[ i + 1 ]; j++)
1698 for (j = refMtx->
start->
el[i]; j < refMtx->start->el[ i + 1 ]; j++)
1717 for (j = refMtx->
start->
el[i]; j < refMtx->start->el[ i + 1 ]; j++)
1739 for (j = refMtx->
start->
el[i]; j < refMtx->start->el[ i + 1 ]; j++)
1770 throw ErrorClass(
"Multiple constructors not yet implemented in getMatrixCoefficientsInRowMajor()");
1804 std::ostringstream outStr;
1810 outStr <<
"matrix " << ((
OSMatrix*)
this)->idx;
1812 outStr <<
" (" << ((
OSMatrix*)
this)->name <<
")";
1813 outStr << std::endl;
1816 outStr <<
"matrix block" << std::endl;
1818 throw ErrorClass(
"matrix type unknown or not set");
1820 outStr <<
"number of rows " <<
numberOfRows << std::endl;
1822 outStr <<
"number of nonzeros " << tmp->
valueSize << std::endl;
1826 outStr << std::endl <<
"These matrix arrays are organized ";
1828 outStr <<
"by rows" << std::endl;
1830 outStr <<
"by columns" << std::endl;
1832 outStr << std::endl <<
"starts:";
1834 outStr <<
" " << tmp->
start[i];
1835 outStr << std::endl;
1837 outStr << std::endl <<
"indexes:";
1839 outStr <<
" " << tmp->
index[i];
1840 outStr << std::endl;
1842 outStr << std::endl <<
"values:";
1847 outStr << std::endl;
1853 outStr << std::endl;
1859 outStr << std::endl;
1865 outStr << std::endl;
1869 outStr << std::endl;
1871 outStr <<
"element " << i <<
": (general expression; not yet implemented)" << std::endl;
1872 outStr << std::endl;
1876 outStr << std::endl;
1879 outStr <<
"element " << i <<
": ";
1891 for (
int j=0;
j<
m;
j++)
1896 if (temp->
coef != 1)
1897 outStr << temp->
coef <<
"*";
1898 outStr <<
"x[" << temp->
idx <<
"]";
1900 outStr << std::endl;
1902 outStr << std::endl;
1932 if (refMtx == NULL )
return NULL;
1933 if (refMtx->
start == NULL || refMtx->
startSize <= 1 )
return NULL;
1942 int* miStart = matrix->
start;
1943 int* miIndex = matrix->
index;
1945 for ( i = 1; i < iStartSize; i++)
1951 for (i = 0; i < iNumSource; i++)
1953 for (j = refMtx->
start[i]; j < refMtx->start[ i + 1 ]; j++)
1958 miStart[refMtx->
index[
j] + 1] ++;
1965 for (i = 1; i < iStartSize; i++ )
1967 miStart[i] += miStart [i - 1] ;
1979 for (i = 0; i < iNumSource; i++)
1982 for (j = refMtx->
start[i]; j < refMtx->start[ i + 1 ]; j++)
1984 iTemp = miStart[refMtx->
index[
j]];
1985 miIndex [ iTemp] = i;
1988 miStart[refMtx->
index[
j]] ++;
1997 for (i = 0; i < iNumSource; i++)
2000 for (j = refMtx->
start[i]; j < refMtx->start[ i + 1 ]; j++)
2002 iTemp = miStart[refMtx->
index[
j]];
2003 miIndex [ iTemp] = i;
2006 miStart[refMtx->
index[
j]] ++;
2017 for (i = 0; i < iNumSource; i++)
2020 for (j = refMtx->
start[i]; j < refMtx->start[ i + 1 ]; j++)
2022 iTemp = miStart[refMtx->
index[
j]];
2023 miIndex [ iTemp] = i;
2026 miStart[refMtx->
index[
j]] ++;
2038 for (i = 0; i < iNumSource; i++)
2041 for (j = refMtx->
start[i]; j < refMtx->start[ i + 1 ]; j++)
2043 iTemp = miStart[refMtx->
index[
j]];
2044 miIndex [ iTemp] = i;
2047 miStart[refMtx->
index[
j]] ++;
2056 for (i = 0; i < iNumSource; i++)
2059 for (j = refMtx->
start[i]; j < refMtx->start[ i + 1 ]; j++)
2061 iTemp = miStart[refMtx->
index[
j]];
2062 miIndex [ iTemp] = i;
2065 miStart[refMtx->
index[
j]] ++;
2077 for (i = 0; i < iNumSource; i++)
2080 for (j = refMtx->
start[i]; j < refMtx->start[ i + 1 ]; j++)
2082 iTemp = miStart[refMtx->
index[
j]];
2083 miIndex [ iTemp] = i;
2086 miStart[refMtx->
index[
j]] ++;
2092 for (i = iStartSize - 1; i >= 1; i-- )
2094 miStart[i] = miStart [i - 1] ;
2106 if (!OK)
throw ErrorClass(
"Error processing blocks");
2116 if (!OK)
throw ErrorClass(
"Error processing blocks");
2126 if (!OK)
throw ErrorClass(
"Error processing blocks");
2136 if (!OK)
throw ErrorClass(
"Error processing blocks");
2149 int nPartitions = 0;
2157 if (nPartitions == 0)
2230 if (nPartitions > 1)
2232 int* tempPartition =
new int[imerge_R];
2233 for (
int i=0; i < imerge_R; i++)
2238 tempPartition =
new int[imerge_C];
2239 for (
int i=0; i < imerge_C; i++)
2270 int* colPartition,
int colPartitionSize,
2271 bool rowMajor,
bool appendToBlockArray)
2285 for (
int i=0; i < rowPartitionSize; i++)
2288 for (
int i=0; i < colPartitionSize; i++)
2296 if (!appendToBlockArray)
return NULL;
2299 colPartition, colPartitionSize,
false,
symmetry))
2310 return processBlocks(rPartition, rSize, cPartition, cSize, rowMajor, symmetry);
2332 for (
int j=0;
j < rowOffsetSize;
j++)
2336 for (
int j=0; j < colOffsetSize; j++)
2344 tmpBlocks->
vType = elType;
2353 int tmpBlockNumber = 0;
2375 tmpBlocks->
blockRows =
new int[tmpBlockNumber];
2380 for (
int j=0; j<((
MatrixBlocks*)m_mChildren[0])->inumberOfChildren; j++)
2416 tmpBlocks->
vType = elType;
2423 tmpBlocks->
blocks = NULL;
2436 colOffsetSize, rowMajor, symmetry));
2444 int refinement = -1;
2445 int coarsening = -1;
2446 bool refinementCandidate;
2447 bool coarseningCandidate;
2452 refinementCandidate =
true;
2470 refinementCandidate =
false;
2478 if (refinementCandidate)
2497 refinementCandidate =
false;
2506 if (refinementCandidate)
2512 coarseningCandidate =
false;
2531 coarseningCandidate =
true;
2557 coarseningCandidate =
true;
2565 if (coarseningCandidate)
2571 if (refinement >= 0)
2573 throw ErrorClass (
"Not yet implemented: obtaining one block partition from a different one");
2577 if (coarsening >= 0)
2579 throw ErrorClass (
"Not yet implemented: obtaining one block partition from a different one");
2584 throw ErrorClass (
"Not yet implemented: obtaining one block partition from a different one");
2596 int* colPartition,
int colPartitionSize,
2613 int currBlockRow, currBlockCol, lastBlock, currRow;
2614 int blockCount, firstBlockInCol, blockTotal;
2615 std::vector<GeneralSparseMatrix*> tmpBlocks;
2617 int* tmpBlockColumns;
2626 firstBlockInCol = -1;
2632 elCount =
new int[rowPartitionSize-1];
2634 for (i=0; i < colPartitionSize-1; i++)
2637 for (j=0; j<rowPartitionSize-1; j++)
2640 if (lastBlock >= rowPartitionSize)
2641 lastBlock = rowPartitionSize - 1;
2643 for (j=colPartition[i]; j<colPartition[i+1]; j++)
2646 k < ExpandedMatrixInColumnMajorForm->start[j+1];
2650 if (currRow < rowPartition[lastBlock] || currRow >= rowPartition[lastBlock+1])
2653 int n = lastBlock + 1;
2654 while (!found && n < rowPartitionSize - 1)
2657 if (currRow >= rowPartition[n+1])
2668 while (!found && n >= 0)
2671 if (currRow < rowPartition[n])
2681 throw ErrorClass(
"Invalid row information detected in disassembleMatrix()");
2683 elCount[lastBlock]++;
2684 if (elCount[lastBlock] == 1)
2689 if (firstBlockInCol < 0)
2690 firstBlockInCol = blockCount - 1;
2696 tmpBlock->
vType = vType;
2697 tmpBlock->
startSize = colPartition[i+1] - colPartition[i] + 1;
2700 for (
int n=0; n <= j - colPartition[i]; n++)
2701 tmpBlock->
start[n] = 0;
2703 tmpBlocks.push_back(tmpBlock);
2704 if (firstBlockInCol < 0)
2705 firstBlockInCol = blockCount - 1;
2711 for (k=firstBlockInCol; k < blockCount; k++)
2712 tmpBlocks[k]->start[j-colPartition[i] + 1] = elCount[k];
2717 for (k=firstBlockInCol; k < blockCount; k++)
2719 tmpBlocks[
k]->valueSize = elCount[
k];
2720 tmpBlocks[
k]->index =
new int[elCount[
k]];
2723 tmpBlockRows =
new int[blockCount];
2724 tmpBlockColumns =
new int[blockCount];
2725 for (j=0; j<blockCount; j++)
2727 tmpBlockRows[
j] = -1;
2733 for (j=colPartition[i]; j<colPartition[i+1]; j++)
2736 k < ExpandedMatrixInColumnMajorForm->start[j+1];
2740 if (currRow < rowPartition[lastBlock] || currRow >= rowPartition[lastBlock+1])
2746 for (n=lastBlock+1; n < rowPartitionSize - 1; n++)
2747 if (currRow >= rowPartition[lastBlock] &&
2748 currRow < rowPartition[lastBlock+1])
2757 for (n=lastBlock-1; k >= 0; k--)
2758 if (currRow >= rowPartition[lastBlock] &&
2759 currRow < rowPartition[lastBlock+1])
2767 if (tmpBlockRows[lastBlock] == -1)
2769 tmpBlockRows[lastBlock] =
j;
2770 tmpBlockColumns[lastBlock] = i;
2775 tmpBlocks[lastBlock]->index[k-k0]
2783 throw ErrorClass(
"Row major not yet implemented in MatrixType::disassembleMatrix()");
2787 returnArray->
vType = vType;
2796 for (
int i=0; i<tmpBlocks.size();i++);
2798 returnArray->
blocks[i] = tmpBlocks[i];
2799 returnArray->
blockRows[i] = tmpBlockRows[i];
2813 bool mustCopy =
false;
2821 for (
int i=0; i <
n; i++)
2851 ostringstream outStr;
2860 outStr <<
"deleting MatrixElements->start at " << &
start << std::endl;
2872 outStr <<
"deleting MatrixElements->index at " << &
index << std::endl;
2910 "First object is NULL, second is not");
2921 "Second object is NULL, first is not");
2989 std::vector<MatrixNode*> stackVec;
2990 int kount = mtxConstructorVec.size() - 1;
2996 for(
int i = 0; i < numkids; i++)
2998 mtxConstructorVec[kount]->m_mChildren[i] = stackVec.back();
2999 stackVec.pop_back();
3002 stackVec.push_back( mtxConstructorVec[kount]);
3006 return (
OSMatrix*)mtxConstructorVec[ 0];
3078 bool haveRowForm = (baseMtx->ExpandedMatrixInRowMajorForm != NULL);
3079 bool haveColumnForm = (baseMtx->ExpandedMatrixInColumnMajorForm != NULL);
3082 if (targetMatrixFirstRow == 0 && targetMatrixFirstCol == 0 &&
3083 baseMatrixStartRow == 0 && baseMatrixStartCol == 0 &&
3086 scalarMultiplier == 1)
3131 for (
int j=0;
j < currentBlocks->numberOfBlocks;
j++)
3179 bool mustSynchronize;
3197 m_bBlockPartitionProcessed =
true;
3204 mustSynchronize =
false;
3213 mustSynchronize =
true;
3233 if (haveBlocks ==
false)
3237 mustSynchronize =
true;
3263 temp =
new int[tempSize];
3264 for (
int l=0; l < nsync; l++)
3290 for (
int l=0; l<nsync; l++)
3294 if (nsync == 2)
break;
3298 if (haveBlocks ==
false)
3309 mustSynchronize =
false;
3318 mustSynchronize =
true;
3334 if (haveBlocks ==
false)
3338 mustSynchronize =
true;
3364 temp =
new int[tempSize];
3365 for (
int l=0; l < nsync; l++)
3391 for (
int l=0; l<nsync; l++)
3395 if (nsync == 2)
break;
3399 if (haveBlocks ==
false)
3413 bool accumulator =
true;
3429 int haveBaseBlocks =
false;
3434 if (inumberOfChildren == 0)
3443 haveBaseBlocks =
true;
3445 if (!isDiagonal)
return false;
3471 if (iconst == 1 && !haveBaseBlocks)
return false;
3479 for (
int j=1;
j < colPartitionSize;
j++)
3480 for (
int k = colPartition[
j-1];
k < colPartition[
j];
j++)
3485 < rowPartition[
j-1] ||
3487 >= rowPartition[
j] )
3492 for (
int j=1;
j < rowPartitionSize;
j++)
3493 for (
int k = rowPartition[
j-1];
k < rowPartition[
j];
j++)
3498 < colPartition[
j-1] ||
3500 >= colPartition[
j] )
3510 for (
int j=1;
j < colPartitionSize;
j++)
3511 for (
int k = colPartition[
j-1];
k < colPartition[
j];
j++)
3516 < rowPartition[
j-1] ||
3518 >= rowPartition[
j] )
3523 for (
int j=1;
j < rowPartitionSize;
j++)
3524 for (
int k = rowPartition[
j-1];
k < rowPartition[
j];
j++)
3529 < colPartition[
j-1] ||
3531 >= colPartition[
j] )
3541 for (
int j=1;
j < colPartitionSize;
j++)
3542 for (
int k = colPartition[
j-1];
k < colPartition[
j];
j++)
3547 < rowPartition[
j-1] ||
3549 >= rowPartition[
j] )
3554 for (
int j=1;
j < rowPartitionSize;
j++)
3555 for (
int k = rowPartition[
j-1];
k < rowPartition[
j];
j++)
3560 < colPartition[
j-1] ||
3562 >= colPartition[
j] )
3572 for (
int j=1;
j < colPartitionSize;
j++)
3573 for (
int k = colPartition[
j-1];
k < colPartition[
j];
j++)
3578 < rowPartition[
j-1] ||
3580 >= rowPartition[
j] )
3585 for (
int j=1;
j < rowPartitionSize;
j++)
3586 for (
int k = rowPartition[
j-1];
k < rowPartition[
j];
j++)
3591 < colPartition[
j-1] ||
3593 >= colPartition[
j] )
3603 for (
int j=1;
j < colPartitionSize;
j++)
3604 for (
int k = colPartition[
j-1];
k < colPartition[
j];
j++)
3609 < rowPartition[
j-1] ||
3611 >= rowPartition[
j] )
3616 for (
int j=1;
j < rowPartitionSize;
j++)
3617 for (
int k = rowPartition[
j-1];
k < rowPartition[
j];
j++)
3622 < colPartition[
j-1] ||
3624 >= colPartition[
j] )
3634 for (
int j=1;
j < colPartitionSize;
j++)
3635 for (
int k = colPartition[
j-1];
k < colPartition[
j];
j++)
3640 < rowPartition[
j-1] ||
3642 >= rowPartition[
j] )
3647 for (
int j=1;
j < rowPartitionSize;
j++)
3648 for (
int k = rowPartition[
j-1];
k < rowPartition[
j];
j++)
3653 < colPartition[
j-1] ||
3655 >= colPartition[
j] )
3670 unsigned int inumberOfChildren,
MatrixNode **m_mChildren)
3685 ostringstream outStr;
3686 outStr <<
"<matrix";
3692 outStr <<
" name=\"" <<
name <<
"\"";
3696 if (inumberOfChildren > 0)
3698 outStr <<
">" << std::endl;
3701 outStr <<
"</matrix>" << std::endl;
3704 outStr <<
"/>" << std::endl;
3705 return outStr.str();
3728 "First object is NULL, second is not");
3739 "Second object is NULL, first is not");
3745 if (this->
idx != this->
idx)
return false;
3746 if (this->
name != this->
name)
return false;
3776 ostringstream outStr;
3777 outStr <<
"<matrixVar";
3784 outStr <<
" name=\"" <<
name <<
"\"";
3788 if (inumberOfChildren > 0)
3790 outStr <<
">" << std::endl;
3793 outStr <<
"</matrixVar>" << std::endl;
3796 outStr <<
"/>" << std::endl;
3797 return outStr.str();
3827 ostringstream outStr;
3828 outStr <<
"<matrixObj";
3835 outStr <<
" name=\"" <<
name <<
"\"";
3839 if (inumberOfChildren > 0)
3841 outStr <<
">" << std::endl;
3844 outStr <<
"</matrixObj>" << std::endl;
3847 outStr <<
"/>" << std::endl;
3848 return outStr.str();
3877 ostringstream outStr;
3878 outStr <<
"<matrixCon";
3885 outStr <<
" name=\"" <<
name <<
"\"";
3889 if (inumberOfChildren > 0)
3891 outStr <<
">" << std::endl;
3894 outStr <<
"</matrixCon>" << std::endl;
3897 outStr <<
"/>" << std::endl;
3898 return outStr.str();
3912 targetMatrixFirstRow(0),
3913 targetMatrixFirstCol(0),
3914 baseMatrixStartRow(0),
3915 baseMatrixStartCol(0),
3916 baseMatrixEndRow(-1),
3917 baseMatrixEndCol(-1),
3918 baseTranspose(false),
3919 scalarMultiplier(1.0)
3941 return "baseMatrix";
3951 ostringstream outStr;
3952 outStr <<
"<baseMatrix";
3963 outStr <<
" baseTranspose=\"true\"";
3970 outStr <<
"/>" << std::endl;
3971 return outStr.str();
3976 return ((
OSMatrix*)
baseMatrix)->alignsOnBlockBoundary(firstRow, firstColumn, nRows, nCols);
3999 "First object is NULL, second is not");
4010 "Second object is NULL, first is not");
4036 transformation(NULL)
4061 return "transformation";
4073 ostringstream outStr;
4074 outStr <<
"<transformation";
4077 outStr <<
">" << std::endl;
4081 outStr <<
"</transformation>" << std::endl;
4082 return outStr.str();
4110 "First object is NULL, second is not");
4121 "Second object is NULL, first is not");
4150 "Inside the ConstantMatrixElements Destructor");
4152 ostringstream outStr;
4155 outStr <<
"deleting ConstantMatrixElements->value at " << &
value << std::endl;
4171 return "constantElements";
4183 ostringstream outStr;
4184 outStr <<
"<constantElements";
4186 outStr <<
" rowMajor=\"true\"";
4188 outStr <<
">" << std::endl;
4190 outStr <<
"<start>" << std::endl;
4192 outStr <<
"</start>" << std::endl;
4194 if (numberOfValues > 0)
4196 outStr <<
"<index>" << std::endl;
4198 outStr <<
"</index>" << std::endl;
4200 outStr <<
"<value>" << std::endl;
4208 outStr <<
"<el mult=\"" << mult <<
"\">";
4210 outStr <<
"</el>" << std::endl;
4213 outStr <<
"</value>" << std::endl;
4216 outStr <<
"</constantElements>" << std::endl;
4217 return outStr.str();
4245 "First object is NULL, second is not");
4256 "Second object is NULL, first is not");
4262 if (this->rowMajor != that->
rowMajor)
return false;
4298 ostringstream outStr;
4301 outStr <<
"deleting ConstantMatrixValues->el at " << &
el << std::endl;
4323 "First object is NULL, second is not");
4334 "Second object is NULL, first is not");
4342 if (this->
el[i] != that->
el[i])
return false;
4362 this->
el[i] = that->
el[i];
4381 "Inside the VarReferenceMatrixElements Destructor");
4383 ostringstream outStr;
4386 outStr <<
"deleting VarReferenceMatrixElements->value at " << &
value << std::endl;
4402 return "varReferenceElements";
4415 ostringstream outStr;
4416 outStr <<
"<varReferenceElements";
4418 outStr <<
" rowMajor=\"true\"";
4420 outStr <<
">" << std::endl;
4422 outStr <<
"<start>" << std::endl;
4424 outStr <<
"</start>" << std::endl;
4426 if (numberOfValues > 0)
4428 outStr <<
"<index>" << std::endl;
4430 outStr <<
"</index>" << std::endl;
4432 outStr <<
"<value>" << std::endl;
4440 outStr <<
"<el mult=\"" << mult <<
"\">";
4442 outStr <<
"<el mult=\"" << mult <<
"\" incr=\"" << incr <<
"\">";
4444 outStr <<
"</el>" << std::endl;
4447 outStr <<
"</value>" << std::endl;
4450 outStr <<
"</varReferenceElements>" << std::endl;
4451 return outStr.str();
4479 "First object is NULL, second is not");
4490 "Second object is NULL, first is not");
4496 if (this->rowMajor != that->
rowMajor)
return false;
4532 "Inside the VarReferenceMatrixValues Destructor");
4533 ostringstream outStr;
4536 outStr <<
"deleting VarReferenceMatrixValues->el at " << &
el << std::endl;
4558 "First object is NULL, second is not");
4569 "Second object is NULL, first is not");
4577 if (this->
el[i] != that->
el[i])
return false;
4597 this->
el[i] = that->
el[i];
4614 std::ostringstream outStr;
4617 "Inside the LinearMatrixElements Destructor");
4621 outStr <<
"deleting LinearMatrixElements->value at " << &
value << std::endl;
4637 return "linearElements";
4649 ostringstream outStr;
4650 outStr <<
"<linearElements";
4652 outStr <<
" rowMajor=\"true\"";
4654 outStr <<
">" << std::endl;
4656 outStr <<
"<start>" << std::endl;
4658 outStr <<
"</start>" << std::endl;
4660 if (numberOfValues > 0)
4662 outStr <<
"<index>" << std::endl;
4664 outStr <<
"</index>" << std::endl;
4666 outStr <<
"<value>" << std::endl;
4675 outStr <<
">" << std::endl;
4679 outStr <<
"<varIdx";
4684 outStr <<
"</varIdx>" << std::endl;
4687 outStr <<
"</el>" << std::endl;
4689 outStr <<
"</value>" << std::endl;
4691 outStr <<
"</linearElements>" << std::endl;
4692 return outStr.str();
4720 "First object is NULL, second is not");
4731 "Second object is NULL, first is not");
4737 if (this->rowMajor != that->
rowMajor)
return false;
4766 "Inside the LinearMatrixValues Constructor");
4773 std::ostringstream outStr;
4776 "Inside the LinearMatrixValues Destructor");
4780 outStr <<
"deleting LinearMatrixValues->el at " << &
el << std::endl;
4794 outStr <<
"deleting LinearMatrixValues->el [" << i <<
"] at " << &
el[i] << std::endl;
4820 "First object is NULL, second is not");
4831 "Second object is NULL, first is not");
4840 if (!this->
el[i]->
IsEqual(that->
el[i]))
return false;
4882 std::ostringstream outStr;
4898 outStr <<
"DESTROYING VARIDX " << i <<
" at " << &
varIdx[i] << std::endl;
4923 "First object is NULL, second is not");
4934 "Second object is NULL, first is not");
5007 "First object is NULL, second is not");
5018 "Second object is NULL, first is not");
5024 if (this->
idx != that->
idx)
return false;
5025 if (this->
coef != that->
coef)
return false;
5060 ostringstream outStr;
5063 outStr <<
"deleting GeneralMatrixElements->value at " << &
value << std::endl;
5079 return "generalElements";
5091 ostringstream outStr;
5092 outStr <<
"<generalElements";
5094 outStr <<
" rowMajor=\"true\"";
5096 outStr <<
">" << std::endl;
5098 outStr <<
"<start>" << std::endl;
5100 outStr <<
"</start>" << std::endl;
5102 if (numberOfValues > 0)
5104 outStr <<
"<index>" << std::endl;
5106 outStr <<
"</index>" << std::endl;
5108 outStr <<
"<value>" << std::endl;
5114 outStr <<
"</el>" << std::endl;
5116 outStr <<
"</value>" << std::endl;
5118 outStr <<
"</generalElements>" << std::endl;
5119 return outStr.str();
5147 "First object is NULL, second is not");
5158 "Second object is NULL, first is not");
5164 if (this->rowMajor != that->
rowMajor)
return false;
5198 std::ostringstream outStr;
5205 outStr <<
"NUMBER OF VALUES = " <<
numberOfEl << endl;
5217 outStr <<
"deleting ConstantMatrixValues->el [" << i <<
"] at " << &
el[i] << std::endl;
5245 "First object is NULL, second is not");
5256 "Second object is NULL, first is not");
5265 if (!this->
el[i]->
IsEqual(that->
el[i]))
return false;
5303 ostringstream outStr;
5306 outStr <<
"deleting ObjReferenceMatrixElements->value at " << &
value << std::endl;
5322 return "objRefElements";
5334 ostringstream outStr;
5335 outStr <<
"<objReferenceElements";
5337 outStr <<
" rowMajor=\"true\"";
5339 outStr <<
">" << std::endl;
5341 outStr <<
"<start>" << std::endl;
5343 outStr <<
"</start>" << std::endl;
5346 if (numberOfValues > 0)
5348 outStr <<
"<index>" << std::endl;
5350 outStr <<
"</index>" << std::endl;
5352 outStr <<
"<value>" << std::endl;
5360 outStr <<
"<el mult=\"" << mult <<
"\">";
5362 outStr <<
"<el mult=\"" << mult <<
"\" incr=\"" << incr <<
"\">";
5364 outStr <<
"</el>" << std::endl;
5367 outStr <<
"</value>" << std::endl;
5370 outStr <<
"</objReferenceElements>" << std::endl;
5371 return outStr.str();
5399 "First object is NULL, second is not");
5410 "Second object is NULL, first is not");
5416 if (this->rowMajor != that->
rowMajor)
return false;
5454 ostringstream outStr;
5457 outStr <<
"deleting ObjReferenceMatrixValues->el at " << &
el << std::endl;
5479 "First object is NULL, second is not");
5490 "Second object is NULL, first is not");
5498 if (this->
el[i] != that->
el[i])
return false;
5518 this->
el[i] = that->
el[i];
5538 ostringstream outStr;
5541 outStr <<
"deleting ConReferenceMatrixElements->value at " << &
value << std::endl;
5557 return "conRefElements";
5569 ostringstream outStr;
5570 outStr <<
"<conReferenceElements";
5572 outStr <<
" rowMajor=\"true\"";
5574 outStr <<
">" << std::endl;
5576 outStr <<
"<start>" << std::endl;
5578 outStr <<
"</start>" << std::endl;
5580 if (numberOfValues > 0)
5582 outStr <<
"<index>" << std::endl;
5584 outStr <<
"</index>" << std::endl;
5586 outStr <<
"<value>" << std::endl;
5593 outStr <<
" valueType=\"";
5598 outStr <<
"</el>" << std::endl;
5600 outStr <<
"</value>" << std::endl;
5603 outStr <<
"</conReferenceElements>" << std::endl;
5604 return outStr.str();
5632 "First object is NULL, second is not");
5643 "Second object is NULL, first is not");
5649 if (this->rowMajor != that->
rowMajor)
return false;
5694 ostringstream outStr;
5697 outStr <<
"deleting ConstantMatrixValues->el [" << i <<
"] at " << &
el[i] << std::endl;
5724 "First object is NULL, second is not");
5735 "Second object is NULL, first is not");
5743 if (!this->
el[i]->
IsEqual(that->
el[i]))
return false;
5798 "First object is NULL, second is not");
5809 "Second object is NULL, first is not");
5863 return "mixedRowRefElements";
5878 ostringstream outStr;
5883 for (j=
start->
el[i]; j<start->el[i+1]; j++)
5891 outStr <<
"<objReferenceElements";
5893 outStr <<
" rowMajor=\"true\"";
5894 outStr <<
" numberOfValues=\"" << tmpNum <<
"\"";
5895 outStr <<
">" << std::endl;
5899 outStr <<
"<start>" << std::endl;
5900 outStr <<
"<el>0</el>" << std::endl;
5904 for (j=
start->
el[i]; j<start->el[i+1]; j++)
5908 outStr <<
"<el>" << tmpNum <<
"</el>" << std::endl;
5910 outStr <<
"</start>" << std::endl;
5912 outStr <<
"<index>" << std::endl;
5915 for (j=
start->
el[i]; j<start->el[i+1]; j++)
5918 outStr <<
"<el>" <<
index->
el[
j] <<
"</el>";
5921 outStr <<
"</index>" << std::endl;
5923 outStr <<
"<value>" << std::endl;
5926 for (j=
start->
el[i]; j<start->el[i+1]; j++)
5932 outStr <<
"</value>" << std::endl;
5933 outStr <<
"</objReferenceElements>" << std::endl;
5935 outStr <<
"<conReferenceElements";
5937 outStr <<
" rowMajor=\"true\"";
5938 outStr <<
" numberOfValues=\"" <<
numberOfValues - tmpNum <<
"\"";
5939 outStr <<
">" << std::endl;
5941 outStr <<
"<start>" << std::endl;
5942 outStr <<
"<el>0</el>" << std::endl;
5946 for (j=
start->
el[i]; j<start->el[i+1]; j++)
5950 outStr <<
"<el>" << tmpNum <<
"</el>" << std::endl;
5952 outStr <<
"</start>" << std::endl;
5954 outStr <<
"<index>" << std::endl;
5957 for (j=
start->
el[i]; j<start->el[i+1]; j++)
5960 outStr <<
"<el>" <<
index->
el[
j] <<
"</el>";
5963 outStr <<
"</index>" << std::endl;
5965 outStr <<
"<value>" << std::endl;
5968 for (j=
start->
el[i]; j<start->el[i+1]; j++)
5975 outStr <<
" valueType=\"";
5982 outStr <<
"</value>" << std::endl;
5983 outStr <<
"</conReferenceElements>" << std::endl;
5988 outStr <<
"<start>" << std::endl;
5990 outStr <<
"</start>" << std::endl;
5994 outStr <<
"<index>" << std::endl;
5996 outStr <<
"</index>" << std::endl;
5998 outStr <<
"<value>" << std::endl;
6006 outStr <<
"</el>" << std::endl;
6008 outStr <<
"</value>" << std::endl;
6010 outStr <<
"</objReferenceElements>" << std::endl;
6015 outStr <<
"<conReferenceElements";
6017 outStr <<
" rowMajor=\"true\"";
6019 outStr <<
">" << std::endl;
6021 outStr <<
"<start>" << std::endl;
6023 outStr <<
"</start>" << std::endl;
6025 if (numberOfValues > 0)
6027 outStr <<
"<index>" << std::endl;
6029 outStr <<
"</index>" << std::endl;
6031 outStr <<
"<value>" << std::endl;
6038 outStr <<
" valueType=\"";
6044 outStr <<
"</el>" << std::endl;
6046 outStr <<
"</value>" << std::endl;
6048 outStr <<
"</conReferenceElements>" << std::endl;
6051 return outStr.str();
6079 "First object is NULL, second is not");
6090 "Second object is NULL, first is not");
6096 if (this->rowMajor != that->
rowMajor)
return false;
6132 std::ostringstream outStr;
6138 outStr <<
"NUMBER OF BLOCKS = " << inumberOfChildren << endl;
6143 outStr <<
"deleting MatrixBlocks->colOffset at " << &
colOffset << std::endl;
6149 outStr <<
"deleting MatrixBlocks->rowOffset at " << &
rowOffset << std::endl;
6162 if(inumberOfChildren > 0 && block != NULL)
6164 for (
int i=0; i < numberOfBlocks; i++)
6166 if (block[i] != NULL)
6171 outStr <<
"deleting MatrixBlocks->block [" << i <<
"] at " << &block[i] << std::endl;
6209 ostringstream outStr;
6210 outStr <<
"<blocks numberOfBlocks=\"" << inumberOfChildren <<
"\">" << std::endl;
6213 outStr <<
"</colOffset>" << std::endl;
6216 outStr <<
"</rowOffset>" << std::endl;
6221 outStr <<
"</blocks>" << std::endl;
6222 return outStr.str();
6227 bool accumulator =
false;
6230 for (
int i=0; i < nrBlocks; i++)
6236 if (!accumulator)
return false;
6237 for (
int i=0; i < ncBlocks; i++)
6266 "First object is NULL, second is not");
6277 "Second object is NULL, first is not");
6337 ostringstream outStr;
6339 outStr <<
" blockRowIdx=\"" <<
blockRowIdx <<
"\"";
6340 outStr <<
" blockColIdx=\"" <<
blockColIdx <<
"\"";
6346 if (inumberOfChildren > 0)
6348 outStr <<
">" << std::endl;
6351 outStr <<
"</block>" << std::endl;
6354 outStr <<
"/>" << std::endl;
6355 return outStr.str();
6394 b_deleteStartArray(true),
6395 b_deleteIndexArray(true),
6396 b_deleteValueArray(true),
6412 b_deleteStartArray(true),
6413 b_deleteIndexArray(true),
6414 b_deleteValueArray(true),
6431 ostringstream outStr;
6443 outStr <<
"deleting GeneralSparseMatrix->start at " << &
start << std::endl;
6458 outStr <<
"deleting GeneralSparseMatrix->index at " << &
index << std::endl;
6473 outStr <<
"deleting GeneralSparseMatrix->value at " << &
value << std::endl;
6487 "Inside GeneralSparseMatrix::isDiagonal()");
6514 bDeleteArrays(true),
6527 bDeleteArrays(true),
6541 std::ostringstream outStr;
6552 outStr <<
"deleting ExpandedMatrixBlocks->blockRows at " << &
blockRows << std::endl;
6564 outStr <<
"deleting ExpandedMatrixBlocks->blockColumns at " << &
blockColumns << std::endl;
6580 outStr <<
"deleting ExpandedMatrixBlocks->blocks[" << i <<
"] at "
6581 << &
blocks[i] << std::endl;
6599 "Inside ExpandedMatrixBlocks::getBlock()");
6612 "Inside ExpandedMatrixBlocks::isBlockDiagonal()");
6674 std::vector<ExprNode*> nlNodeVec;
6678 tmpNum->
value = val;
6679 nlNodeVec.push_back(tmpNum);
6696 std::vector<ExprNode*> nlNodeVec;
6707 throw ErrorClass(
"OSnLNodeObjective not yet implemented");
6708 nlNodeVec.push_back(tmpRef);
6725 std::vector<ExprNode*> nlNodeVec;
6738 nlNodeVec.push_back(tmpVar);
6743 nlNodeVec.push_back(tmpNum);
6746 nlNodeVec.push_back(tmpTimes);
6754 nlNodeVec.push_back(tmpNum);
6757 nlNodeVec.push_back(tmpSum);
6774 throw ErrorClass(
"In convertToGeneralMatrixElement: OSnLNodeConstraint not yet implemented");
6787 throw ErrorClass(
"In convertToConReferenceMatrixElement: OSnLNodeConstraint not yet implemented");
6800 std::vector<ExprNode*> nlNodeVec;
6804 for(i = 0; i < numQPTerms; i++)
6806 instanceData->nonlinearExpressions->nl[ i] =
new Nl();
6807 instanceData->nonlinearExpressions->nl[ i]->idx = rowIndexes[ i];
6811 nlNodeVariablePoint->idx = varOneIndexes[ i];
6813 nlNodeVariablePoint->coef = coefficients[ i];
6814 nlNodeVec.push_back( nlNodeVariablePoint);
6817 nlNodeVariablePoint->idx = varTwoIndexes[ i];
6818 nlNodeVec.push_back( nlNodeVariablePoint);
6821 nlNodeVec.push_back( (
OSnLNode*)nlNodePoint);
6824 instanceData->nonlinearExpressions->nl[ i]->osExpressionTree->m_treeRoot =
6825 ((
OSnLNode*)nlNodeVec[ 0])->createExpressionTreeFromPostfix( nlNodeVec);
virtual ENUM_MATRIX_TYPE getMatrixType()
bool setMatrix(std::string name, int numberOfRows, int numberOfColumns, ENUM_MATRIX_SYMMETRY symmetry, ENUM_MATRIX_TYPE matrixType, unsigned int inumberOfChildren, MatrixNode **m_mChildren)
add values to this matrix.
bool deepCopyFrom(ConReferenceMatrixElement *that)
A function to make a deep copy of an instance of this class.
bool display(int secondaryDim)
This method displays data structure in the matrix format.
ConReferenceMatrixElement * convertToConReferenceMatrixElement(int objref)
ConReferenceMatrixElement()
-------— Methods for class ConReferenceMatrixElement -------—
virtual ENUM_MATRIX_CONSTRUCTOR_TYPE getNodeType()
double scalarMultiplier
to allow the base matrix to be scaled before it is attached to the target matrix
virtual std::string getMatrixNodeInXML()
bool matrixHasBase()
Several tools to parse the constructor list of a matrix.
virtual bool deepCopyFrom(VarReferenceMatrixValues *that)
A function to make a deep copy of an instance of this class.
LinearMatrixElementTerm ** varIdx
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
GeneralMatrixElements()
-------— Methods for class GeneralMatrixElements -------—
a data structure to represent row reference elements in a MatrixType object Each nonzero element is o...
~ObjReferenceMatrixValues()
ExpandedMatrixBlocks * disassembleMatrix(int *rowPartition, int rowPartitionSize, int *colPartition, int colPartitionSize, bool rowMajor, ENUM_MATRIX_SYMMETRY symmetry)
A method to disassemble a MatrixType into individual blocks of specific structure.
virtual bool IsEqual(MatrixNode *that)
A function to check for the equality of two objects.
virtual std::string getNodeName()
int numberOfEl
each type of value is stored as an array named "el".
a sparse matrix data structure for matrices that can hold nonconstant values
virtual ENUM_MATRIX_CONSTRUCTOR_TYPE getNodeType()
virtual ENUM_MATRIX_TYPE getMatrixType()
int * start
start holds an integer array of start elements in the matrix, which points to the start of a column (...
const OSSmartPtr< OSOutput > osoutput
virtual ConstantMatrixElements * cloneMatrixNode()
int getNumberOfElementConstructors()
bool IsEqual(GeneralMatrixValues *that)
A function to check for the equality of two objects.
bool printExpandedMatrix(bool rowMajor)
a utility routine to print the expanded matrix or block.
bool IsEqual(ConReferenceMatrixElements *that)
A function to check for the equality of two objects.
virtual OSnLNode * copyNodeAndDescendants()
make a copy of this node and all its descendants
VarReferenceMatrixElements()
-------— Methods for class VarReferenceMatrixElements -------—
virtual std::string getNodeName()=0
virtual ENUM_MATRIX_TYPE getMatrixType()
bool IsEqual(GeneralMatrixElements *that)
A function to check for the equality of two objects.
virtual ENUM_MATRIX_TYPE getMatrixType()
virtual BaseMatrix * cloneMatrixNode()
The implementation of the virtual functions.
bool bDeleteArrays
bDeleteArrays is true if we delete the arrays in garbage collection set to true by default ...
a data structure to represent the nonzeros in a generalMatrix element
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
a data structure to represent the constant elements in a MatrixType object
virtual ENUM_MATRIX_CONSTRUCTOR_TYPE getNodeType()
ENUM_MATRIX_TYPE vType
vType holds the type of all (nonzero) values in the collection of blocks contained in this set of blo...
virtual ENUM_MATRIX_CONSTRUCTOR_TYPE getNodeType()
~MixedRowReferenceMatrixElements()
bool processBlockPartition()
A method to determine the block structure of a matrixType as defined by the <blocks> element or eleme...
LinearMatrixElement ** el
ENUM_MATRIX_TYPE
An enum to track the many different types of values that a matrix can contain Note that these types a...
virtual ObjReferenceMatrixElements * cloneMatrixNode()
int numberOfValues
numberOfValues records the number of entries in the arrays that make up the instance of nonzeros ...
MatrixNode ** m_mChildren
m_mChildren holds all the children, that is, nodes used in the definition or construction of the curr...
int idx
idx is the index of the variable
std::string errormsg
errormsg is the error that is causing the exception to be thrown
ENUM_MATRIX_CONSTRUCTOR_TYPE
virtual std::string getMatrixNodeInXML()
bool IsEqual(ConstantMatrixValues *that)
A function to check for the equality of two objects.
virtual ENUM_MATRIX_CONSTRUCTOR_TYPE getNodeType()
to represent the nonzeros in a constantMatrix element
ConReferenceMatrixElements()
-------— Methods for class ConReferenceMatrixElements -------—
bool display(int secondaryDim)
This method displays the data contained in the matrix.
int * rowOffset
rowOffset gives the row offsets of the block decomposition It does not have to correspond to the row ...
a data structure to represent an entry in a conReferenceMatrix element, which consists of a constrain...
std::vector< ExpandedMatrixBlocks * > ExpandedMatrixByBlocks
a data structure to represent the linear expressions in a LinearMatrixElement object ...
MatrixNode()
default constructor
ENUM_MATRIX_TYPE vType
vType holds the type of values found in the value array.
virtual OSMatrix * cloneMatrixNode()
The implementation of the virtual functions.
ExpandedMatrixBlocks * getBlocks(int *rowPartition, int rowPartitionSize, int *colPartition, int colPartitionSize, bool rowMajor, bool appendToBlockArray)
A method to extract a block from a larger matrix The result is a sparse matrix object, depending on the matrixType, of constant matrix elements, variable references, linear or nonlinear expressions, or objective and constraint references (possibly mixed).
virtual ~MatrixConstructor()
destructor
bool rowMajor
To indicate whether the matrix elements are stored in row major form or column major form...
std::string writeIntVectorData(IntVector *v, bool addWhiteSpace, bool writeBase64)
Take an IntVector object and write a string that validates against the OSgL schema.
~ConReferenceMatrixElement()
GeneralSparseMatrix * convertToOtherMajor(bool isColumnMajor)
A method to convert a matrix to the other major.
ScalarExpressionTree * convertToGeneralMatrixElement(double val)
OSMatrixWithMatrixConIdx()
-------— Methods for class OSMatrixWithMatrixConIdx -------—
OSMatrix()
-------— Methods for class OSMatrix -------—
ObjReferenceMatrixValues * value
The objective references (indexes of core objectives) of the elements.
~OSMatrixWithMatrixConIdx()
int baseMatrixStartRow
to select the position of the upper left corner of the portion of the base matrix that is to be selec...
ENUM_MATRIX_TYPE type
To track the type of values present in the matrix or block.
int m_iRowPartitionSize
m_iRowPartitionSize gives the size of the m_miRowPartition array, which is one more than the number o...
int blockNumber
blockNumber gives the number of blocks (which is the size of the blockRows and blockColumns arrays)...
bool deepCopyFrom(MixedRowReferenceMatrixElements *that)
A function to make a deep copy of an instance of this class.
a data structure to represent the nonzeroes of a matrix in a blockwise fashion. Each block can be giv...
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
LinearMatrixValues()
-------— Methods for class LinearMatrixValues -------—
a data structure to represent a MatrixBlock object (derived from MatrixType)
an abstract class to help represent the elements in a MatrixType object From this we derive concrete ...
int targetMatrixFirstRow
to pinpoint the position of the upper left corner of the base matrix within the target matrix ...
virtual ENUM_MATRIX_TYPE getMatrixType()
VarReferenceMatrixValues * value
The variable references (indexes of core variables) of the elements.
virtual ~MatrixElements()
virtual ENUM_MATRIX_TYPE getMatrixType()
virtual ENUM_MATRIX_TYPE getMatrixType()
virtual std::string getNodeName()
virtual std::string getMatrixNodeInXML()
a generic class from which we derive matrix constructors (BaseMatrix, MatrixElements, MatrixTransformation and MatrixBlocks) as well as matrix types (OSMatrix and MatrixBlock).
MatrixBlock()
-------— Methods for class MatrixBlock -------—
virtual OSMatrixWithMatrixObjIdx * cloneMatrixNode()
The implementation of the virtual functions.
virtual OSMatrixWithMatrixConIdx * cloneMatrixNode()
The implementation of the virtual functions.
bool IsEqual(LinearMatrixElement *that)
A function to check for the equality of two objects.
bool deepCopyFrom(ConstantMatrixElements *that)
A function to make a deep copy of an instance of this class.
virtual ENUM_MATRIX_CONSTRUCTOR_TYPE getNodeType()
bool IsEqual(ObjReferenceMatrixElements *that)
A function to check for the equality of two objects.
this class extends OSMatrix for use, e.g., in the matrixVar section of OSoL and OSrL ...
std::string returnMatrixSymmetryString(ENUM_MATRIX_SYMMETRY symmetry)
virtual std::string getMatrixNodeInXML()
bool deepCopyFrom(LinearMatrixElementTerm *that)
A function to make a deep copy of an instance of this class.
virtual bool alignsOnBlockBoundary(int firstRow, int firstColumn, int nRows, int nCols)
Check whether a submatrix aligns with the block partition of a matrix or block or other constructor...
virtual ConReferenceMatrixElements * cloneMatrixNode()
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
virtual std::string getNodeName()
bool isBlockDiagonal()
a method to determine whether the collection is blockDiagonal
virtual std::string getMatrixNodeInXML()
virtual bool alignsOnBlockBoundary(int firstRow, int firstColumn, int nRows, int nCols)
Check whether a submatrix aligns with the block partition of a matrix or block or other constructor...
a data structure to represent a MatrixType object (from which we derive OSMatrix and MatrixBlock) ...
ENUM_CONREFERENCE_VALUETYPE valueType
Several different types of values can be derived from a problem constraint.
virtual GeneralMatrixElements * cloneMatrixNode()
int * blockRows
blockRows holds an integer array of the row to which a block belongs.
virtual std::string getMatrixNodeInXML()
virtual bool alignsOnBlockBoundary(int firstRow, int firstColumn, int nRows, int nCols)
Check whether a submatrix aligns with the block partition of a matrix or block or other constructor...
virtual ENUM_MATRIX_CONSTRUCTOR_TYPE getNodeType()
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
bool deepCopyFrom(MatrixBlock *that)
A function to make a deep copy of an instance of this class.
virtual VarReferenceMatrixElements * cloneMatrixNode()
~LinearMatrixElementTerm()
int * blockColumns
blockColumns holds an integer array of the column to which a block belongs.
bool isRowMajor
isRowMajor holds whether the (nonzero) values holding the data are stored by columnrow.
bool m_bHaveColumnPartition
m_bHaveColumnPartition tracks whether the column partition has been determined from the constructor l...
virtual std::string getMatrixNodeInXML()=0
GeneralSparseMatrix * getMatrixCoefficientsInRowMajor()
virtual MatrixBlock * cloneMatrixNode()
The implementation of the virtual functions.
bool deepCopyFrom(LinearMatrixElement *that)
A function to make a deep copy of an instance of this class.
~ConReferenceMatrixValues()
MatrixElements()
-------— Methods for class MatrixElements -------—
bool m_bHaveRowPartition
m_bHaveRowPartition tracks whether the row partition has been determined from the constructor list an...
virtual bool alignsOnBlockBoundary(int firstRow, int firstColumn, int nRows, int nCols)
Check whether a submatrix aligns with the block partition of a matrix or block or other constructor...
ObjReferenceMatrixElements()
-------— Methods for class ObjReferenceMatrixElements -------—
virtual MatrixBlocks * cloneMatrixNode()
The implementation of the virtual functions.
The OSnLNodeNumber Class.
LinearMatrixElements()
-------— Methods for class LinearMatrixElements -------—
Used to hold part of the instance in memory.
int * m_miRowPartition
m_miRowPartition is the partition vector of the matrix rows into blocks
ConstantMatrixValues()
-------— Methods for class ConstantMatrixValues -------—
this class extends OSMatrix for use, e.g., in the matrixCon section of OSoL and OSrL ...
bool deepCopyFrom(ConReferenceMatrixElements *that)
A function to make a deep copy of an instance of this class.
A concrete class that is used to store a specific type of matrix values, references to variable index...
a data structure to represent a term in a linearMatrix element A term has the form c*x_{k}...
virtual bool alignsOnBlockBoundary(int firstRow, int firstColumn, int nRows, int nCols)=0
Check whether a submatrix aligns with the block partition of a matrix or block or other constructor...
int rowOffsetSize
These two parameters give the size of the rowOffset and colOffset arrays, respectively.
MatrixConstructor()
constructor
ConReferenceMatrixValues * value
The constraint references (indexes of core constraints and value types) of the elements.
to represent the nonzeros in an objReferenceMatrix element
bool getRowMajor()
Returns whether the matrix is stored row-wise or column-wise.
a data structure to represent objective reference elements in a MatrixType object Each nonzero elemen...
a data structure to represent a point of departure for constructing a matrix by modifying parts of a ...
virtual ENUM_MATRIX_CONSTRUCTOR_TYPE getNodeType()
~OSMatrixWithMatrixVarIdx()
~ConstantMatrixElements()
bool deepCopyFrom(GeneralMatrixElements *that)
A function to make a deep copy of an instance of this class.
virtual bool deepCopyFrom(LinearMatrixValues *that)
A function to make a deep copy of an instance of this class.
bool IsEqual(OSMatrix *that)
A function to check for the equality of two objects.
bool IsEqual(MatrixBlocks *that)
A function to check for the equality of two objects.
virtual bool alignsOnBlockBoundary(int firstRow, int firstColumn, int nRows, int nCols)
Check whether a submatrix aligns with the block partition of a matrix or block or other constructor...
IntVector * index
The index array of the (nonzero) elements.
OSMatrix * baseMatrix
a pointer to the base matrix
bool IsEqual(LinearMatrixElements *that)
A function to check for the equality of two objects.
int conReference
contains a reference to a row of the problem (objective if negative, constraint otherwise) ...
virtual std::string getNodeName()
virtual ENUM_MATRIX_TYPE getMatrixType()
virtual std::string getNodeName()
ConReferenceMatrixValues()
-------— Methods for class ConReferenceMatrixValues -------—
MixedRowReferenceMatrixElements()
-------— Methods for class MixedRowReferenceMatrixElements -------—
virtual ENUM_MATRIX_TYPE getMatrixType()=0
bool IsEqual(MixedRowReferenceMatrixElements *that)
A function to check for the equality of two objects.
~ObjReferenceMatrixElements()
virtual std::string getMatrixNodeInXML()
IntVector * colOffset
An array listing the leftmost column of each block within the larger matrix It is assumed that the bl...
virtual ~MatrixElementValues()
bool IsEqual(BaseMatrix *that)
A function to check for the equality of two objects.
OSnLNode * createExpressionTreeFromPostfix(std::vector< ExprNode * > nlNodeVec)
Take a vector of ExprNodes (OSnLNodes and OSnLMNodes) in postfix format and create a scalar-valued OS...
a data structure to represent the nonzeros in a conReferenceMatrix element
ConstantMatrixElements()
-------— Methods for class ConstantMatrixElements -------—
virtual std::string getMatrixNodeInXML()
virtual bool alignsOnBlockBoundary(int firstRow, int firstColumn, int nRows, int nCols)
Check whether a submatrix aligns with the block partition of a matrix or block or other constructor...
The OSnLNodeVariable Class.
GeneralSparseMatrix * getMatrixCoefficientsInColumnMajor()
int * index
index holds an integer array of rowIdx (or colIdx) elements in coefMatrix (AMatrix).
virtual std::string getMatrixNodeInXML()
a data structure to represent the nonzero values in a generalMatrix element
virtual ENUM_MATRIX_TYPE getMatrixType()
int * m_miColumnPartition
m_miColumnPartition is the partition vector of the matrix columns into blocks
int getRowPartitionSize()
get the size of the row partition of a matrix
int * el
Each el is a reference to a constraint defined in the <constraints> section of the OSiL file...
bool IsEqual(ConstantMatrixElements *that)
A function to check for the equality of two objects.
virtual bool deepCopyFrom(GeneralMatrixValues *that)
A function to make a deep copy of an instance of this class.
GeneralSparseMatrix()
Default constructor.
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
int baseMatrixEndRow
to select the position of the lower right corner of the portion of the base matrix that is to be sele...
bool IsEqual(MatrixElements *that)
A function to check for the equality of two objects.
virtual ~MatrixNode()
destructor
virtual bool deepCopyFrom(MatrixElementValues *that)
A function to check for the equality of two objects.
virtual bool deepCopyFrom(ObjReferenceMatrixValues *that)
A function to make a deep copy of an instance of this class.
int getMult(int *i, int size)
getMult
double value
value is the value of the number
~GeneralSparseMatrix()
Default destructor.
unsigned int inumberOfChildren
inumberOfChildren is the number of MatrixNode child elements For the matrix types (OSMatrix and Matri...
void getMultIncr(int *i, int *mult, int *incr, int size, int defaultIncr)
getMultIncr
OSMatrixWithMatrixVarIdx()
-------— Methods for class OSMatrixWithMatrixVarIdx -------—
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
LinearMatrixElement()
-------— Methods for class LinearMatrixElement -------—
virtual MixedRowReferenceMatrixElements * cloneMatrixNode()
OSnLNode ** m_mChildren
m_mChildren holds all the operands, that is, nodes that the current node operates on...
VarReferenceMatrixValues()
-------— Methods for class VarReferenceMatrixValues -------—
bool deepCopyFrom(ObjReferenceMatrixElements *that)
A function to make a deep copy of an instance of this class.
virtual bool alignsOnBlockBoundary(int firstRow, int firstColumn, int nRows, int nCols)
Check whether a submatrix aligns with the block partition of a matrix or block or other constructor...
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
~VarReferenceMatrixValues()
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
virtual bool alignsOnBlockBoundary(int firstRow, int firstColumn, int nRows, int nCols)
Check whether a submatrix aligns with the block partition of a matrix or block or other constructor...
OSnLNode * m_treeRoot
m_treeRoot holds the root node (of OSnLNode type) of the expression tree.
bool b_deleteStartArray
b_deleteStartArray is true if we delete the start array in garbage collection — set to true by defaul...
ExpandedMatrixBlocks()
Default constructor.
bool b_deleteValueArray
b_deleteValueArray is true if we delete the value array in garbage collection — set to true by defaul...
virtual std::string getNodeName()
virtual std::string getMatrixNodeInXML()
a data structure to represent row reference elements in a MatrixType object Each nonzero element refe...
The in-memory representation of the <nl> element.
an abstract class to help represent the elements in a MatrixType object From this we derive concrete ...
ScalarExpressionTree ** el
std::string returnExprShapeString(ENUM_NL_EXPR_SHAPE shape)
ENUM_MATRIX_SYMMETRY symmetry
To track the type of symmetry present in the matrix or block.
static Bigint * mult(Bigint *a, Bigint *b)
bool isBlockDiagonal()
A method to check whether a matrix is block-diagonal.
~OSMatrixWithMatrixObjIdx()
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
GeneralSparseMatrix ** blocks
blocks holds the blocks that make up the matrix.
virtual std::string getMatrixNodeInXML()
GeneralSparseMatrix * ExpandedMatrixInRowMajorForm
The matrix can be held in expanded form by rows or by columns and in a number of ways stored by block...
virtual std::string getNodeName()
a data structure to represent variable reference elements in a MatrixType object Each nonzero element...
bool IsEqual(LinearMatrixValues *that)
A function to check for the equality of two objects.
ObjReferenceMatrixValues()
-------— Methods for class ObjReferenceMatrixValues -------—
virtual std::string getNodeName()
LinearMatrixValues * value
The values are expressions of the form a_0 + a_1 x_{i_1} * a_2 x_{i_2} + ...
bool IsEqual(IntVector *that)
A method to compare two invectors.
int getColumnPartitionSize()
get the size of the column partition of a matrix
ENUM_MATRIX_TYPE mergeMatrixType(ENUM_MATRIX_TYPE type1, ENUM_MATRIX_TYPE type2)
A function to merge two matrix types so we can infer the type of a matrix recursively.
OSMatrixWithMatrixObjIdx()
-------— Methods for class OSMatrixWithMatrixObjIdx -------—
virtual std::string getNodeName()
bool IsEqual(OSnLMNode *that)
A function to check for the equality of two objects.
virtual std::string getMatrixNodeInXML()
bool IsEqual(LinearMatrixElementTerm *that)
A function to check for the equality of two objects.
double value
This element contains the value.
bool IsEqual(ObjReferenceMatrixValues *that)
A function to check for the equality of two objects.
std::string returnConReferenceValueTypeString(ENUM_CONREFERENCE_VALUETYPE valueType)
virtual bool expandElements(bool rowMajor)
A method to expand a matrix or block The result is a GeneralSparseMatrix object of constant matrix el...
bool baseTranspose
to allow the base matrix to be transposed before it is attached to the target matrix ...
virtual std::string getNodeName()
std::string os_dtoa_format(double x)
virtual ENUM_MATRIX_TYPE getMatrixType()
virtual bool alignsOnBlockBoundary(int firstRow, int firstColumn, int nRows, int nCols)
A method to check whether a matrix or block is diagonal.
OSMatrix * createConstructorTreeFromPrefix(std::vector< MatrixNode * > mtxConstructorVec)
bool IsEqual(VarReferenceMatrixValues *that)
A function to check for the equality of two objects.
~ConReferenceMatrixElements()
int baseMatrixIdx
the index of the base matrix
int getNumberOfTransformationConstructors()
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
virtual bool deepCopyFrom(ConReferenceMatrixValues *that)
A function to make a deep copy of an instance of this class.
virtual bool expandElements(bool rowMajor)
A method to expand a matrix or block The result is a GeneralSparseMatrix object of constant matrix el...
virtual bool processBlocks(bool rowMajor, ENUM_MATRIX_SYMMETRY symmetry)
A method to process a matrixType into a block structure defined by the <blocks> element or elements...
int * getRowPartition()
get the row partition of the matrix
virtual bool alignsOnBlockBoundary(int firstRow, int firstColumn, int nRows, int nCols)
Check whether a submatrix aligns with the block partition of a matrix or block or other constructor...
bool matrixHasTransformations()
IntVector * rowOffset
An array listing the top row of each block within the larger matrix.
virtual ENUM_MATRIX_CONSTRUCTOR_TYPE getNodeType()
virtual std::string getMatrixNodeInXML()
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
virtual ENUM_MATRIX_TYPE getMatrixType()
bool deepCopyFrom(MatrixType *that)
A function to make a deep copy of an instance of this class.
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
virtual ENUM_MATRIX_CONSTRUCTOR_TYPE getNodeType()
int valueSize
valueSize is the dimension of the index and value arrays
virtual std::string getNonlinearExpressionInXML()
The following method writes an OSnLNode or OSnLMNode in OSiL format.
MatrixElementValues()
-------— Methods for class MatrixElementValues -------—
virtual LinearMatrixElements * cloneMatrixNode()
ENUM_MATRIX_TYPE matrixType
matrixType tracks the type of elements contained in this MatrixNode, which may be useful in solver se...
a data structure to represent the nonzero values in a linearMatrix element
bool deepCopyFrom(LinearMatrixElements *that)
A function to make a deep copy of an instance of this class.
ENUM_MATRIX_CONSTRUCTOR_TYPE nType
nType is a unique integer assigned to each type of matrix node (see OSParameters.h) ...
a sparse matrix data structure for matrices that can hold nonconstant values and have block structure...
bool isRowMajor
isRowMajor holds whether the matrix is stored by row.
virtual OSMatrixWithMatrixVarIdx * cloneMatrixNode()
The implementation of the virtual functions.
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
virtual std::string getMatrixNodeInXML()
bool IsEqual(ConReferenceMatrixElement *that)
A function to check for the equality of two objects.
virtual std::string getNodeName()
LinearMatrixElement * convertToLinearMatrixElement(double val)
Some methods to convert one type of matrix element into another.
~ExpandedMatrixBlocks()
Default destructor.
LinearMatrixElementTerm()
-------— Methods for class LinearMatrixElementTerm -------—
The OSnLNode Class for nonlinear expressions.
ConstantMatrixValues * value
The value array of the (nonzero) constant elements.
bool isDiagonal()
a method to determine whether the matrix is diagonal
this class extends OSMatrix for use, e.g., in the matrixObj section of OSoL and OSrL ...
bool IsEqual(MatrixBlock *that)
A function to check for the equality of two objects.
ConReferenceMatrixValues * value
The row references (indexes of core rows plus value type) of the elements.
ConReferenceMatrixElement ** el
el contains the indices of the matrix constraints along with the valueType.
bool b_deleteIndexArray
b_deleteIndexArray is true if we delete the index array in garbage collection — set to true by defaul...
bool deepCopyFrom(VarReferenceMatrixElements *that)
A function to make a deep copy of an instance of this class.
virtual bool alignsOnBlockBoundary(int firstRow, int firstColumn, int nRows, int nCols)
Check whether a submatrix aligns with the block partition of a matrix or block or other constructor...
virtual ENUM_MATRIX_CONSTRUCTOR_TYPE getNodeType()
int startSize
startSize is the dimension of the starts array
GeneralSparseMatrix * getMatrixBlockInColumnMajorForm(int columnIdx, int rowIdx)
used for throwing exceptions.
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
ENUM_MATRIX_SYMMETRY symmetry
To track the type of symmetry present in the matrix or block.
MatrixElementValues * value
value holds a general array of value elements in the matrix, which could be constants, linear expressions, general nonlinear expressions, variable, constraint or objective references, etc.
virtual bool alignsOnBlockBoundary(int firstRow, int firstColumn, int nRows, int nCols)
Check whether a submatrix aligns with the block partition of a matrix or block or other constructor...
virtual ENUM_MATRIX_CONSTRUCTOR_TYPE getNodeType()
IntVector * start
A vector listing the row or column starts.
a data structure to represent a matrix object (derived from MatrixType)
~VarReferenceMatrixElements()
int getNumberOfBlocksConstructors()
BaseMatrix()
Standard constructor and destructor methods.
GeneralSparseMatrix * extractBlock(int firstrow, int firstcol, int lastrow, int lastcol, bool rowMajor, ENUM_MATRIX_SYMMETRY symmetry)
A method to extract a block from a larger matrix The result is a sparse matrix object, depending on the matrixType, of constant matrix elements, variable references, linear or nonlinear expressions, or objective and constraint references (possibly mixed).
MatrixBlocks()
-------— Methods for class MatrixBlocks -------—
bool deepCopyFrom(ConstantMatrixValues *that)
A function to make a deep copy of an instance of this class.
a data structure to represent an expression in a linearMatrix element A LinearMatrixElement is a (fin...
bool IsEqual(ConReferenceMatrixValues *that)
A function to check for the equality of two objects.
GeneralSparseMatrix * getBlock(int rowIdx, int colIdx)
a method to retrieve a particular block from a collection
bool IsEqual(VarReferenceMatrixElements *that)
A function to check for the equality of two objects.
int m_iColumnPartitionSize
m_iColumnPartitionSize gives the size of the m_miColumnPartition array, which is one more than the nu...
GeneralMatrixValues * value
The values are general nonlinear expressions.
GeneralMatrixValues()
-------— Methods for class GeneralMatrixValues -------—
std::string returnMatrixTypeString(ENUM_MATRIX_TYPE type)
GeneralSparseMatrix * ExpandedMatrixInColumnMajorForm
MatrixType()
-------— Methods for class MatrixType -------—
virtual bool expandElements(bool rowMajor)
A method to process a matrixType into a specific block structure.
int * colOffset
colOffset gives the column offsets of the block decomposition It does not have to correspond to the c...
int * getColumnPartition()
get the column partition of the matrix