diff --git a/examples/epg/discrete.cpp b/examples/epg/discrete.cpp index bdd278e..ddc101a 100644 --- a/examples/epg/discrete.cpp +++ b/examples/epg/discrete.cpp @@ -1,4 +1,5 @@ #include +#include #include #include @@ -32,7 +33,7 @@ int main() sycomore::epg::Discrete(species), sycomore::epg::Discrete(species)}; models[1].threshold = 1e-6; - std::size_t repetitions = 4*species.T1()/TR; + std::size_t repetitions = std::lround(4*species.T1()/TR); sycomore::TensorC<2> S_plus({models.size(), repetitions}, 0); sycomore::TensorC<2> S_minus({models.size(), repetitions}, 0); diff --git a/examples/epg/regular.cpp b/examples/epg/regular.cpp index 515790e..226210b 100644 --- a/examples/epg/regular.cpp +++ b/examples/epg/regular.cpp @@ -1,3 +1,5 @@ +#include + #include #include #include @@ -13,7 +15,7 @@ int main() auto flip_angle=30*deg, TE=5*ms, TR=25*ms; std::vector phase_steps{0*deg, 90*deg, 117*deg, 180*deg}; auto slice_thickness=1*mm, tau_readout=1*ms; - std::size_t repetitions = 5*species.T1()/TR; + std::size_t repetitions = std::lround(5*species.T1()/TR); // Motion to k-space extremity and its associated gradient amplitude auto k_max = 0.5 * 2*M_PI / slice_thickness; diff --git a/examples/isochromat.cpp b/examples/isochromat.cpp index 44e30a7..403e94b 100644 --- a/examples/isochromat.cpp +++ b/examples/isochromat.cpp @@ -21,24 +21,24 @@ int main() auto idle = model.build_time_interval(10*ms); std::vector> record{ - {0*s, xt::view(model.magnetization(), 0)}}; + {0*s, xt::view(model.magnetization(), 0UL)}}; for(std::size_t i=0; i!=10; ++i) { model.apply(idle); record.emplace_back( - record.back().first+step, xt::view(model.magnetization(), 0)); + record.back().first+step, xt::view(model.magnetization(), 0UL)); } model.apply(pulse); record.emplace_back( - record.back().first+step, xt::view(model.magnetization(), 0)); + record.back().first+step, xt::view(model.magnetization(), 0UL)); for(std::size_t i=0; i!=100; ++i) { model.apply(idle); record.emplace_back( - record.back().first+step, xt::view(model.magnetization(), 0)); + record.back().first+step, xt::view(model.magnetization(), 0UL)); } return 0; diff --git a/tests/cpp/isochromat/Model.cpp b/tests/cpp/isochromat/Model.cpp index eeae6b5..41b19b7 100644 --- a/tests/cpp/isochromat/Model.cpp +++ b/tests/cpp/isochromat/Model.cpp @@ -112,12 +112,12 @@ BOOST_AUTO_TEST_CASE(TimeIntervalUniform) auto combined = model.build_phase_accumulation(2*M_PI*400*10e-3); combined.pre_multiply(model.build_relaxation(10*ms)); - BOOST_TEST(xt::allclose(xt::view(op.array(), 0), combined.array())); + BOOST_TEST(xt::allclose(xt::view(op.array(), 0UL), combined.array())); combined = model.build_phase_accumulation( 2*M_PI*400*10e-3 + sycomore::gamma.magnitude*50e-6*10e-3); combined.pre_multiply(model.build_relaxation(10*ms)); - BOOST_TEST(xt::allclose(xt::view(op.array(), 1), combined.array())); + BOOST_TEST(xt::allclose(xt::view(op.array(), 1UL), combined.array())); auto default_frequency_and_gradient = model.build_time_interval(10_ms); BOOST_TEST(xt::allclose( @@ -144,12 +144,12 @@ BOOST_AUTO_TEST_CASE(TimeIntervalVariable) auto combined = model.build_phase_accumulation( 2*M_PI*400*10e-3 + sycomore::gamma.magnitude*10e-6*10e-3); combined.pre_multiply(model.build_relaxation(10*ms)); - BOOST_TEST(xt::allclose(xt::view(op.array(), 0), combined.array())); + BOOST_TEST(xt::allclose(xt::view(op.array(), 0UL), combined.array())); combined = model.build_phase_accumulation( 2*M_PI*600*10e-3 + sycomore::gamma.magnitude*15e-6*10e-3); combined.pre_multiply(model.build_relaxation(10*ms)); - BOOST_TEST(xt::allclose(xt::view(op.array(), 1), combined.array())); + BOOST_TEST(xt::allclose(xt::view(op.array(), 1UL), combined.array())); auto default_gradient = model.build_time_interval(10_ms, {400*Hz, 600*Hz}); BOOST_TEST(xt::allclose(