Skip to content

Commit

Permalink
fix warning: -Wdelete-non-virtual-dtor
Browse files Browse the repository at this point in the history
  • Loading branch information
lantian2012 committed May 8, 2015
1 parent 1cbed6a commit 46d8165
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/sgd_family.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ struct Sgd_Family_Base
Rcpp::Rcout << "Family object released" << std::endl;
}
#endif
virtual ~Sgd_Family_Base() {}

virtual double bfunc_for_score(double h) const = 0;
virtual double variance(double u) const = 0;
Expand Down
7 changes: 4 additions & 3 deletions src/sgd_learningrate.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct Sgd_Learn_Rate_Base
Rcpp::Rcout << "Learning rate object released" << std::endl;
}
#endif

virtual ~Sgd_Learn_Rate_Base() {}
virtual mat learning_rate(const mat& theta_old, const Sgd_DataPoint& data_pt, double offset,
unsigned t, unsigned p) = 0;
};
Expand All @@ -38,6 +38,7 @@ struct Sgd_Unidim_Learn_Rate : public Sgd_Learn_Rate_Base
mat lr_mat = mat(p, p, fill::eye) * lr;
return lr_mat;
}

private:
double gamma;
double alpha;
Expand Down Expand Up @@ -84,7 +85,6 @@ struct Sgd_Pdim_Learn_Rate : public Sgd_Learn_Rate_Base
Idiag_inv.at(i, i) = 1. / Idiag.at(i, i);
}
}

return Idiag_inv;
}

Expand All @@ -110,10 +110,10 @@ struct Sgd_Pdim_Weighted_Learn_Rate : public Sgd_Learn_Rate_Base
Idiag_inv.at(i, i) = 1. / Idiag.at(i, i) / t;
}
}

return Idiag_inv;
}


private:
mat Idiag;
double alpha;
Expand Down Expand Up @@ -141,6 +141,7 @@ struct Sgd_AdaGrad_Learn_Rate : public Sgd_Learn_Rate_Base
return Idiag_inv;
}


private:
mat Idiag;
double c;
Expand Down
1 change: 1 addition & 0 deletions src/sgd_transfer.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ struct Sgd_Transfer_Base {
Rcpp::Rcout << "Transfer object released! " << std::endl;
}
#endif
virtual ~Sgd_Transfer_Base() {}

virtual double transfer(double u) const = 0;

Expand Down

0 comments on commit 46d8165

Please sign in to comment.