Skip to content

Commit

Permalink
Finish Repairing the backend [compiling]
Browse files Browse the repository at this point in the history
  • Loading branch information
nyoungbq committed Sep 17, 2024
1 parent f7af443 commit 4c7762e
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class ComputeArrayStatisticsByIndexImpl
ComputeArrayStatisticsByIndexImpl(bool length, bool min, bool max, bool mean, bool mode, bool stdDeviation, bool summation, bool hist, float64 histmin, float64 histmax, bool histfullrange,
int32 numBins, bool modalBinRanges, const std::unique_ptr<MaskCompare>& mask, const Int32Array* featureIds, const DataArray<T>& source,
BoolArray* featureHasDataArray, UInt64Array* lengthArray, DataArray<T>* minArray, DataArray<T>* maxArray, Float32Array* meanArray, NeighborList<T>* modeArray,
Float32Array* stdDevArray, Float32Array* summationArray, UInt64Array* histArray, UInt64Array* mostPopulatedBinArray, NeighborList<float32>* modalBinRangesArray,
ComputeArrayStatistics* filter)
Float32Array* stdDevArray, Float32Array* summationArray, UInt64Array* histBinCountsArray, DataArray<T>* histBinRangesArray, UInt64Array* mostPopulatedBinArray,
NeighborList<float32>* modalBinRangesArray, ComputeArrayStatistics* filter)
: m_Length(length)
, m_Min(min)
, m_Max(max)
Expand All @@ -70,7 +70,8 @@ class ComputeArrayStatisticsByIndexImpl
, m_ModeArray(modeArray)
, m_StdDevArray(stdDevArray)
, m_SummationArray(summationArray)
, m_HistArray(histArray)
, m_HistBinCountsArray(histBinCountsArray)
, m_HistBinRangesArray(histBinRangesArray)
, m_MostPopulatedBinArray(mostPopulatedBinArray)
, m_ModalBinRangesArray(modalBinRangesArray)
, m_Filter(filter)
Expand Down Expand Up @@ -215,10 +216,16 @@ class ComputeArrayStatisticsByIndexImpl
}
}

AbstractDataStore<uint64>* histDataStorePtr = nullptr;
if(m_HistArray != nullptr)
AbstractDataStore<uint64>* binCountsStorePtr = nullptr;
if(m_HistBinCountsArray != nullptr)
{
histDataStorePtr = m_HistArray->getDataStore();
binCountsStorePtr = m_HistBinCountsArray->getDataStore();
}

AbstractDataStore<T>* binRangesStorePtr = nullptr;
if(m_HistBinRangesArray != nullptr)
{
binRangesStorePtr = m_HistBinRangesArray->getDataStore();
}

AbstractDataStore<uint64>* mostPopulatedBinDataStorePtr = nullptr;
Expand All @@ -227,8 +234,9 @@ class ComputeArrayStatisticsByIndexImpl
mostPopulatedBinDataStorePtr = m_MostPopulatedBinArray->getDataStore();
}

