function h=ctranspose(f,nin,nout)
	fns = { @q21, @q2n; @qn1, @qnn };
	if nargin<3, nout=nargout(f); end
	if nargin<2, nin=nargin(f); end
	h=fns{acount(nin,2)-1,acount(nout,1)};
	function y=q21(x,y), y=f(y,x); end
	function y=qn1(x,y,varargin), y=f(y,x,varargin{:}); end
	function varargout=q2n(x,y), [varargout{1:nargout}]=f(y,x); end
	function varargout=qnn(x,y,varargin), [varargout{1:nargout}]=f(y,x,varargin{:}); end
end
