IndexerWrapper: Fix for Intel Compiler (probably returning stack reference?)

This commit is contained in:
2023-06-14 11:34:49 +02:00
parent cc07979fca
commit cd76e97766
2 changed files with 8 additions and 19 deletions

View File

@@ -9,22 +9,6 @@ void IndexerWrapper::Setup(const UnitCell &cell) {
#endif
}
// Select spots that belong to indexing solution
// - cell cell in real space
// - spots spots in reciprocal space
// - threshold radius around approximated miller indices
template <typename Mat3, typename MatX3, typename float_type=typename Mat3::Scalar>
inline auto select_indexed_spots(const Eigen::MatrixBase<Mat3>& cell,
const Eigen::MatrixBase<MatX3>& spots,
float_type threshold=.02f)
{
using M3x = Eigen::MatrixX3<float_type>;
M3x resid = spots * cell.transpose();
const M3x miller = round(resid.array());
resid -= miller;
return resid.rowwise().norm().array() < threshold;
}
std::vector<IndexingResult> IndexerWrapper::Run(const std::vector<Coord> &coord) {
#ifdef JFJOCH_USE_CUDA
std::vector<IndexingResult> ret;
@@ -46,10 +30,15 @@ std::vector<IndexingResult> IndexerWrapper::Run(const std::vector<Coord> &coord)
// Get best cell
auto id = fast_feedback::refine::best_cell(indexer.oScoreV());
// Get indexed spots
auto arr = select_indexed_spots(indexer.oCell(id), indexer.Spots(), threshold);
// get indexed spots
using M3x = Eigen::MatrixX3<float>;
M3x resid = indexer.Spots() * indexer.oCell(id).transpose();
const M3x miller = round(resid.array());
resid -= miller;
auto arr = resid.rowwise().norm().array() < threshold;
auto indexed_spot_count = arr.count();
// Check if result is viable
if (indexed_spot_count > min_spots) {
IndexingResult result;