if(m_Histogram && histDataStorePtr != nullptr)
if(m_Histogram && binCountsStorePtr != nullptr && binRangesStorePtr != nullptr)
{
std::vector<T> ranges(m_NumBins + 1);
std::vector<uint64> histogram(m_NumBins, 0);
if(length[localFeatureIndex] > 0)
{
Expand All @@ -241,6 +249,8 @@ class ComputeArrayStatisticsByIndexImpl
histMax = static_cast<float32>(max[localFeatureIndex]);
}

HistogramUtilities::serial::FillBinRanges(ranges, std::make_pair(static_cast<T>(histMin), static_cast<T>(histMax)), m_NumBins);

const float32 increment = (histMax - histMin) / (m_NumBins);
if(std::fabs(increment) < 1E-10)
{
Expand All @@ -263,8 +273,8 @@ class ComputeArrayStatisticsByIndexImpl
continue;
}
const auto value = static_cast<float32>(m_Source[i]);
const auto bin = static_cast<int32>((value - histMin) / increment); // find bin for this input array value
if((bin >= 0) && (bin < m_NumBins)) // make certain bin is in range
const auto bin = static_cast<int32>(HistogramUtilities::serial::CalculateBin(value, histMin, increment)); // find bin for this input array value
if((bin >= 0) && (bin < m_NumBins)) // make certain bin is in range
{
++histogram[bin]; // increment histogram element corresponding to this input array value
}
Expand All @@ -288,7 +298,7 @@ class ComputeArrayStatisticsByIndexImpl
for(int i = 0; i < modeList->size(); i++)
{
const float32 mode = modeList->at(i);
const auto modalBin = static_cast<int32>((mode - histMin) / increment);
const auto modalBin = static_cast<int32>(HistogramUtilities::serial::CalculateBin(mode, histMin, increment));
float32 minBinValue = 0.0f;
float32 maxBinValue = 0.0f;
if((modalBin >= 0) && (modalBin < m_NumBins)) // make certain bin is in range
Expand All @@ -308,7 +318,8 @@ class ComputeArrayStatisticsByIndexImpl
}
} // end of length if

histDataStorePtr->setTuple(j, histogram);
binCountsStorePtr->setTuple(j, histogram);
binRangesStorePtr->setTuple(j, ranges);

