refactor to easily allow algorithms generic over f16/32/64