The example given in http://arrayfire.org/docs/group__data__func__diag.htm doesn't match the output when running the code:
Documentation example:
// Extraction
array a = randu(dim4(4, 3));
// a [4 3 1 1]
// 0.0000 0.5328 0.6793
// 0.1315 0.2190 0.9347
// 0.7556 0.0470 0.3835
// 0.4587 0.6789 0.5194
array b = diag(a);
// b [3 1 1 1]
// 0.0000
// 0.2190
// 0.3835
However, when running the code, there's an extra zero in the output:
af::array a = af::randu(af::dim4(4, 3));
af::array b = af::diag(a);
af::print("b", b);
b
[4 1 1 1]
0.5488
0.8579
0.6459
0.0000 <--
The example given in http://arrayfire.org/docs/group__data__func__diag.htm doesn't match the output when running the code:
Documentation example:
However, when running the code, there's an extra zero in the output: