Mungojerrie
1.1
Mungojerrie
|
Utility functions. More...
#include <vector>
#include <set>
#include <string>
#include <iostream>
#include <sstream>
#include <random>
#include <boost/random.hpp>
#include <boost/functional/hash.hpp>
#include <chrono>
#include <functional>
#include "cuddObj.hh"
#include "State.hh"
Go to the source code of this file.
Classes | |
class | Util::BddCompare |
Class that defines a comparison operator for the BDD class. More... | |
class | Util::PairWithBddCompare< T > |
Class that defines a comparison operator for pairs with BDDs. More... | |
class | Util::PairHash< T1, T2 > |
Class that defines a hash function for pairs. More... | |
Namespaces | |
Util | |
Namespace of utilities. | |
Typedefs | |
using | Util::RandomEngine = std::mt19937 |
Functions | |
void | Util::replace (std::string &str, std::string const &from, std::string const &to) |
Replace first occurrence of "from" in "str" with "to.". | |
void | Util::replaceAll (std::string &str, std::string const &from, std::string const &to) |
Replace all occurrences of "from" in "str" with "to.". | |
char ** | Util::cStringArrayAlloc (std::vector< std::string > const &sv) |
Copy a vector of C++ strings to an array of C strings. | |
void | Util::cStringArrayFree (char **sa, size_t n) |
Dispose of an array of C strings. | |
template<typename T > | |
std::string | Util::to_string (T const &num) |
Replacement for std::to_string since cygwin does not have it. | |
template<typename T , typename Comp > | |
std::vector< std::set< T, Comp > > | Util::mapToPartition (std::map< T, unsigned, Comp > const &m) |
Converts a partition map to a vector of sets. | |
RandomEngine & | Util::urng () |
Returns reference to uniform random number generator. | |
void | Util::seed_urng () |
Seeds the uniform random number generator. | |
void | Util::seed_urng (unsigned seed) |
Seeds the uniform random number generator. | |
unsigned int | Util::get_urng_seed () |
Return the seed for the uniform random number generator. | |
template<typename Iterator > | |
std::iterator_traits< Iterator >::value_type | Util::sample_discrete_distribution (Iterator first, Iterator last) |
Returns a sample from the discrete distribution defined by the iterators. | |
int | Util::sample_discrete_distribution (std::vector< double > const &weights) |
Returns a sample from discrete distribution defined by weights. | |
template<typename IntType > | |
IntType | Util::sample_uniform_distribution (IntType low, IntType hi) |
Returns a sample from a uniform integer distribution. | |
chrono::time_point< chrono::system_clock > | Util::stopwatch () |
Records a reference time. | |
void | Util::printElapsedTag (std::ostream &os=std::cout) |
Prints tag with elapsed time in seconds. | |
double | Util::getElapsedTime () |
Returns the elapsed time in seconds. | |
const char * | Util::to_decimal (int number) |
Converts an int to an array of characters in base 10. | |
bool | Util::is_prefix (std::string const &str, std::string const &pre) |
Returns true if pre is a prefix of str. | |
Utility functions.
Copyright (c) 2021, Regents of the University of Colorado
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the University of Colorado nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.