-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
C++ formatting and performance improvements (#113)
* C++ format and performance gains
- Loading branch information
Showing
8 changed files
with
100 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ | |
except Exception as e: | ||
pass | ||
|
||
__version__ = "0.5.2" | ||
__version__ = "0.5.3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,8 @@ | |
|
||
#include <cstdint> | ||
|
||
struct Result { | ||
struct Result | ||
{ | ||
uint32_t idx; | ||
uint32_t mol_id; | ||
float coeff; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,49 @@ | ||
#pragma once | ||
|
||
#include "result.hpp" | ||
#include <pybind11/numpy.h> | ||
#include <pybind11/pybind11.h> | ||
|
||
namespace py = pybind11; | ||
|
||
inline uint32_t SubstructCoeff(const uint32_t &rel_co_popcnt, | ||
const uint32_t &common_popcnt); | ||
|
||
inline float TanimotoCoeff(const uint32_t &common_popcnt, | ||
const uint32_t &qcount, | ||
const uint32_t &ocount); | ||
|
||
inline float TverskyCoeff(const uint32_t &common_popcnt, | ||
const uint32_t &rel_co_popcnt, | ||
const uint32_t &rel_co_popcnt2, | ||
const float &a, const float &b); | ||
inline uint32_t SubstructCoeff(uint32_t rel_co_popcnt, | ||
uint32_t common_popcnt) noexcept | ||
{ | ||
uint32_t sum = rel_co_popcnt + common_popcnt; | ||
return sum ? common_popcnt / sum : 0; | ||
} | ||
|
||
inline float TanimotoCoeff(uint32_t common_popcnt, | ||
uint32_t qcount, | ||
uint32_t ocount) noexcept | ||
{ | ||
return static_cast<float>(common_popcnt) / (qcount + ocount - common_popcnt); | ||
} | ||
|
||
inline float TverskyCoeff(uint32_t common_popcnt, | ||
uint32_t rel_co_popcnt, | ||
uint32_t rel_co_popcnt2, | ||
float a, | ||
float b) noexcept | ||
{ | ||
float denominator = common_popcnt + a * rel_co_popcnt + b * rel_co_popcnt2; | ||
return denominator > 0.0f ? common_popcnt / denominator : 0.0f; | ||
} | ||
|
||
py::array_t<uint32_t> SubstructureScreenout(const py::array_t<uint64_t> py_query, | ||
const py::array_t<uint64_t> py_db, | ||
const uint32_t start, | ||
const uint32_t end); | ||
uint32_t start, | ||
uint32_t end); | ||
|
||
py::array_t<Result> TanimotoSearch(const py::array_t<uint64_t> py_query, | ||
const py::array_t<uint64_t> py_db, | ||
const float threshold, | ||
const uint32_t start, | ||
const uint32_t end); | ||
float threshold, | ||
uint32_t start, | ||
uint32_t end); | ||
|
||
py::array_t<Result> TverskySearch(const py::array_t<uint64_t> py_query, | ||
const py::array_t<uint64_t> py_db, | ||
const float threshold, | ||
const float a, | ||
const float b, | ||
const uint32_t start, | ||
const uint32_t end); | ||
float threshold, | ||
float a, | ||
float b, | ||
uint32_t start, | ||
uint32_t end); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters