Skip to content

Commit

Permalink
Removed C++ calls to 'pow' to prevent build fail on solaris
Browse files Browse the repository at this point in the history
  • Loading branch information
shaunpwilkinson committed Jun 14, 2017
1 parent fe3da4f commit 1b12f9f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 28 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: phylogram
Type: Package
Title: Dendrograms for Evolutionary Analysis
Version: 1.0.0
Version: 1.0.1
Authors@R: person("Shaun", "Wilkinson", role = c("aut", "cre"),
email = "shaunpwilkinson@gmail.com")
Author: Shaun Wilkinson [aut, cre]
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# phylogram 1.0.0
Submitted to CRAN 2017-06-12.
Released on CRAN 2017-06-12.
31 changes: 10 additions & 21 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
## Resubmission
Resubmitted to CRAN 2017-06-12 1600. Modifications made include:
This is a patch release addressing a solaris build error discovered by Prof. Ripley:
`error: call of overloaded ‘pow(int, int&)’ is ambiguous`
The patch replaces C++ calls to 'pow' with recursive multiplication.

* Removed non-standard hidden files.
## Test environments
* local ubuntu 16.04 x86_64-pc-linux-gnu; R version 3.4.0
* travis-ci ubuntu 12.04.5 x86_64-pc-linux-gnu; R 3.4.0

* Rectified capital case in title.
## R CMD check results
There were no ERRORs, WARNINGs, or NOTEs

* Fixed spelling in DESCRIPTION (apart from 'Dendrograms' which is necessary in title).

* Removed namespace declarations for 'utils' and 'graphics'.

* Changed R project URL to canonical form in vignette.

* Fixed spelling errors in vignette.


## Resubmission
Resubmitted to CRAN 2017-06-12 1300. In this version I have:

* Added Author field to the DESCRIPTION file.


## Original Submission
Submitted to CRAN 2017-06-12.
## Downstream dependencies
There were no problems
16 changes: 11 additions & 5 deletions src/distance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,23 @@ using namespace Rcpp;
NumericMatrix kcountDNA(List x, int k = 5){
CharacterVector nms = x.attr("names");
int nseq = x.size();
double fourtopowerk = pow(4, k);
//double fourtopowerk = pow(4, k); // caused build error on solaris
int(fourtopowerk) = 1;
for(int i = 0; i < k; i++) fourtopowerk *= 4;
NumericMatrix tuplemat(nseq, fourtopowerk);
tuplemat.attr("dimnames") = List::create(nms, CharacterVector(fourtopowerk));
RawVector tmp = RawVector::create(4, 55, 0, 136, 72, 199, 40, 24,
224, 176, 208, 112, 240, 8, 160,
144, 96, 80);
IntegerVector rsak(k); //reversed seq along k
int counter = 0;
for(int l = k - 1; l >= 0; l--) {
rsak[l] = pow(4, counter);
counter++;
// following changes made in 1.0.1 to prevent build error on solaris
rsak[k - 1] = 1;
//int counter = 0;
//for(int l = k - 1; l >= 0; l--){
for(int l = k - 2; l >= 0; l--){
rsak[l] = rsak[l + 1] * 4;
//rsak[l] = pow(4, counter);
//counter++;
}
IntegerVector seqlens(nseq);
RawVector kmer(k);
Expand Down

0 comments on commit 1b12f9f

Please sign in to comment.