Code Monkey home page Code Monkey logo

priorityqueue-mex-matlab's Introduction

PriorityQueue-MEX-Matlab

This a mexified MATLAB wrapper of C++ STL priority queue

This priority queue implementation is simple. Nevertheless, it can be used to keep a "sorted" list of arbitrary objects. Instead of pushing the entire object, we can push only its index. This is done by first storing the objects in MATLAB as you normally would. Then, you can push the index and its priority into the priority queue. When you take an element off the priority queue, you can use the index to find the object. This way, the priority queue given here is quite general.

This implementation keeps the priority queue sorted in descending order. In other words, calling the top_value function returns the largest priority value. You can easily make it operate in ascending order by supplying negative priorities.

Credits

I am grateful to the authors of the following packages:

  1. Example MATLAB class wrapper for a C++ class by Oliver Woodford https://www.mathworks.com/matlabcentral/fileexchange/38964-example-matlab-class-wrapper-for-a-c-class

  2. C++ STL library

Usage

  1. Download or clone this repository to a folder.
  2. Run "run_me.m"
  3. Star this repository if you found this useful

Some tips

  1. You need to have set a MEX compiler for this to work
  2. This was tested in MATLAB 2018b. But, it should work for any recent version of MATLAB.

Author

Pradeep Rajendran

License

Copyright © 2019 Pradeep Rajendran Released under the GNU General Public License.

priorityqueue-mex-matlab's People

Contributors

pradeepr-roboticist avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.