Function arrayfire::print_gen [] [src]

pub fn print_gen(msg: String, input: &Array, precision: Option<i32>)

Generalized Array print function

Use this function to print Array data with arbitrary preicsion

Parameters

  • msg is message to be printed before printing the Array data
  • input is the Array to be printed
  • precision is data precision with which Array has to be printed

Examples

use arrayfire::{Dim4, print_gen, randu};
println!("Create a 5-by-3 matrix of random floats on the GPU");
let dims = Dim4::new(&[5, 3, 1, 1]);
let a = randu::<f32>(dims);
print_gen(String::from("Random Array"), &a, Some(6));

The sample output will look like below:

Random Array

[5 3 1 1]
    0.740276     0.446440     0.776202
    0.921094     0.667321     0.294810
    0.039014     0.109939     0.714090
    0.969058     0.470269     0.358590
    0.925181     0.513225     0.681451