There are some preprocessing functions that require specific data types as inputs. For example, AMD reordering requires that the input CSR's row_ptr and col arrays be of type long. SparseBase has the capability to convert data types of arrays, however, type matching isn't checked at function-matching time, and it should be added to function matcher.
For instance, say you would like to AMD reorder a CSR<int, int, int> but AMD reordering is only available for CSR<long, long, %>, then function matcher wouldn't recognize this. It will call the AMD reordering with the CSR<int, int, int> and then inside the implementation function itself you need to either convert the input to the correct type, or throw an exception.
Currently, we handle this problem using two approaches:
- Type convert inside the implementation. Whe the
CSR<int, int, int> is passed to the implementation function, we use our utility functions to do safe type conversion and carry out the preprocessing. If the conversion fails half-way an exception is thrown telling the user which types to use.
- Throw an exception directly. If the input types don't match the required types, we directly throw an exception informing the user of the mismatch, and the user can handle type mismatches themselves.
However, the solution we wish to have is to allow FunctionMatcher to carry out type conversion with the explicit permission of the user.
There are some preprocessing functions that require specific data types as inputs. For example, AMD reordering requires that the input CSR's
row_ptrandcolarrays be of typelong. SparseBase has the capability to convert data types of arrays, however, type matching isn't checked at function-matching time, and it should be added to function matcher.For instance, say you would like to AMD reorder a
CSR<int, int, int>but AMD reordering is only available forCSR<long, long, %>, then function matcher wouldn't recognize this. It will call the AMD reordering with theCSR<int, int, int>and then inside the implementation function itself you need to either convert the input to the correct type, or throw an exception.Currently, we handle this problem using two approaches:
CSR<int, int, int>is passed to the implementation function, we use our utility functions to do safe type conversion and carry out the preprocessing. If the conversion fails half-way an exception is thrown telling the user which types to use.However, the solution we wish to have is to allow FunctionMatcher to carry out type conversion with the explicit permission of the user.