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

PSO variable type buglet #123

Closed
coatless opened this issue Aug 9, 2019 · 6 comments
Closed

PSO variable type buglet #123

coatless opened this issue Aug 9, 2019 · 6 comments

Comments

@coatless
Copy link
Contributor

coatless commented Aug 9, 2019

Issue description

Mismatch on return types in PSO

../inst/include/ensmallen_bits/pso/pso.hpp: In member function ‘size_t ens::PSOType<VelocityUpdatePolicy, InitPolicy>::LowerBound() const’:
../inst/include/ensmallen_bits/pso/pso.hpp:162:38: error: cannot convert ‘const vec’ {aka ‘const arma::Col<double>’} to ‘size_t’ {aka ‘long unsigned int’} in return
  162 |   size_t LowerBound() const { return lowerBound; }
      |                                      ^~~~~~~~~~

Defined as arma::vec:

//! Lower bound of the initial swarm.
arma::vec lowerBound;
//! Upper bound of the initial swarm.
arma::vec upperBound;

But returning size_t:

//! Retrieve value of lowerBound.
size_t LowerBound() const { return lowerBound; }
//! Modify value of lowerBound.
size_t& LowerBound() { return lowerBound; }
//! Retrieve value of upperBound.
size_t UpperBound() const { return upperBound; }
//! Modify value of upperBound.
size_t& UpperBound() { return upperBound; }

Your environment

  • version of ensmallen: 1.16.0
  • operating system: debian
  • compiler: gcc-9
  • version of Armadillo: 9.600
@zoq
Copy link
Member

zoq commented Aug 9, 2019

Thanks for the report, should be fixed in #124, I will put some time into the test setup, so that we can avoid such issues in the future.

@zoq zoq removed the s: unanswered label Aug 9, 2019
coatless added a commit to coatless-rpkg/rcppensmallen that referenced this issue Aug 9, 2019
@rcurtin
Copy link
Member

rcurtin commented Aug 11, 2019

Fixed in #124. Thanks for the report. 👍

@rcurtin
Copy link
Member

rcurtin commented Aug 11, 2019

Ah, I discovered that #126 will also be necessary here.

@rcurtin rcurtin reopened this Aug 11, 2019
@coatless
Copy link
Contributor Author

@rcurtin sorry about that. I should have grabbed the entire log. :/

coatless added a commit to coatless-rpkg/rcppensmallen that referenced this issue Aug 29, 2019
* Upgrade to ensmallen 1.16.0

* Bump package version

* Add new release notes

* Bump cran comments

* Address return type issue identified in mlpack/ensmallen#123

* Ensure const reference

* Fix another type return mlpack/ensmallen#126
@mlpack-bot
Copy link

mlpack-bot bot commented Sep 10, 2019

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions! 👍

@mlpack-bot mlpack-bot bot added the s: stale label Sep 10, 2019
@coatless
Copy link
Contributor Author

Closed in #126 and #123

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants