Skip to content

Commit d99144d

Browse files
committed
Remove redundant code
1 parent 291e673 commit d99144d

2 files changed

Lines changed: 1 addition & 13 deletions

File tree

include/xtensor/xhistogram.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ namespace xt
7676
// left and right are not bounds of data
7777
if ( v >= left & v < right )
7878
{
79-
auto i_bin = static_cast<size_t>(static_cast<double>(n_bins) * (static_cast<double>(data(i)) - left) * norm);
79+
auto i_bin = static_cast<size_t>(static_cast<double>(n_bins) * (v - left) * norm);
8080
count(i_bin) += weights(i);
8181
}
8282
else if ( v == right )

test/test_xhistogram.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
#include "xtensor/xtensor.hpp"
1515
#include "xtensor/xhistogram.hpp"
1616
#include "xtensor/xrandom.hpp"
17-
#include "xtensor/xio.hpp"
18-
1917

2018
namespace xt
2119
{
@@ -31,16 +29,6 @@ namespace xt
3129
EXPECT_EQ(count(1), 2.);
3230
}
3331

34-
{
35-
xt::xtensor<double, 1> edges {0, 1.5, 3};
36-
xt::xtensor<double, 1> weights {1, 1, 1, 1};
37-
auto count = xt::histogram<int>(data, edges, weights, true);
38-
// This is indeed a bug. If the count is the density, an integral return
39-
// type should not be allowed.
40-
EXPECT_EQ(count(0), 0.);
41-
EXPECT_EQ(count(1), 0.);
42-
}
43-
4432
{
4533
xt::xtensor<double, 1> count = xt::histogram(data,
4634
xt::histogram_bin_edges(data, std::size_t(2), xt::histogram_algorithm::uniform)

0 commit comments

Comments
 (0)