daphne-eu / daphne

DAPHNE: An Open and Extensible System Infrastructure for Integrated Data Analysis Pipelines
Apache License 2.0
67 stars 62 forks source link

Overview of currently supported value types for matrix operations #624

Open divjakm opened 1 year ago

divjakm commented 1 year ago

I tested basic matrix operations with all available value types using the latest Daphne DSL version (October 2023). Here is a short overview of what currently works:

1) F64 and SI64: works. Explicit cast is needed to store INT literals into F64 or FLOAT literals into SI64, which is reasonable. For example:

A = as.matrix<f64>(fill (0, 2, 3));
A[0,0] = as.matrix(7.0);  // works
A[0,0] = as.matrix(7);  // error
A[0,0] = as.matrix<f64>(7); // works

2) F32: works, but has some unexpected casting behavior. For eaxmple:

A = as.matrix<f32>(fill (0, 2, 3));
A[0,0] = as.matrix(7.0);    // error
A[0,0] = as.matrix<f32>(7);    // works
A[0,0] = as.matrix(as.f32(7)); // error
A[0,0] = as.matrix(as.f32(7.0)); // error
A[0,] = as.matrix<f32>(fill (0, 1, 3)); // works

3) UI64, UI32, SI32, UI8, SI8, BOOL: assigning the whole matrix works, but assigning values to elements of a matrix doesn't work. Some examples for UI64:

A = as.matrix<ui64>(fill (0, 2, 3));
A[0,0] = as.matrix(7);      // error
A[0,0] = as.matrix<ui64>(7);    // error
A[0,0] = as.matrix(as.ui64(7)); // error
A[0,0] = as.matrix<ui64>(as.ui64(7)); // error
A[0,] = as.matrix<ui64>(fill (0, 1, 3)); // error
A = as.matrix<ui64>([1, 2]);     // works

I checked the list of opened issues and didn't find this mentioned. Perhaps it helps somebody...