Skip to content

Commit

Permalink
compiling with -std=c++11 -- various warnings fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
bayesiancook committed Oct 7, 2020
1 parent dca7bdf commit fbd6393
Show file tree
Hide file tree
Showing 19 changed files with 29 additions and 86 deletions.
7 changes: 1 addition & 6 deletions sources/AACodonMutSelFinitePhyloProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ void AACodonMutSelFinitePhyloProcess::ReadPB(int argc, char* argv[]) {
// 3 : compositional statistic

int cv = 0;
int sel = 0;
int map = 0;
int mapstats = 0;
string testdatafile = "";
Expand All @@ -267,10 +266,7 @@ void AACodonMutSelFinitePhyloProcess::ReadPB(int argc, char* argv[]) {
int i = 1;
while (i < argc) {
string s = argv[i];
if (s == "-sel") {
sel = 1;
}
else if (s == "-cv") {
if (s == "-cv") {
cv = 1;
i++;
testdatafile = argv[i];
Expand Down Expand Up @@ -441,7 +437,6 @@ void AACodonMutSelFinitePhyloProcess::ReadMapStats(string name, int burnin, int
FromStream(is);
i++;

MPI_Status stat;
MESSAGE signal = BCAST_TREE;
MPI_Bcast(&signal,1,MPI_INT,0,MPI_COMM_WORLD);
GlobalBroadcastTree();
Expand Down
7 changes: 1 addition & 6 deletions sources/AACodonMutSelSBDPPhyloProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ void AACodonMutSelSBDPPhyloProcess::ReadPB(int argc, char* argv[]) {
// 3 : compositional statistic

int cv = 0;
int sel = 0;
int map = 0;
int mapstats = 0;
string testdatafile = "";
Expand All @@ -286,10 +285,7 @@ void AACodonMutSelSBDPPhyloProcess::ReadPB(int argc, char* argv[]) {
int i = 1;
while (i < argc) {
string s = argv[i];
if (s == "-sel") {
sel = 1;
}
else if (s == "-cv") {
if (s == "-cv") {
cv = 1;
i++;
testdatafile = argv[i];
Expand Down Expand Up @@ -460,7 +456,6 @@ void AACodonMutSelSBDPPhyloProcess::ReadMapStats(string name, int burnin, int ev
FromStream(is);
i++;

MPI_Status stat;
MESSAGE signal = BCAST_TREE;
MPI_Bcast(&signal,1,MPI_INT,0,MPI_COMM_WORLD);
GlobalBroadcastTree();
Expand Down
8 changes: 1 addition & 7 deletions sources/CodonMutSelFinitePhyloProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ void CodonMutSelFinitePhyloProcess::SlaveUpdateParameters() {
int i,j,L1,L2,ni,nd,nbranch = GetNbranch(),nnucrr = GetNnucrr(),nnucstat = 4;
L1 = GetNmodeMax();
L2 = GetDim();
int nstate = data->GetNstate();
nd = 2+ nbranch + nnucrr + nnucstat + L2 + L1*(L2+1); // check if these last terms are correct in this context...
ni = 1 + ProfileProcess::GetNsite();
int* ivector = new int[ni];
Expand Down Expand Up @@ -117,7 +116,6 @@ void CodonMutSelFinitePhyloProcess::GlobalUpdateParameters() {
nnucstat = 4;
L1 = GetNmodeMax();
L2 = GetDim();
int nstate = data->GetNstate();
nd = 2 + nbranch + nnucrr + nnucstat + L2 + L1*(L2+1); // check if these last terms are correct in this context...
ni = 1 + ProfileProcess::GetNsite(); // 1 for the number of componenets, and the rest for allocations
int ivector[ni];
Expand Down Expand Up @@ -182,7 +180,6 @@ void CodonMutSelFinitePhyloProcess::ReadPB(int argc, char* argv[]) {
// 3 : compositional statistic

int cv = 0;
int sel = 0;
int map = 0;
string testdatafile = "";
int rateprior = 0;
Expand All @@ -203,10 +200,7 @@ void CodonMutSelFinitePhyloProcess::ReadPB(int argc, char* argv[]) {
int i = 1;
while (i < argc) {
string s = argv[i];
if (s == "-sel") {
sel = 1;
}
else if (s == "-cv") {
if (s == "-cv") {
cv = 1;
i++;
testdatafile = argv[i];
Expand Down
6 changes: 1 addition & 5 deletions sources/CodonMutSelSBDPPhyloProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ void CodonMutSelSBDPPhyloProcess::ReadPB(int argc, char* argv[]) {
// 3 : compositional statistic

int cv = 0;
int sel = 0;
int map = 0;
string testdatafile = "";
int rateprior = 0;
Expand All @@ -212,10 +211,7 @@ void CodonMutSelSBDPPhyloProcess::ReadPB(int argc, char* argv[]) {
int i = 1;
while (i < argc) {
string s = argv[i];
if (s == "-sel") {
sel = 1;
}
else if (s == "-cv") {
if (s == "-cv") {
cv = 1;
i++;
testdatafile = argv[i];
Expand Down
2 changes: 1 addition & 1 deletion sources/CodonSubMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ class AACodonMutSelProfileSubMatrix : public CodonSubMatrix {
void ComputeArray(int state);
void ComputeStationary();
double GetRate();
double* aaprofile;
double* codonprofile;
double* aaprofile;
double* omega;
};

Expand Down
6 changes: 2 additions & 4 deletions sources/DPProfileProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ double DPProfileProcess::LogHyperPrior() {
else {
total = -log(kappa);
if ((kappa < 1e-4) || (kappa > 1e4)) {
// total = InfProb;
total -= 1.0 / 0;
total = -std::numeric_limits<double>::infinity();
}
}
double sum = 0;
Expand All @@ -123,8 +122,7 @@ double DPProfileProcess::LogHyperPrior() {
sum += dirweight[k];
}
if (sum < GetMinTotWeight()) {
// total += InfProb;
total -= 1.0 / 0;
total = -std::numeric_limits<double>::infinity();
}
return total;
}
Expand Down
5 changes: 2 additions & 3 deletions sources/FiniteProfileProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,15 @@ double FiniteProfileProcess::LogHyperPrior() {
sum += dirweight[k];
}
if (sum < GetMinTotWeight()) {
// total += InfProb;
total -= 1.0 / 0;
total = -std::numeric_limits<double>::infinity();
}
total -= weightalpha;
return total;
}

double FiniteProfileProcess::MoveHyper(double tuning, int nrep) {
double total = 0;
if ((Ncomponent > 1) || (! fixncomp) && (! dirweightprior)) {
if ((Ncomponent > 1) || ((! fixncomp) && (! dirweightprior))) {
total += MoveDirWeights(tuning,nrep);
}
return total;
Expand Down
11 changes: 6 additions & 5 deletions sources/FiniteProfileProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,16 @@ class FiniteProfileProcess: public virtual MixtureProfileProcess {
bool fixncomp;
bool empmix;

int dirweightprior;
// 0 : flexible
// 1 : rigid

int Ncat;

string mixtype;
double** statfix;
double* empweight;

string mixtype;
int dirweightprior;
// 0 : flexible
// 1 : rigid

};

#endif
Expand Down
5 changes: 3 additions & 2 deletions sources/GammaBranchProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ double GammaBranchProcess::LogHyperPrior() {
if (betaprior == 1) {
total -= log(branchbeta);
if ((branchbeta < 1e-4) || (branchbeta > 1e4)) {
total -= 1.0 / 0;
// total = InfProb;
total = -std::numeric_limits<double>::infinity();
// total -= 1.0 / 0;
}
}
else {
Expand Down Expand Up @@ -152,5 +152,6 @@ double GammaBranchProcess::NonMPIMoveLength() {
double GammaBranchProcess::NonMPIMove(double tuning, int nrep) {
NonMPIMoveLength();
MoveBranchBeta(tuning,nrep);
return 1.0;
}

2 changes: 1 addition & 1 deletion sources/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CC=mpic++
CPPFLAGS= -w -O3 -c
CPPFLAGS= -Wall -O3 -std=c++11
LDFLAGS= -O3
SRCS= TaxonSet.cpp Tree.cpp Random.cpp SequenceAlignment.cpp CodonSequenceAlignment.cpp \
StateSpace.cpp CodonStateSpace.cpp ZippedSequenceAlignment.cpp SubMatrix.cpp \
Expand Down
3 changes: 0 additions & 3 deletions sources/NNI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,7 @@ double PhyloProcess::SendRandomBranches(Link* from, double tuning, Link**& branc

void PhyloProcess::SlaveNNI(Link* from, int n){


MPI_Status stat;
Link* up = from->Next();

int* br;
double* m;
if(n){
Expand Down
2 changes: 0 additions & 2 deletions sources/PBTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ void PBTree::Clone(PolyNode* node, PolyNode* fromNode) {
node->down = first;
Clone(first, fromfirst);

PolyNode* fromcurrent = fromfirst;
PolyNode* fromnext = fromfirst->next;
PolyNode* thiscurrent = first;

Expand All @@ -176,7 +175,6 @@ void PBTree::Clone(PolyNode* node, PolyNode* fromNode) {
thiscurrent->next = thisnext;
Clone(thisnext, fromnext);
thiscurrent = thisnext;
fromcurrent = fromnext;
fromnext = fromnext->next;
}
thiscurrent->next = first;
Expand Down
16 changes: 6 additions & 10 deletions sources/PhyloProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,8 @@ void PhyloProcess::RecursiveGibbsSPRScan(Link* from, Link* fromup, Link* down, L
}
loglarray[n] = logl;
n++;
Link* tmp1 = GetTree()->Detach(down,up);
GetTree()->Detach(down,up);
// Link* tmp1 = GetTree()->Detach(down,up);
}
Link* trailer = from;
for (const Link* link=from->Next(); link!=from; link=link->Next()) {
Expand Down Expand Up @@ -820,7 +821,8 @@ void PhyloProcess::RecursiveNonMPIGibbsSPRScan(Link* from, Link* fromup, Link* d
Propagate(aux,GetConditionalLikelihoodVector(up->Out()),GetLength(up->GetBranch()));
double logl = ComputeNodeLikelihood(up->Out(),0);
loglmap[pair<Link*,Link*>(from,fromup)] = logl;
Link* tmp1 = GetTree()->Detach(down,up);
GetTree()->Detach(down,up);
// Link* tmp1 = GetTree()->Detach(down,up);
}
Link* trailer = from;
for (const Link* link=from->Next(); link!=from; link=link->Next()) {
Expand Down Expand Up @@ -1890,7 +1892,6 @@ void PhyloProcess::SlaveUpdateBranchLengthSuffStat() {

void PhyloProcess::GlobalUpdateSiteRateSuffStat() {

MPI_Status stat;
MESSAGE signal = UPDATE_SRATE;
MPI_Bcast(&signal,1,MPI_INT,0,MPI_COMM_WORLD);
}
Expand All @@ -1913,7 +1914,7 @@ void PhyloProcess::GlobalGetMeanSiteRate() {
}

assert(myid == 0);
int i,width,smin[nprocs-1],smax[nprocs-1],workload[nprocs-1];
int i,width,smin[nprocs-1],smax[nprocs-1];
MPI_Status stat;
MESSAGE signal = SITERATE;

Expand Down Expand Up @@ -2101,7 +2102,6 @@ void PhyloProcess::AllPostPred(string name, int burnin, int every, int until, in
}

double* obstaxstat = new double[GetNtaxa()];
SequenceAlignment* datacopy = new SequenceAlignment(GetData());
int nstat = 5;
double obsarray[nstat];
obsarray[0] = data->GetMeanDiversity();
Expand All @@ -2121,7 +2121,7 @@ void PhyloProcess::AllPostPred(string name, int burnin, int every, int until, in
double meanstatarray[nstat];
double varstatarray[nstat];
double ppstatarray[nstat];
for (int k=0; k<6; k++) {
for (int k=0; k<nstat; k++) {
meanstatarray[k] = 0;
varstatarray[k] = 0;
ppstatarray[k] = 0;
Expand Down Expand Up @@ -2261,7 +2261,6 @@ void PhyloProcess::PostPred(int ppredtype, string name, int burnin, int every, i
}

double* obstaxstat = new double[GetNtaxa()];
SequenceAlignment* datacopy = new SequenceAlignment(GetData());
double obs = 0;
double obs2 = 0;
if (ppredtype == 2) {
Expand Down Expand Up @@ -2613,7 +2612,6 @@ void PhyloProcess::ReadAncestral(string name, int burnin, int every, int until)
MESSAGE signal = STATEPOSTPROBS;
MPI_Bcast(&signal,1,MPI_INT,0,MPI_COMM_WORLD);

double total = 0;
for(int proc=1; proc<GetNprocs(); proc++) {
MPI_Recv(allocstatepostprob+smin[proc-1]*GetNnode()*GetGlobalNstate(),(smax[proc-1]-smin[proc-1])*GetNnode()*GetGlobalNstate(),MPI_DOUBLE,proc,TAG1,MPI_COMM_WORLD,&stat);
for (int i=smin[proc-1]; i<smax[proc-1]; i++) {
Expand Down Expand Up @@ -2998,7 +2996,6 @@ void PhyloProcess::ReadMap(string name, int burnin, int every, int until){
ofstream sos(s.str().c_str());

// quick update and mapping on the fly
MPI_Status stat;
MESSAGE signal = BCAST_TREE;
MPI_Bcast(&signal,1,MPI_INT,0,MPI_COMM_WORLD);
GlobalBroadcastTree();
Expand Down Expand Up @@ -3066,7 +3063,6 @@ void PhyloProcess::ReadMap(string name, int burnin, int every, int until){
}

void PhyloProcess::GlobalWriteMappings(string name){
MPI_Status stat;
MESSAGE signal = WRITE_MAPPING;
MPI_Bcast(&signal,1,MPI_INT,0,MPI_COMM_WORLD);

Expand Down
1 change: 0 additions & 1 deletion sources/PhyloProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ class PhyloProcess : public virtual SubstitutionProcess, public virtual BranchPr

virtual void QuickUpdate() {

MPI_Status stat;
MESSAGE signal = BCAST_TREE;
MPI_Bcast(&signal,1,MPI_INT,0,MPI_COMM_WORLD);
GlobalBroadcastTree();
Expand Down
1 change: 0 additions & 1 deletion sources/RASCATGTRFiniteGammaPhyloProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,6 @@ void RASCATGTRFiniteGammaPhyloProcess::SlaveComputeSiteLogL() {
}
}
double tot = 0;
double totweight = 0;
for (int k=0; k<GetNcomponent(); k++) {
tot += weight[k] * exp(sitelogl[i][k] - max);
cumul[k] = tot;
Expand Down
1 change: 0 additions & 1 deletion sources/RASCATGTRSBDPGammaPhyloProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ void RASCATGTRSBDPGammaPhyloProcess::ReadPB(int argc, char* argv[]) {
// 3 : compositional statistic

int ss = 0;
int nocc = 0;
int cv = 0;
int sitelogl = 0;
int rr = 0;
Expand Down
8 changes: 4 additions & 4 deletions sources/SequenceAlignment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ int FileSequenceAlignment::ReadNexus(string filespec) {
}
delete[] Data;
}
Data = new (int *[Ntaxa]);
Data = new int*[Ntaxa];
for (int i=0; i<Ntaxa; i++) {
Data[i] = new int[Nsite];
}
Expand Down Expand Up @@ -411,7 +411,7 @@ int FileSequenceAlignment::ReadSpecial(string filespec) {

statespace = new SimpleStateSpace(Nstate, NAlphabetSet, Alphabet, AlphabetSet);

Data = new (int *[Ntaxa]);
Data = new int *[Ntaxa];
for (int i=0; i<Ntaxa; i++) {
Data[i] = new int[Nsite];
}
Expand Down Expand Up @@ -637,7 +637,7 @@ void FileSequenceAlignment::ReadPhylipSequential (string filespec) {
}
Nsite = Int(temp);

Data = new (int *[Ntaxa]);
Data = new int *[Ntaxa];
for (int i=0; i<Ntaxa; i++) {
Data[i] = new int[Nsite];
}
Expand Down Expand Up @@ -877,7 +877,7 @@ FileSequenceAlignment::ReadPhylip (string filespec, int repeattaxa) {
Nsite = Int(temp);
// cerr << Ntaxa << '\t' << Nsite << '\n';

Data = new (int *[Ntaxa]);
Data = new int *[Ntaxa];
for (int i=0; i<Ntaxa; i++) {
Data[i] = new int[Nsite];
}
Expand Down
Loading

0 comments on commit fbd6393

Please sign in to comment.