residual scalar product