implement mat_norm_2() for fp16 via type promoted matrix

This commit is contained in:
conrad
2025-08-05 11:30:13 +10:00
parent 567d6ccd2c
commit d5e8bae784
+6 -2
View File
@@ -960,9 +960,13 @@ op_norm::mat_norm_2(const Mat<eT>& X, const typename arma_fp16_real_or_cx_only<e
arma_debug_sigprint();
arma_ignore(junk);
arma_stop_logic_error("norm(): matrix 2-norm currently not supported for fp16; try norm2est() instead");
typedef typename get_pod_type<eT>::result T;
return typename get_pod_type<eT>::result(0);
typedef typename promote_type<eT, float>::result promoted_eT;
const Mat<promoted_eT> XX = conv_to< Mat<promoted_eT> >::from(X);
return T(op_norm::mat_norm_2(XX));
}