| 127 | } |
| 128 | |
| 129 | void MinorProcessor::defineSubMatrix(const int numberOfRows, |
| 130 | const int* rowIndices, |
| 131 | const int numberOfColumns, |
| 132 | const int* columnIndices) |
| 133 | { |
| 134 | /* The method assumes ascending row and column indices in the |
| 135 | two argument arrays. These indices are understood to be zero-based. |
| 136 | The method will set the two arrays of ints in _container. |
| 137 | Example: The indices 0, 2, 3, 7 will be converted to an array with |
| 138 | one int representing the binary number 10001101 |
| 139 | (check bits from right to left). */ |
| 140 | |
| 141 | _containerRows = numberOfRows; |
| 142 | int highestRowIndex = rowIndices[numberOfRows - 1]; |
| 143 | int rowBlockCount = (highestRowIndex / 32) + 1; |
| 144 | unsigned *rowBlocks=(unsigned*)omAlloc(rowBlockCount*sizeof(unsigned)); |
| 145 | for (int i = 0; i < rowBlockCount; i++) rowBlocks[i] = 0; |
| 146 | for (int i = 0; i < numberOfRows; i++) |
| 147 | { |
| 148 | int blockIndex = rowIndices[i] / 32; |
| 149 | int offset = rowIndices[i] % 32; |
| 150 | rowBlocks[blockIndex] += (1 << offset); |
| 151 | } |
| 152 | |
| 153 | _containerColumns = numberOfColumns; |
| 154 | int highestColumnIndex = columnIndices[numberOfColumns - 1]; |
| 155 | int columnBlockCount = (highestColumnIndex / 32) + 1; |
| 156 | unsigned *columnBlocks=(unsigned*)omAlloc0(columnBlockCount*sizeof(unsigned)); |
| 157 | for (int i = 0; i < numberOfColumns; i++) |
| 158 | { |
| 159 | int blockIndex = columnIndices[i] / 32; |
| 160 | int offset = columnIndices[i] % 32; |
| 161 | columnBlocks[blockIndex] += (1 << offset); |
| 162 | } |
| 163 | |
| 164 | _container.set(rowBlockCount, rowBlocks, columnBlockCount, columnBlocks); |
| 165 | omFree(columnBlocks); |
| 166 | omFree(rowBlocks); |
| 167 | } |
| 168 | |
| 169 | bool MinorProcessor::setNextKeys(const int k) |
| 170 | { |
no test coverage detected