| 154 | |
| 155 | template <class TDstColumn, typename TDstColumnValueType, class TValue, class TSize, class TQuantizeValueFunction> |
| 156 | static THolder<IFeatureValuesHolder> CreateQuantizedSparseSubset( |
| 157 | ui32 featureId, |
| 158 | const TConstPolymorphicValuesSparseArray<TValue, TSize>& srcData, |
| 159 | const TInvertedIndexedSubset<ui32>& invertedIndexedSubset, |
| 160 | TQuantizeValueFunction&& quantizeValueFunction, |
| 161 | ui32 bitsPerKey |
| 162 | ) { |
| 163 | TConstArrayRef<ui32> invertedIndicesArray = invertedIndexedSubset.GetMapping(); |
| 164 | |
| 165 | TVector<ui32> dstVectorIndexing; |
| 166 | TVector<TDstColumnValueType> dstValues; |
| 167 | |
| 168 | srcData.ForEachNonDefault( |
| 169 | [&](ui32 srcIdx, TValue value) { |
| 170 | auto dstIdx = invertedIndicesArray[srcIdx]; |
| 171 | if (dstIdx != TInvertedIndexedSubset<ui32>::NOT_PRESENT) { |
| 172 | dstVectorIndexing.push_back(dstIdx); |
| 173 | dstValues.push_back(quantizeValueFunction(value)); |
| 174 | } |
| 175 | } |
| 176 | ); |
| 177 | |
| 178 | std::function<TCompressedArray(TVector<TDstColumnValueType>&&)> createNonDefaultValuesContainer |
| 179 | = [&] (TVector<TDstColumnValueType>&& dstValues) { |
| 180 | return TCompressedArray( |
| 181 | dstValues.size(), |
| 182 | bitsPerKey, |
| 183 | CompressVector<ui64>(dstValues, bitsPerKey) |
| 184 | ); |
| 185 | }; |
| 186 | |
| 187 | return MakeHolder<TSparseCompressedValuesHolderImpl<TDstColumn>>( |
| 188 | featureId, |
| 189 | MakeSparseArrayBase<TDstColumnValueType, TCompressedArray, ui32>( |
| 190 | invertedIndexedSubset.GetSize(), |
| 191 | std::move(dstVectorIndexing), |
| 192 | std::move(dstValues), |
| 193 | std::move(createNonDefaultValuesContainer), |
| 194 | /*sparseArrayIndexingType*/ srcData.GetIndexing()->GetType(), |
| 195 | /*ordered*/ false, |
| 196 | quantizeValueFunction(srcData.GetDefaultValue()) |
| 197 | ) |
| 198 | ); |
| 199 | } |
| 200 | ui64 TExternalFloatSparseValuesHolder::EstimateMemoryForCloning( |
| 201 | const TCloningParams& cloningParams |
| 202 | ) const { |
nothing calls this directly
no test coverage detected