VECTOR SELECT unweighted units
Posted: Sat Feb 13, 2021 4:53 pm
Hi,
I'm using VECTOR SELECT to perform SUM and VMIN type calculations on large matrices.
Say Result = VECTOR SELECT(selection_array, expression_array, ..., numerical_action, ...),
Units checking appears to look for
units(Result) = units(selection_array)*units(expression_array).
This is correct when numerical_action is in 0..4, when the aggregation is weighted by selection_array.
I think this is not correct when numerical_action is in 6..10, when the aggregation simply looks for non-zero elements of selection_array. In this case the proper units check is
units(Result) = units(expression_array).
If selection_array is dimensionless, then no units errors. Sometimes selection_array is inherently dimensional (e.g. parts/unit).
A work-around to avoid units errors is to define a dimensionless version of selection_array for use in the VECTOR_SELECT calculation. But if selection_array is large, this is not a great solution.
Another work-around is to ignore the unit errors. I don't like to make a habit of that!
A third approach would be to patch the VECTOR SELECT units check algorith.
Any other ideas?
An example is attached.
Best regards,
Rob
I'm using VECTOR SELECT to perform SUM and VMIN type calculations on large matrices.
Say Result = VECTOR SELECT(selection_array, expression_array, ..., numerical_action, ...),
Units checking appears to look for
units(Result) = units(selection_array)*units(expression_array).
This is correct when numerical_action is in 0..4, when the aggregation is weighted by selection_array.
I think this is not correct when numerical_action is in 6..10, when the aggregation simply looks for non-zero elements of selection_array. In this case the proper units check is
units(Result) = units(expression_array).
If selection_array is dimensionless, then no units errors. Sometimes selection_array is inherently dimensional (e.g. parts/unit).
A work-around to avoid units errors is to define a dimensionless version of selection_array for use in the VECTOR_SELECT calculation. But if selection_array is large, this is not a great solution.
Another work-around is to ignore the unit errors. I don't like to make a habit of that!
A third approach would be to patch the VECTOR SELECT units check algorith.
Any other ideas?
An example is attached.
Best regards,
Rob