Multiplexed coherent optical processor for calculating generalized moments