def bond_reduce(row_a, row_b):
spanning_cluster = (<EOL>'<STR_LIT>' in row_a.dtype.names and<EOL>'<STR_LIT>' in row_b.dtype.names and<EOL>'<STR_LIT>' in row_a.dtype.names and<EOL>'<STR_LIT>' in row_b.dtype.names<EOL>)<EOL>ret = np.empty_like(row_a)<EOL>def _reducer(key, transpose=False):<EOL><INDENT>mean_key = '<STR_LIT>'.format(key)<EOL>m2_key = '<STR_LIT>'.format(key)<EOL>res = simoa.stats.online_variance(*[<EOL>(<EOL>row['<STR_LIT>'],<EOL>row[mean_key].T if transpose else row[mean_key],<EOL>row[m2_key].T if transpose else row[m2_key],<EOL>)<EOL>for row in [row_a, row_b]<EOL>])<EOL>(<EOL>ret[mean_key],<EOL>ret[m2_key],<EOL>) = (<EOL>res[<NUM_LIT:1>].T,<EOL>res[<NUM_LIT:2>].T,<EOL>) if transpose else res[<NUM_LIT:1>:]<EOL><DEDENT>if spanning_cluster:<EOL><INDENT>_reducer('<STR_LIT>')<EOL><DEDENT>_reducer('<STR_LIT>')<EOL>_reducer('<STR_LIT>', transpose=True)<EOL>ret['<STR_LIT>'] = row_a['<STR_LIT>'] + row_b['<STR_LIT>']<EOL>return ret<EOL>
Reduce the canonical averages over several runs

This is a "true" reducer.
It is associative and commutative.

This is a wrapper around `simoa.stats.online_variance`.

Parameters
----------
row_a, row_b : structured ndarrays
    Output of this function, or initial input from
    `bond_initialize_canonical_averages`

Returns
-------
ret : structured ndarray
    Array is of dtype as returned by `canonical_averages_dtype`

See Also
--------
bond_initialize_canonical_averages
canonical_averages_dtype
simoa.stats.online_variance