PY: doublo function now handles cases where C is a vector and matrix