snap-python icon indicating copy to clipboard operation
snap-python copied to clipboard

add interface for MotifCluster

Open ntfrgl opened this issue 9 years ago • 1 comments

  • check if ARPACK installed (so far only on Linux, OSX)
  • compile motifcluster.cpp, include motifcluster.h in snap.i
  • ~~missing: typedef WeightVH~~

To make this fully functional, two things are missing, and I would like to ask for your help:

  1. ~~Add WeightVH: see below~~
  2. check for ARPACK on Windows: I don't have a Windows machine to test on.

I tried adding WeightVH in the following way:

swig/snap.i

%template(WeightVH) TVec<TIntH>;
%ignore TVec< THash<TInt, TInt, TDefaultHashFunc<TInt> > >::GetPrimHashCd;
%ignore TVec< THash<TInt, TInt, TDefaultHashFunc<TInt> > >::GetSecHashCd;

swig/tvec.i

WeightVH.__getitem__ = getitem_vec
WeightVH.__setitem__ = setitem_vec
WeightVH.__iter__ = itervec
WeightVH.__len__ = len_vec
WeightVH.__delitem__ = delitem_vec

But both with and without the %ignores, this lead to the compilation error:

swig/snap_wrap.cxx

error: no member 'GetPrimHashCd' in 'THash<TInt, TInt, TDefaultHashFunc<TInt> >'
error: no member 'GetSecHashCd' in 'THash<TInt, TInt, TDefaultHashFunc<TInt> >'

Is it necessary to add functions to the C++ library?

ntfrgl avatar Dec 10 '16 17:12 ntfrgl

Works now! The %ignore just needed the format from the %template declaration to fire.

swig/snap.i

%ignore TVec<TIntH>::GetPrimHashCd;
%ignore TVec<TIntH>::GetSecHashCd;

ntfrgl avatar Jan 13 '17 11:01 ntfrgl