I have a column with values numeric[]that are the same size. I would like to accept their average size. By this I mean that the mean
{1, 2, 3}, {-1, -2, -3}, and {3, 3, 3}
should be {1, 1, 1}. It is also interesting how to summarize these elements, although I expect that any solution for one will be a solution for the other.
(NB: the length of the arrays is fixed in one table, but can vary between tables. Therefore, I need a solution that does not imply a specific length.)
My initial guess is that I have to use it somehow unnest, as unnestapplied to a column numeric[]aligns all arrays. Therefore, I would like to think that there is a good way to use this using some window processing function + group byto highlight the individual components of each array and sum them up.
CREATE TABLE A
(vector numeric[])
;
INSERT INTO A
VALUES
('{1, 2, 3}'::numeric[])
,('{-1, -2, -3}'::numeric[])
,('{3, 3, 3}'::numeric[])
;