Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change -f 4 output. #7

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Conversation

ghuls
Copy link
Contributor

@ghuls ghuls commented Apr 21, 2022

Change -f 4 output as last 2 column were not very useful.
Provide smart log1pexp(x) function to replace calling log1p(exp(x)) unconditionally.
Add new ways to compile faster binaries.
Fix some wrong asserts.
Remove unused functions.
Reformat code and add braces around all statements.

ghuls added 9 commits March 25, 2022 15:10
Use log1pexp(x) instead of log1p(exp(x)) as this results in a slightly
faster (5%) binary as log1p() and exp() do not need to be calculated
for each x value.
+// Return "log(1+exp(x))" evaluated carefully for largish "x".
+// This is also called the "softplus": https://en.wikipedia.org/wiki/Rectifier_(neural_networks)
+// transformation, being a smooth approximation to "max(0,x)".
+//
+// See:
+//  - Martin Maechler (2012) "Accurately Computing log(1 − exp(− |a|))": http://cran.r-project.org/web/packages/Rmpfr/vignettes/log1mexp-note.pdf
+//  - Julia LegExpFunctions package: https://github.com/JuliaStats/LogExpFunctions.jl/blob/master/src/basicfuns.jl
+inline double log1pexp(double x) {
Replace std::bind2nd with lambda to avoid:

    warning: 'bind2nd<std::plus<double>, double>' is deprecated [-Wdeprecated-declarations]

when specifying C++11 or greater.
Add braces around all statements (if, else, for, while, ...)
for better readability.
Reformat code with clang-format (version 12):

    clang-format -style=LLVM -i *.cpp *.hpp

Fix the following errors in cbust.cpp and
remove_overlapping_segments.hpp after reformatting:

    error: ‘>>’ should be ‘> >’ within a nested template argument list

Not all clang-format changes are applied (like formating of lines
that print text).
Remove unused functions.
Fix asserts: bg and scores have size 0. So test if the capacity
is big enough instead.
Only print sequence name and score for -f 4.
Sort only top X clusters per sequence by score if -t is specified.
Update Makefile to create faster binaries:
  - cbust_static:
      Compile a static binary with a recent version of gcc and glibc
      to run on an old distribution as CentOS7. Resulting binary can
      be twice as fast.
  - cbust_amd_libm_aocc:
      Compile a static binary with AMD math library (compiled with AOCC)
      for a slightly faster binary than cbust, or cbust_static.
  - cbust_amd_libm_gcc:
      Compile a static binary with AMD math library (compiled with GCC)
      for a slightly faster binary than cbust, or cbust_static.
@ghuls ghuls force-pushed the change_f4_output branch from 256f621 to 5911cd6 Compare April 21, 2022 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant