From 52cd25c3656a97ddb4f60f036fdbf29abb238add Mon Sep 17 00:00:00 2001 From: conrad Date: Wed, 6 Aug 2025 14:12:15 +1000 Subject: [PATCH] increase accuracy for fp16 --- include/armadillo_bits/fn_misc.hpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/include/armadillo_bits/fn_misc.hpp b/include/armadillo_bits/fn_misc.hpp index d58bbab8..069f0285 100644 --- a/include/armadillo_bits/fn_misc.hpp +++ b/include/armadillo_bits/fn_misc.hpp @@ -59,7 +59,7 @@ linspace const uword num_m1 = num - 1; - if(is_real::value) + if(is_float::value || is_double::value) { const T delta = (end-start)/T(num_m1); @@ -71,6 +71,18 @@ linspace x_mem[num_m1] = eT(end); } else + if(is_fp16::value) + { + const float delta = (end-start)/float(num_m1); + + for(uword i=0; i= start) ? double(end-start)/double(num_m1) : -double(start-end)/double(num_m1);