SciDB draws a distinction between functions (which are applied to a scalar and return a scalar) and aggregates (which are applied to a set and return a scalar). So you can write a median() aggregate and use it in window, variable_window, group aggregates, cumulate or regrid. In fact there is one implementation of that in the P4 EE library. Exact medians are complex since there isn’t an algorithm that doesn’t have O(n) space requirements. But with windows, n is as big as the window size.
There’s example code for an aggregate here viewtopic.php?f=18&t=1122 . It’s a little old unfortunately.
There’s a newer example of a financial nbbo aggregate here: github.com/Paradigm4/quotes/blo … egates.cpp