Difference between revisions of "Error Messages/40352"
(→Remedy) |
|||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
− | + | [[Category: Error messages]] | |
− | :The function ' | + | == Message text examples == |
− | + | ||
− | + | <pre style="background:white; border:white; margin-left: 1em; font-style:italic"> | |
+ | The function 'Rank' is not a valid conglomeration function, and thus cannot be used for the «conglomerationFn» parameter (5th parameter) to function MdTable. When it was called, the dimensionality of the result was not as required. A conglomeration function must have the form: | ||
+ | F(A: Array[I]; I: IndexType) | ||
+ | and must reduce a 1-D array to an atomic value (or at least, the result must not be indexed by I). Example are Sum, Product, Min, Max, and Average. | ||
+ | </pre> | ||
or | or | ||
− | :The function ' | + | <pre style="background:white; border:white; margin-left: 1em; font-style:italic"> |
− | + | The function 'Cumulate' is not a valid conglomeration function, and thus cannot be used for the «type» parameter to function Aggregate. When it was called, the dimensionality of the result was not as required. A conglomeration function must have the form: | |
− | + | F(A: Array[I]; I: IndexType) | |
+ | and must reduce a 1-D array to an atomic value (or at least, the result must not be indexed by I). Example are Sum, Product, Min, Max, and Average. | ||
+ | </pre> | ||
− | = Cause = | + | == Cause == |
− | When you use the functions [[MdTable]] and [[Aggregate]], it | + | When you use the functions [[MdTable]] and [[Aggregate]], it may happen that multiple items in the original data map to the same cell in the result. In that case, it must conglomerate (aggregate) these values in some fashion. By default, these functions sum the values. Both functions let you optionally specify another conglomeration function using an optional parameter («conglomerationFn» in [[MdTable]], or «type» in [[Aggregate]]) to specify how to combine the multiple values that map to the same cell in the result. The conglomeration function must be an array-reducing function -- one that returns a scalar value when passed a 1-D array of values. This error occurs when the function specified has an acceptable parameter declaration, but it did not reduce the result to a scalar as expected. |
− | = Remedy = | + | == Remedy == |
If you are specifying your own [[User-Defined Function]] for the conglomeration function, you may need to debug your function to make sure that it reduces the result when passed a 1-D array. Otherwise, you may simply need to use a different aggregation function. | If you are specifying your own [[User-Defined Function]] for the conglomeration function, you may need to debug your function to make sure that it reduces the result when passed a 1-D array. Otherwise, you may simply need to use a different aggregation function. | ||
− | = Examples = | + | == Examples == |
In one example where this error was encountered, the following [[User-Defined Function]] was created: | In one example where this error was encountered, the following [[User-Defined Function]] was created: | ||
− | Function First(A ; I : Index ) := A[@I= | + | :<code>Function First(A; I: Index) := A[@I = I]</code> |
+ | |||
+ | When <code>Aggregate(X, map, Fine, Coarse, type: Handle(First))</code> was evaluated, the error occurred. The problem was resolved by fixing the function definition, which had a mistake, the correct definition being: | ||
+ | :<code>Function First(A; I: Index) := A[@I = 1]</code> | ||
− | + | ==See Also== | |
− | + | * [[Rank]] | |
+ | * [[Cumulate]] | ||
+ | * [[Aggregate]] | ||
+ | * [[Sum]] | ||
+ | * [[Product]] | ||
+ | * [[Min]] | ||
+ | * [[Max]] | ||
+ | * [[Average]] | ||
+ | * [[MdTable]] | ||
+ | * [[User-Defined Functions]] | ||
+ | * [[Function calls and parameters]] | ||
+ | * [[Handle]] |
Latest revision as of 00:46, 12 March 2016
Message text examples
The function 'Rank' is not a valid conglomeration function, and thus cannot be used for the «conglomerationFn» parameter (5th parameter) to function MdTable. When it was called, the dimensionality of the result was not as required. A conglomeration function must have the form: F(A: Array[I]; I: IndexType) and must reduce a 1-D array to an atomic value (or at least, the result must not be indexed by I). Example are Sum, Product, Min, Max, and Average.
or
The function 'Cumulate' is not a valid conglomeration function, and thus cannot be used for the «type» parameter to function Aggregate. When it was called, the dimensionality of the result was not as required. A conglomeration function must have the form: F(A: Array[I]; I: IndexType) and must reduce a 1-D array to an atomic value (or at least, the result must not be indexed by I). Example are Sum, Product, Min, Max, and Average.
Cause
When you use the functions MdTable and Aggregate, it may happen that multiple items in the original data map to the same cell in the result. In that case, it must conglomerate (aggregate) these values in some fashion. By default, these functions sum the values. Both functions let you optionally specify another conglomeration function using an optional parameter («conglomerationFn» in MdTable, or «type» in Aggregate) to specify how to combine the multiple values that map to the same cell in the result. The conglomeration function must be an array-reducing function -- one that returns a scalar value when passed a 1-D array of values. This error occurs when the function specified has an acceptable parameter declaration, but it did not reduce the result to a scalar as expected.
Remedy
If you are specifying your own User-Defined Function for the conglomeration function, you may need to debug your function to make sure that it reduces the result when passed a 1-D array. Otherwise, you may simply need to use a different aggregation function.
Examples
In one example where this error was encountered, the following User-Defined Function was created:
Function First(A; I: Index) := A[@I = I]
When Aggregate(X, map, Fine, Coarse, type: Handle(First))
was evaluated, the error occurred. The problem was resolved by fixing the function definition, which had a mistake, the correct definition being:
Function First(A; I: Index) := A[@I = 1]
Enable comment auto-refresher