mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-03 21:44:30 +08:00
consolidate numeric vectors (#7792)
* Speed up boost vector iterators by 300x * Add vector testing code * Update test * Remove GetPosition notebook * Move all wrapped int vectors to top level * Grab MatchTypeVect from rdBase * Actually wrap the vectors
This commit is contained in:
@@ -142,8 +142,6 @@ struct enumeration_wrapper {
|
||||
static void wrap() {
|
||||
std::string docString;
|
||||
|
||||
RegisterVectorConverter<std::vector<std::string>>("VectorOfStringVectors");
|
||||
RegisterVectorConverter<boost::uint64_t>("VectSizeT");
|
||||
RegisterVectorConverter<MOL_SPTR_VECT>("VectMolVect");
|
||||
|
||||
python::class_<RDKit::EnumerateLibraryBase, RDKit::EnumerateLibraryBase *,
|
||||
|
||||
@@ -322,8 +322,6 @@ struct filtercat_wrapper {
|
||||
.def_readwrite("target", &std::pair<int, int>::second)
|
||||
.def("__getitem__", &GetMatchVectItem, python::args("self", "idx"));
|
||||
|
||||
RegisterVectorConverter<std::pair<int, int>>("MatchTypeVect");
|
||||
|
||||
python::class_<FilterMatch, boost::shared_ptr<FilterMatch>>(
|
||||
"FilterMatch", FilterMatchDoc,
|
||||
python::init<boost::shared_ptr<FilterMatcherBase>, MatchVectType>(
|
||||
|
||||
@@ -169,8 +169,6 @@ python::object TQToBinary(const TautomerQuery &tq) {
|
||||
|
||||
struct TautomerQuery_wrapper {
|
||||
static void wrap() {
|
||||
RegisterVectorConverter<size_t>("UnsignedLong_Vect");
|
||||
|
||||
auto docString =
|
||||
"The Tautomer Query Class.\n\
|
||||
Creates a query that enables structure search accounting for matching of\n\
|
||||
|
||||
@@ -257,11 +257,20 @@ BOOST_PYTHON_MODULE(rdBase) {
|
||||
RDLog::InitLogs();
|
||||
RegisterVectorConverter<int>();
|
||||
RegisterVectorConverter<unsigned>();
|
||||
RegisterVectorConverter<size_t>("UnsignedLong_Vect");
|
||||
RegisterVectorConverter<boost::uint64_t>("VectSizeT");
|
||||
|
||||
|
||||
RegisterVectorConverter<double>();
|
||||
RegisterVectorConverter<std::string>(1);
|
||||
RegisterVectorConverter<std::vector<int>>();
|
||||
RegisterVectorConverter<std::vector<unsigned>>();
|
||||
RegisterVectorConverter<std::vector<double>>();
|
||||
RegisterVectorConverter<std::vector<std::string>>("VectorOfStringVectors");
|
||||
|
||||
RegisterVectorConverter<std::pair<int, int>>("MatchTypeVect");
|
||||
|
||||
|
||||
path_converter();
|
||||
|
||||
RegisterListConverter<int>();
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
#
|
||||
import sys
|
||||
|
||||
from rdkit import Chem
|
||||
from rdkit import Chem, rdBase
|
||||
from rdkit.Chem.rdfiltercatalog import *
|
||||
|
||||
MatchTypeVect = rdBase.MatchTypeVect
|
||||
|
||||
class FilterMatcher(PythonFilterMatcher):
|
||||
"""FilterMatcher - This class allows creation of Python based
|
||||
|
||||
@@ -59,8 +59,10 @@ class VectIter:
|
||||
def __vect__iter__(vect):
|
||||
return VectIter(vect)
|
||||
|
||||
VECT_WRAPS = {'MatchTypeVect', 'UnsignedLong_Vect', 'VectSizeT', 'VectorOfStringVectors'}
|
||||
|
||||
for name, object in vars(rdBase).items():
|
||||
if name.startswith("_list") or name.startswith("_vect"):
|
||||
if name.startswith("_list") or name.startswith("_vect") or name in VECT_WRAPS:
|
||||
if hasattr(object, "__iter__"):
|
||||
object.__iter__ = __vect__iter__
|
||||
|
||||
|
||||
Reference in New Issue
Block a user