|
| 1 | +/* |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | + * or more contributor license agreements. See the NOTICE file |
| 4 | + * distributed with this work for additional information |
| 5 | + * regarding copyright ownership. The ASF licenses this file |
| 6 | + * to you under the Apache License, Version 2.0 (the |
| 7 | + * "License"); you may not use this file except in compliance |
| 8 | + * with the License. You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, |
| 13 | + * software distributed under the License is distributed on an |
| 14 | + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | + * KIND, either express or implied. See the License for the |
| 16 | + * specific language governing permissions and limitations |
| 17 | + * under the License. |
| 18 | + */ |
| 19 | + |
| 20 | +package org.apache.sysds.runtime.compress.colgroup; |
| 21 | + |
| 22 | +import org.apache.sysds.runtime.compress.colgroup.ColGroupUtils.P; |
| 23 | +import org.apache.sysds.runtime.compress.colgroup.indexes.IColIndex; |
| 24 | +import org.apache.sysds.runtime.compress.colgroup.scheme.ICLAScheme; |
| 25 | +import org.apache.sysds.runtime.compress.cost.ComputationCostEstimator; |
| 26 | +import org.apache.sysds.runtime.compress.estim.CompressedSizeInfoColGroup; |
| 27 | +import org.apache.sysds.runtime.data.DenseBlock; |
| 28 | +import org.apache.sysds.runtime.data.SparseBlock; |
| 29 | +import org.apache.sysds.runtime.data.SparseBlockMCSR; |
| 30 | +import org.apache.sysds.runtime.frame.data.columns.Array; |
| 31 | +import org.apache.sysds.runtime.instructions.cp.CM_COV_Object; |
| 32 | +import org.apache.sysds.runtime.matrix.data.MatrixBlock; |
| 33 | +import org.apache.sysds.runtime.matrix.operators.AggregateUnaryOperator; |
| 34 | +import org.apache.sysds.runtime.matrix.operators.BinaryOperator; |
| 35 | +import org.apache.sysds.runtime.matrix.operators.CMOperator; |
| 36 | +import org.apache.sysds.runtime.matrix.operators.ScalarOperator; |
| 37 | +import org.apache.sysds.runtime.matrix.operators.UnaryOperator; |
| 38 | + |
| 39 | +/** |
| 40 | + * Special sideways compressed column group not supposed to be used outside of the compressed transform encode. |
| 41 | + */ |
| 42 | +public class ColGroupUncompressedArray extends AColGroup { |
| 43 | + private static final long serialVersionUID = -825423333043292199L; |
| 44 | + |
| 45 | + public final Array<?> array; |
| 46 | + public final int id; // columnID |
| 47 | + |
| 48 | + public ColGroupUncompressedArray(Array<?> data, int id, IColIndex colIndexes) { |
| 49 | + super(colIndexes); |
| 50 | + this.array = data; |
| 51 | + this.id = id; |
| 52 | + } |
| 53 | + |
| 54 | + @Override |
| 55 | + public int getNumValues() { |
| 56 | + return array.size(); |
| 57 | + } |
| 58 | + |
| 59 | + @Override |
| 60 | + public long estimateInMemorySize() { |
| 61 | + // not accurate estimate, but guaranteed larger. |
| 62 | + return MatrixBlock.estimateSizeInMemory(array.size(), 1, array.size()) + 80; |
| 63 | + } |
| 64 | + |
| 65 | + @Override |
| 66 | + public String toString() { |
| 67 | + return "UncompressedArrayGroup: " + id + " " + _colIndexes; |
| 68 | + } |
| 69 | + |
| 70 | + @Override |
| 71 | + public AColGroup copyAndSet(IColIndex colIndexes) { |
| 72 | + return new ColGroupUncompressedArray(array, id, colIndexes); |
| 73 | + } |
| 74 | + |
| 75 | + @Override |
| 76 | + public void decompressToDenseBlockTransposed(DenseBlock db, int rl, int ru) { |
| 77 | + throw new UnsupportedOperationException("Unimplemented method 'decompressToDenseBlockTransposed'"); |
| 78 | + } |
| 79 | + |
| 80 | + @Override |
| 81 | + public void decompressToSparseBlockTransposed(SparseBlockMCSR sb, int nColOut) { |
| 82 | + throw new UnsupportedOperationException("Unimplemented method 'decompressToSparseBlockTransposed'"); |
| 83 | + } |
| 84 | + |
| 85 | + @Override |
| 86 | + public double getIdx(int r, int colIdx) { |
| 87 | + throw new UnsupportedOperationException("Unimplemented method 'getIdx'"); |
| 88 | + } |
| 89 | + |
| 90 | + @Override |
| 91 | + public CompressionType getCompType() { |
| 92 | + throw new UnsupportedOperationException("Unimplemented method 'getCompType'"); |
| 93 | + } |
| 94 | + |
| 95 | + @Override |
| 96 | + protected ColGroupType getColGroupType() { |
| 97 | + throw new UnsupportedOperationException("Unimplemented method 'getColGroupType'"); |
| 98 | + } |
| 99 | + |
| 100 | + @Override |
| 101 | + public void decompressToDenseBlock(DenseBlock db, int rl, int ru, int offR, int offC) { |
| 102 | + throw new UnsupportedOperationException("Unimplemented method 'decompressToDenseBlock'"); |
| 103 | + } |
| 104 | + |
| 105 | + @Override |
| 106 | + public void decompressToSparseBlock(SparseBlock sb, int rl, int ru, int offR, int offC) { |
| 107 | + throw new UnsupportedOperationException("Unimplemented method 'decompressToSparseBlock'"); |
| 108 | + } |
| 109 | + |
| 110 | + @Override |
| 111 | + public AColGroup rightMultByMatrix(MatrixBlock right, IColIndex allCols, int k) { |
| 112 | + throw new UnsupportedOperationException("Unimplemented method 'rightMultByMatrix'"); |
| 113 | + } |
| 114 | + |
| 115 | + @Override |
| 116 | + public void tsmm(MatrixBlock ret, int nRows) { |
| 117 | + throw new UnsupportedOperationException("Unimplemented method 'tsmm'"); |
| 118 | + } |
| 119 | + |
| 120 | + @Override |
| 121 | + public void leftMultByMatrixNoPreAgg(MatrixBlock matrix, MatrixBlock result, int rl, int ru, int cl, int cu) { |
| 122 | + throw new UnsupportedOperationException("Unimplemented method 'leftMultByMatrixNoPreAgg'"); |
| 123 | + } |
| 124 | + |
| 125 | + @Override |
| 126 | + public void leftMultByAColGroup(AColGroup lhs, MatrixBlock result, int nRows) { |
| 127 | + throw new UnsupportedOperationException("Unimplemented method 'leftMultByAColGroup'"); |
| 128 | + } |
| 129 | + |
| 130 | + @Override |
| 131 | + public void tsmmAColGroup(AColGroup other, MatrixBlock result) { |
| 132 | + throw new UnsupportedOperationException("Unimplemented method 'tsmmAColGroup'"); |
| 133 | + } |
| 134 | + |
| 135 | + @Override |
| 136 | + public AColGroup scalarOperation(ScalarOperator op) { |
| 137 | + throw new UnsupportedOperationException("Unimplemented method 'scalarOperation'"); |
| 138 | + } |
| 139 | + |
| 140 | + @Override |
| 141 | + public AColGroup binaryRowOpLeft(BinaryOperator op, double[] v, boolean isRowSafe) { |
| 142 | + throw new UnsupportedOperationException("Unimplemented method 'binaryRowOpLeft'"); |
| 143 | + } |
| 144 | + |
| 145 | + @Override |
| 146 | + public AColGroup binaryRowOpRight(BinaryOperator op, double[] v, boolean isRowSafe) { |
| 147 | + throw new UnsupportedOperationException("Unimplemented method 'binaryRowOpRight'"); |
| 148 | + } |
| 149 | + |
| 150 | + @Override |
| 151 | + public void unaryAggregateOperations(AggregateUnaryOperator op, double[] c, int nRows, int rl, int ru) { |
| 152 | + throw new UnsupportedOperationException("Unimplemented method 'unaryAggregateOperations'"); |
| 153 | + } |
| 154 | + |
| 155 | + @Override |
| 156 | + protected AColGroup sliceSingleColumn(int idx) { |
| 157 | + throw new UnsupportedOperationException("Unimplemented method 'sliceSingleColumn'"); |
| 158 | + } |
| 159 | + |
| 160 | + @Override |
| 161 | + protected AColGroup sliceMultiColumns(int idStart, int idEnd, IColIndex outputCols) { |
| 162 | + throw new UnsupportedOperationException("Unimplemented method 'sliceMultiColumns'"); |
| 163 | + } |
| 164 | + |
| 165 | + @Override |
| 166 | + public AColGroup sliceRows(int rl, int ru) { |
| 167 | + throw new UnsupportedOperationException("Unimplemented method 'sliceRows'"); |
| 168 | + } |
| 169 | + |
| 170 | + @Override |
| 171 | + public double getMin() { |
| 172 | + throw new UnsupportedOperationException("Unimplemented method 'getMin'"); |
| 173 | + } |
| 174 | + |
| 175 | + @Override |
| 176 | + public double getMax() { |
| 177 | + throw new UnsupportedOperationException("Unimplemented method 'getMax'"); |
| 178 | + } |
| 179 | + |
| 180 | + @Override |
| 181 | + public double getSum(int nRows) { |
| 182 | + throw new UnsupportedOperationException("Unimplemented method 'getSum'"); |
| 183 | + } |
| 184 | + |
| 185 | + @Override |
| 186 | + public boolean containsValue(double pattern) { |
| 187 | + throw new UnsupportedOperationException("Unimplemented method 'containsValue'"); |
| 188 | + } |
| 189 | + |
| 190 | + @Override |
| 191 | + public long getNumberNonZeros(int nRows) { |
| 192 | + throw new UnsupportedOperationException("Unimplemented method 'getNumberNonZeros'"); |
| 193 | + } |
| 194 | + |
| 195 | + @Override |
| 196 | + public AColGroup replace(double pattern, double replace) { |
| 197 | + throw new UnsupportedOperationException("Unimplemented method 'replace'"); |
| 198 | + } |
| 199 | + |
| 200 | + @Override |
| 201 | + public void computeColSums(double[] c, int nRows) { |
| 202 | + throw new UnsupportedOperationException("Unimplemented method 'computeColSums'"); |
| 203 | + } |
| 204 | + |
| 205 | + @Override |
| 206 | + public CM_COV_Object centralMoment(CMOperator op, int nRows) { |
| 207 | + throw new UnsupportedOperationException("Unimplemented method 'centralMoment'"); |
| 208 | + } |
| 209 | + |
| 210 | + @Override |
| 211 | + public AColGroup rexpandCols(int max, boolean ignore, boolean cast, int nRows) { |
| 212 | + throw new UnsupportedOperationException("Unimplemented method 'rexpandCols'"); |
| 213 | + } |
| 214 | + |
| 215 | + @Override |
| 216 | + public double getCost(ComputationCostEstimator e, int nRows) { |
| 217 | + throw new UnsupportedOperationException("Unimplemented method 'getCost'"); |
| 218 | + } |
| 219 | + |
| 220 | + @Override |
| 221 | + public AColGroup unaryOperation(UnaryOperator op) { |
| 222 | + throw new UnsupportedOperationException("Unimplemented method 'unaryOperation'"); |
| 223 | + } |
| 224 | + |
| 225 | + @Override |
| 226 | + public boolean isEmpty() { |
| 227 | + throw new UnsupportedOperationException("Unimplemented method 'isEmpty'"); |
| 228 | + } |
| 229 | + |
| 230 | + @Override |
| 231 | + public AColGroup append(AColGroup g) { |
| 232 | + throw new UnsupportedOperationException("Unimplemented method 'append'"); |
| 233 | + } |
| 234 | + |
| 235 | + @Override |
| 236 | + protected AColGroup appendNInternal(AColGroup[] groups, int blen, int rlen) { |
| 237 | + throw new UnsupportedOperationException("Unimplemented method 'appendNInternal'"); |
| 238 | + } |
| 239 | + |
| 240 | + @Override |
| 241 | + public ICLAScheme getCompressionScheme() { |
| 242 | + throw new UnsupportedOperationException("Unimplemented method 'getCompressionScheme'"); |
| 243 | + } |
| 244 | + |
| 245 | + @Override |
| 246 | + public AColGroup recompress() { |
| 247 | + throw new UnsupportedOperationException("Unimplemented method 'recompress'"); |
| 248 | + } |
| 249 | + |
| 250 | + @Override |
| 251 | + public CompressedSizeInfoColGroup getCompressionInfo(int nRow) { |
| 252 | + throw new UnsupportedOperationException("Unimplemented method 'getCompressionInfo'"); |
| 253 | + } |
| 254 | + |
| 255 | + @Override |
| 256 | + protected AColGroup fixColIndexes(IColIndex newColIndex, int[] reordering) { |
| 257 | + throw new UnsupportedOperationException("Unimplemented method 'fixColIndexes'"); |
| 258 | + } |
| 259 | + |
| 260 | + @Override |
| 261 | + public AColGroup reduceCols() { |
| 262 | + throw new UnsupportedOperationException("Unimplemented method 'reduceCols'"); |
| 263 | + } |
| 264 | + |
| 265 | + @Override |
| 266 | + public double getSparsity() { |
| 267 | + throw new UnsupportedOperationException("Unimplemented method 'getSparsity'"); |
| 268 | + } |
| 269 | + |
| 270 | + @Override |
| 271 | + protected void sparseSelection(MatrixBlock selection, P[] points, MatrixBlock ret, int rl, int ru) { |
| 272 | + throw new UnsupportedOperationException("Unimplemented method 'sparseSelection'"); |
| 273 | + } |
| 274 | + |
| 275 | + @Override |
| 276 | + protected void denseSelection(MatrixBlock selection, P[] points, MatrixBlock ret, int rl, int ru) { |
| 277 | + throw new UnsupportedOperationException("Unimplemented method 'denseSelection'"); |
| 278 | + } |
| 279 | + |
| 280 | + @Override |
| 281 | + public AColGroup[] splitReshape(int multiplier, int nRow, int nColOrg) { |
| 282 | + throw new UnsupportedOperationException("Unimplemented method 'splitReshape'"); |
| 283 | + } |
| 284 | + |
| 285 | +} |
0 commit comments