[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [IMP-dev] Harmonic cleanup



SWIG wraps pairs so that you can use first and second and [0] and [1]. Unfortunately, the
(a, b) = IMP.ParticlePair(pa, pb)
doesn't work, so it doesn't seem to be quite as nice as a true python array.

Still, I think returning a pair is nicer than having different signatures.


On Mar 15, 2008, at 5:06 PM, Ben Webb wrote:

Daniel Russel wrote:
I can do this very easily without any changes to the C++ code. But
maybe
for consistency between C++ and Python it makes more sense to replace
operator() with evaluate(feat) and evaluate_deriv(feat, &deriv) ?
I like having C++ and python the same and (*f_)(value) looks kind of
silly anyway.

Agreed - so I put it in as r473.

If it can be made to work easily in python, I would propose have the
deriv version return a pair or tuple in C++ too.

Yes, I had that in mind when I proposed it - now that the methods have
different names, we can have different return types. But I don't know if
SWIG has any typemaps for pair or tuple - if not it might be a bit
awkward to make it work nicely in Python. It works just fine as is.

It would be really nice to be able to run tests on unary
functions.
Well, we already can, of course - just not on the derivatives.
Sure. But consistency between function and its derivative seems like
the main nontrivial thing to check.

Agreed.

	Ben
--
                      http://salilab.org/~ben/
"It is a capital mistake to theorize before one has data."
	- Sir Arthur Conan Doyle
_______________________________________________
IMP-dev mailing list

https://salilab.org/mailman/listinfo/imp-dev