auto maxElementIt = std::max_element(histogram.begin(), histogram.end());
uint64 index = std::distance(histogram.begin(), maxElementIt);
Expand Down Expand Up @@ -405,7 +416,8 @@ class ComputeArrayStatisticsByIndexImpl
NeighborList<T>* m_ModeArray = nullptr;
Float32Array* m_StdDevArray = nullptr;
Float32Array* m_SummationArray = nullptr;
UInt64Array* m_HistArray = nullptr;
UInt64Array* m_HistBinCountsArray = nullptr;
DataArray<T>* m_HistBinRangesArray = nullptr;
UInt64Array* m_MostPopulatedBinArray = nullptr;
NeighborList<float32>* m_ModalBinRangesArray = nullptr;
ComputeArrayStatistics* m_Filter = nullptr;
Expand Down Expand Up @@ -625,12 +637,18 @@ void FindStatisticsImpl(const ContainerType& data, std::vector<IArray*>& arrays,

std::atomic_bool neverCancel{false};
std::atomic<usize> overflow{0};
Result<> result = HistogramUtilities::serial::GenerateHistogram(data, binRangesStore, range, neverCancel, inputValues->NumBins, binCountsStore, overflow);
std::vector<uint64> binCounts(inputValues->NumBins, 0);
std::vector<T> binRanges(inputValues->NumBins + 1);

Result<> result = HistogramUtilities::serial::GenerateHistogram(data, binRanges, range, neverCancel, inputValues->NumBins, binCounts, overflow);

Check failure on line 643 in src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/ComputeArrayStatistics.cpp

View workflow job for this annotation

GitHub Actions / build (macos-14)

no matching function for call to 'GenerateHistogram'

Check failure on line 643 in src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/ComputeArrayStatistics.cpp

View workflow job for this annotation

GitHub Actions / build (macos-14)

no matching function for call to 'GenerateHistogram'

Check failure on line 643 in src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/ComputeArrayStatistics.cpp

View workflow job for this annotation

GitHub Actions / build (macos-14)

no matching function for call to 'GenerateHistogram'

Check failure on line 643 in src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/ComputeArrayStatistics.cpp

View workflow job for this annotation

GitHub Actions / build (macos-14)

no matching function for call to 'GenerateHistogram'

Check failure on line 643 in src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/ComputeArrayStatistics.cpp

View workflow job for this annotation

GitHub Actions / build (macos-14)

no matching function for call to 'GenerateHistogram'

Check failure on line 643 in src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/ComputeArrayStatistics.cpp

View workflow job for this annotation

GitHub Actions / build (macos-14)

no matching function for call to 'GenerateHistogram'

Check failure on line 643 in src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/ComputeArrayStatistics.cpp

View workflow job for this annotation

GitHub Actions / build (macos-14)

no matching function for call to 'GenerateHistogram'

Check failure on line 643 in src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/ComputeArrayStatistics.cpp

View workflow job for this annotation

GitHub Actions / build (macos-14)

no matching function for call to 'GenerateHistogram'

Check failure on line 643 in src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/ComputeArrayStatistics.cpp

View workflow job for this annotation

GitHub Actions / build (macos-14)

no matching function for call to 'GenerateHistogram'

Check failure on line 643 in src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/ComputeArrayStatistics.cpp

View workflow job for this annotation

GitHub Actions / build (macos-14)

no matching function for call to 'GenerateHistogram'

binCountsStore.setTuple(0, binCounts);
binRangesStore.setTuple(0, binRanges);

auto maxElementIt = std::max_element(binCountsStore.begin(), binCountsStore.end());
uint64 index = std::distance(binCountsStore.begin(), maxElementIt);
auto maxElementIt = std::max_element(binCounts.begin(), binCounts.end());
uint64 index = std::distance(binCounts.begin(), maxElementIt);
mostPopBinStore.setComponent(0, 0, index);
mostPopBinStore.setComponent(0, 1, binCountsStore[index]);
mostPopBinStore.setComponent(0, 1, binCounts[index]);

if(inputValues->FindModalBinRanges)
{
Expand All @@ -648,7 +666,7 @@ void FindStatisticsImpl(const ContainerType& data, std::vector<IArray*>& arrays,

for(const T& mode : array5Ptr->at(0))
{
std::pair<T, T> modalRange = StatisticsCalculations::findModalBinRange(data, binRangesStore, mode);
std::pair<T, T> modalRange = StatisticsCalculations::findModalBinRange(data, binRanges, mode);
array11Ptr->addEntry(0, modalRange.first);
array11Ptr->addEntry(0, modalRange.second);
}
Expand Down Expand Up @@ -681,10 +699,11 @@ void FindStatistics(const DataArray<T>& source, const Int32Array* featureIds, co
auto* modeArrayPtr = dynamic_cast<NeighborList<T>*>(arrays[5]);
auto* stdDevArrayPtr = dynamic_cast<Float32Array*>(arrays[6]);
auto* summationArrayPtr = dynamic_cast<Float32Array*>(arrays[7]);
auto* histArrayPtr = dynamic_cast<UInt64Array*>(arrays[8]);
auto* histBinCountsArrayPtr = dynamic_cast<UInt64Array*>(arrays[8]);
auto* mostPopulatedBinPtr = dynamic_cast<UInt64Array*>(arrays[10]);
auto* modalBinsArrayPtr = dynamic_cast<NeighborList<float32>*>(arrays[11]);
auto* featureHasDataPtr = dynamic_cast<BoolArray*>(arrays[12]);
auto* histBinRangesArrayPtr = dynamic_cast<DataArray<T>*>(arrays[12]);
auto* featureHasDataPtr = dynamic_cast<BoolArray*>(arrays[13]);

IParallelAlgorithm::AlgorithmArrays indexAlgArrays;
indexAlgArrays.push_back(&source);
Expand All @@ -695,7 +714,8 @@ void FindStatistics(const DataArray<T>& source, const Int32Array* featureIds, co
indexAlgArrays.push_back(meanArrayPtr);
indexAlgArrays.push_back(stdDevArrayPtr);
indexAlgArrays.push_back(summationArrayPtr);
indexAlgArrays.push_back(histArrayPtr);
indexAlgArrays.push_back(histBinCountsArrayPtr);
indexAlgArrays.push_back(histBinRangesArrayPtr);
indexAlgArrays.push_back(mostPopulatedBinPtr);

#ifdef SIMPLNX_ENABLE_MULTICORE
Expand All @@ -708,19 +728,20 @@ void FindStatistics(const DataArray<T>& source, const Int32Array* featureIds, co
ComputeArrayStatisticsByIndexImpl<T>(inputValues->FindLength, inputValues->FindMin, inputValues->FindMax, inputValues->FindMean, inputValues->FindMode,
inputValues->FindStdDeviation, inputValues->FindSummation, inputValues->FindHistogram, inputValues->MinRange, inputValues->MaxRange,
inputValues->UseFullRange, inputValues->NumBins, inputValues->FindModalBinRanges, mask, featureIds, source, featureHasDataPtr,
lengthArrayPtr, minArrayPtr, maxArrayPtr, meanArrayPtr, modeArrayPtr, stdDevArrayPtr, summationArrayPtr, histArrayPtr, mostPopulatedBinPtr,
modalBinsArrayPtr, filter),
lengthArrayPtr, minArrayPtr, maxArrayPtr, meanArrayPtr, modeArrayPtr, stdDevArrayPtr, summationArrayPtr, histBinCountsArrayPtr,
histBinRangesArrayPtr, mostPopulatedBinPtr, modalBinsArrayPtr, filter),
simplePartitioner);
}
else
{
ParallelDataAlgorithm indexAlg;
indexAlg.setRange(0, numFeatures);
indexAlg.requireArraysInMemory(indexAlgArrays);
indexAlg.execute(ComputeArrayStatisticsByIndexImpl<T>(
inputValues->FindLength, inputValues->FindMin, inputValues->FindMax, inputValues->FindMean, inputValues->FindMode, inputValues->FindStdDeviation, inputValues->FindSummation,
inputValues->FindHistogram, inputValues->MinRange, inputValues->MaxRange, inputValues->UseFullRange, inputValues->NumBins, inputValues->FindModalBinRanges, mask, featureIds, source,
featureHasDataPtr, lengthArrayPtr, minArrayPtr, maxArrayPtr, meanArrayPtr, modeArrayPtr, stdDevArrayPtr, summationArrayPtr, histArrayPtr, mostPopulatedBinPtr, modalBinsArrayPtr, filter));
indexAlg.execute(ComputeArrayStatisticsByIndexImpl<T>(inputValues->FindLength, inputValues->FindMin, inputValues->FindMax, inputValues->FindMean, inputValues->FindMode,
inputValues->FindStdDeviation, inputValues->FindSummation, inputValues->FindHistogram, inputValues->MinRange, inputValues->MaxRange,
inputValues->UseFullRange, inputValues->NumBins, inputValues->FindModalBinRanges, mask, featureIds, source, featureHasDataPtr,
lengthArrayPtr, minArrayPtr, maxArrayPtr, meanArrayPtr, modeArrayPtr, stdDevArrayPtr, summationArrayPtr, histBinCountsArrayPtr,
histBinRangesArrayPtr, mostPopulatedBinPtr, modalBinsArrayPtr, filter));
}
#endif

Expand Down Expand Up @@ -1067,8 +1088,8 @@ Result<> ComputeArrayStatistics::operator()()
usize numFeatures = 0;
if(m_InputValues->ComputeByIndex)
{
arrays.resize(13);
arrays[12] = m_DataStructure.getDataAs<IDataArray>(m_InputValues->FeatureHasDataArrayName);
arrays.resize(14);
arrays[13] = m_DataStructure.getDataAs<IDataArray>(m_InputValues->FeatureHasDataArrayName);

const auto& featureIds = m_DataStructure.getDataRefAs<Int32Array>(m_InputValues->FeatureIdsArrayPath);
numFeatures = findNumFeatures(featureIds);
Expand Down
27 changes: 15 additions & 12 deletions src/simplnx/Utilities/HistogramUtilities.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
#include "simplnx/Common/Result.hpp"
#include "simplnx/DataStructure/IDataArray.hpp"

namespace nx::core::HistogramUtilities
namespace nx::core
{
namespace serial
namespace SIMPLNX_EXPORT HistogramUtilities

Check failure on line 10 in src/simplnx/Utilities/HistogramUtilities.hpp

View workflow job for this annotation

GitHub Actions / build (ubuntu-22.04, clang++-14)

expected identifier or '{'

Check failure on line 10 in src/simplnx/Utilities/HistogramUtilities.hpp

View workflow job for this annotation

GitHub Actions / build (ubuntu-22.04, clang++-14)

C++ requires a type specifier for all declarations

Check failure on line 10 in src/simplnx/Utilities/HistogramUtilities.hpp

View workflow job for this annotation

GitHub Actions / build (macos-12)

expected identifier or '{'

Check failure on line 10 in src/simplnx/Utilities/HistogramUtilities.hpp

View workflow job for this annotation

GitHub Actions / build (macos-12)

C++ requires a type specifier for all declarations

Check failure on line 10 in src/simplnx/Utilities/HistogramUtilities.hpp

View workflow job for this annotation

GitHub Actions / build (windows-2022, v143)

syntax error: '__declspec' [D:\a\simplnx\simplnx\build\Plugins\SimplnxCore\SimplnxCore.vcxproj]

Check failure on line 10 in src/simplnx/Utilities/HistogramUtilities.hpp

View workflow job for this annotation

GitHub Actions / build (windows-2022, v143)

syntax error: '__declspec' [D:\a\simplnx\simplnx\build\Plugins\SimplnxCore\SimplnxCore.vcxproj]

Check failure on line 10 in src/simplnx/Utilities/HistogramUtilities.hpp

View workflow job for this annotation

GitHub Actions / build (windows-2022, v142)

syntax error: '__declspec' (compiling source file D:\a\simplnx\simplnx\src\Plugins\SimplnxCore\src\SimplnxCore\Filters\Algorithms\ComputeArrayHistogram.cpp) [D:\a\simplnx\simplnx\build\Plugins\SimplnxCore\SimplnxCore.vcxproj]

Check failure on line 10 in src/simplnx/Utilities/HistogramUtilities.hpp

View workflow job for this annotation

GitHub Actions / build (windows-2022, v142)

syntax error: '__declspec' (compiling source file D:\a\simplnx\simplnx\src\Plugins\SimplnxCore\src\SimplnxCore\Filters\Algorithms\ComputeArrayStatistics.cpp) [D:\a\simplnx\simplnx\build\Plugins\SimplnxCore\SimplnxCore.vcxproj]
{
namespace SIMPLNX_EXPORT serial

Check failure on line 12 in src/simplnx/Utilities/HistogramUtilities.hpp

View workflow job for this annotation

GitHub Actions / build (ubuntu-22.04, clang++-14)

expected expression

Check failure on line 12 in src/simplnx/Utilities/HistogramUtilities.hpp

View workflow job for this annotation

GitHub Actions / build (macos-12)

expected expression

Check failure on line 12 in src/simplnx/Utilities/HistogramUtilities.hpp

View workflow job for this annotation

GitHub Actions / build (windows-2022, v143)

syntax error: '__declspec' [D:\a\simplnx\simplnx\build\Plugins\SimplnxCore\SimplnxCore.vcxproj]

Check failure on line 12 in src/simplnx/Utilities/HistogramUtilities.hpp

View workflow job for this annotation

GitHub Actions / build (windows-2022, v143)

syntax error: '__declspec' [D:\a\simplnx\simplnx\build\Plugins\SimplnxCore\SimplnxCore.vcxproj]

Check failure on line 12 in src/simplnx/Utilities/HistogramUtilities.hpp

View workflow job for this annotation

GitHub Actions / build (windows-2022, v142)

syntax error: '__declspec' (compiling source file D:\a\simplnx\simplnx\src\Plugins\SimplnxCore\src\SimplnxCore\Filters\Algorithms\ComputeArrayHistogram.cpp) [D:\a\simplnx\simplnx\build\Plugins\SimplnxCore\SimplnxCore.vcxproj]

Check failure on line 12 in src/simplnx/Utilities/HistogramUtilities.hpp

View workflow job for this annotation

GitHub Actions / build (windows-2022, v142)

syntax error: '__declspec' (compiling source file D:\a\simplnx\simplnx\src\Plugins\SimplnxCore\src\SimplnxCore\Filters\Algorithms\ComputeArrayStatistics.cpp) [D:\a\simplnx\simplnx\build\Plugins\SimplnxCore\SimplnxCore.vcxproj]
{
/**
* @function FillBinRange
Expand All @@ -21,12 +23,12 @@ namespace serial
* @param increment this is the uniform size of the bins
*/
template <typename Type, class Container>
SIMPLNX_EXPORT void FillBinRanges(Container& outputContainer, const std::pair<Type, Type>& rangeMinMax, const int32 numBins, const Type increment)
void FillBinRanges(Container& outputContainer, const std::pair<Type, Type>& rangeMinMax, const int32 numBins, const Type increment)
{
// WARNING: No bounds checking for type compatibility, it is expected to be done higher up where the type is not abstracted
// EXPECTED CONTAINER SIZE: numBins + 1

if(numBins == 1) // if one bin, just set the first element to total number of points
if(numBins == 1) // if one bin, just set the range to the inputs
{
outputContainer[0] = rangeMinMax.first;
outputContainer[1] = rangeMinMax.second;
Expand All @@ -52,7 +54,7 @@ SIMPLNX_EXPORT void FillBinRanges(Container& outputContainer, const std::pair<Ty
* @param numBins this is the total number of bin ranges being calculated and by extension the indexing value for the ranges
*/
template <typename Type, class Container>
SIMPLNX_EXPORT void FillBinRanges(Container& outputContainer, const std::pair<Type, Type>& rangeMinMax, const int32 numBins)
void FillBinRanges(Container& outputContainer, const std::pair<Type, Type>& rangeMinMax, const int32 numBins)
{
// DEV NOTE: this function also serves to act as a jumping off point for implementing logarithmic histograms down the line

Expand All @@ -63,7 +65,7 @@ SIMPLNX_EXPORT void FillBinRanges(Container& outputContainer, const std::pair<Ty
}

template <typename Type>
SIMPLNX_EXPORT Type CalculateBin(Type value, Type min, Type increment)
Type CalculateBin(Type value, Type min, Type increment)
{
return std::floor((value - min) / increment);
}
Expand All @@ -87,8 +89,8 @@ SIMPLNX_EXPORT Type CalculateBin(Type value, Type min, Type increment)
* @param overflow this is an atomic counter for the number of values that fall outside the bin range
*/
template <typename Type, std::integral SizeType, template <typename> class InputContainer, template <typename> class OutputContainer>
SIMPLNX_EXPORT Result<> GenerateHistogram(const InputContainer<Type>& inputStore, OutputContainer<Type>& binRangesStore, const std::pair<Type, Type>& rangeMinMax, const std::atomic_bool& shouldCancel,
const int32 numBins, OutputContainer<SizeType>& histogramCountsStore, std::atomic<usize>& overflow)
Result<> GenerateHistogram(const InputContainer<Type>& inputStore, OutputContainer<Type>& binRangesStore, const std::pair<Type, Type>& rangeMinMax, const std::atomic_bool& shouldCancel,
const int32 numBins, OutputContainer<SizeType>& histogramCountsStore, std::atomic<usize>& overflow)
{
usize end = 0;
if constexpr(std::is_same_v<std::vector<Type>, InputContainer<Type>>)
Expand Down Expand Up @@ -159,7 +161,7 @@ SIMPLNX_EXPORT Result<> GenerateHistogram(const InputContainer<Type>& inputStore
* @brief This is a compatibility functor that leverages existing typecasting functions to execute GenerateHistogram() cleanly. In it there are two
* definitions for the `()` operator that allows for implicit calculation of range, predicated whether a range is passed in or not
*/
struct SIMPLNX_EXPORT GenerateHistogramFunctor
struct GenerateHistogramFunctor
{
template <typename Type, class... ArgsT>
Result<> operator()(const IDataArray* inputArray, IDataArray* binRangesArray, ArgsT&&... args) const
Expand Down Expand Up @@ -190,7 +192,7 @@ struct SIMPLNX_EXPORT GenerateHistogramFunctor
};
} // namespace serial

namespace concurrent
namespace SIMPLNX_EXPORT concurrent

Check failure on line 195 in src/simplnx/Utilities/HistogramUtilities.hpp

View workflow job for this annotation

GitHub Actions / build (windows-2022, v143)

syntax error: '__declspec' [D:\a\simplnx\simplnx\build\Plugins\SimplnxCore\SimplnxCore.vcxproj]

Check failure on line 195 in src/simplnx/Utilities/HistogramUtilities.hpp

View workflow job for this annotation

GitHub Actions / build (windows-2022, v143)

syntax error: '__declspec' [D:\a\simplnx\simplnx\build\Plugins\SimplnxCore\SimplnxCore.vcxproj]

Check failure on line 195 in src/simplnx/Utilities/HistogramUtilities.hpp

View workflow job for this annotation

GitHub Actions / build (windows-2022, v142)

syntax error: '__declspec' (compiling source file D:\a\simplnx\simplnx\src\Plugins\SimplnxCore\src\SimplnxCore\Filters\Algorithms\ComputeArrayHistogram.cpp) [D:\a\simplnx\simplnx\build\Plugins\SimplnxCore\SimplnxCore.vcxproj]

Check failure on line 195 in src/simplnx/Utilities/HistogramUtilities.hpp

View workflow job for this annotation

GitHub Actions / build (windows-2022, v142)

syntax error: '__declspec' (compiling source file D:\a\simplnx\simplnx\src\Plugins\SimplnxCore\src\SimplnxCore\Filters\Algorithms\ComputeArrayStatistics.cpp) [D:\a\simplnx\simplnx\build\Plugins\SimplnxCore\SimplnxCore.vcxproj]
{
/**
* @class GenerateHistogramImpl
Expand All @@ -199,7 +201,7 @@ namespace concurrent
* @tparam SizeType this is the scalar type of the bin counts container
*/
template <typename Type, std::integral SizeType>
class SIMPLNX_EXPORT GenerateHistogramImpl
class GenerateHistogramImpl
{
public:
/**
Expand Down Expand Up @@ -283,4 +285,5 @@ struct InstantiateHistogramImplFunctor
}
};
} // namespace concurrent
} // namespace nx::core::HistogramUtilities
} // namespace HistogramUtilities

Check failure on line 288 in src/simplnx/Utilities/HistogramUtilities.hpp

View workflow job for this annotation

GitHub Actions / build (ubuntu-22.04, clang++-14)

expected ';' after top level declarator

Check failure on line 288 in src/simplnx/Utilities/HistogramUtilities.hpp

View workflow job for this annotation

GitHub Actions / build (macos-12)

expected ';' after top level declarator
} // namespace nx::core
6 changes: 3 additions & 3 deletions src/simplnx/Utilities/Math/StatisticsCalculations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,17 +248,17 @@ std::pair<T, T> findHistogramRange(const C<T, Ts...>& source, T histmin, T histm

// -----------------------------------------------------------------------------
template <template <typename, typename...> class Container, typename T, typename... Ts>
std::pair<T, T> findModalBinRange(const Container<T, Ts...>& source, const nx::core::AbstractDataStore<T>& binRanges, const T& mode)
std::pair<T, T> findModalBinRange(const Container<T, Ts...>& source, const std::vector<T>& binRanges, const T& mode)
{
if(source.empty())
{
return {static_cast<T>(0.0), static_cast<T>(0.0)};
}

size_t numBins = binRanges.getSize() - 1;
size_t numBins = binRanges.size() - 1;

T min = binRanges[0];
T max = binRanges[binRanges.getNumberOfTuples()];
T max = binRanges[numBins];

const T increment = (max - min) / static_cast<T>(numBins);
if constexpr(std::is_floating_point_v<T>)
Expand Down

0 comments on commit 4c7762e

Please sign in to comment.