arrayfire / arrayfire-rust

Rust wrapper for ArrayFire
BSD 3-Clause "New" or "Revised" License
815 stars 58 forks source link

[Build] Half 2.2.0 is not compatible #370

Closed BA8F0D39 closed 1 year ago

BA8F0D39 commented 1 year ago

Description

The latest version of half 2.2.0 is not compatible with arrayfire-rust 3.8.0

Build Environment

Compiler version: Operating system: Build environment:

Error Log

use half;
use half::f16;
use half::*;
fn main() {

    let arr = vec![half::f16::from_f32(5.4), half::f16::from_f32(-2.1),half::f16::from_f32(-2.1)  ];

    let mut test = arrayfire::Array::new(&arr, arrayfire::Dim4::new(&[3, 1, 1, 1]));

}
error[E0277]: the trait bound f16: HasAfEnum is not satisfied --> examples/test.rs:27:17 27 let mut test = arrayfire::Array::new(&arr, arrayfire::Dim4::new(&[3, 1, 1, 1])); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait HasAfEnum is not implemented for f16
= help: the following other types implement trait `HasAfEnum`:
          bool
          f32
          f64
          half::binary16::f16
          i16
          i32
          i64
          num_complex::Complex<f32>
        and 5 others

note: required by a bound in Array --> /home/test/.cargo/registry/src/github.com-1ecc6299db9ec823/arrayfire-3.8.0/src/core/array.rs:163:21 | 163 | pub struct Array { | ^^^^^^^^^ required by this bound in Array

BA8F0D39 commented 1 year ago

Updating half to 2.2.0 in the arrayfire-rust Cargo.toml fixes this

I need from_f32_const and from_f64_const from the newer half versions

9prady9 commented 1 year ago

@BA8F0D39 Would it be possible for you to submit a PR ? That would be great.

BA8F0D39 commented 1 year ago

Done

BA8F0D39 commented 1 year ago

@9prady9

9prady9 commented 1 year ago

@BA8F0D39 Thanks for the notification, sorry was on parental leave until recently. Will take a look at it this weekend.