<commit_before>/* 
 * Quantum++
 *
 * Copyright (c) 2013 - 2014 <NAME> (<EMAIL>)
 *
 * This file is part of Quantum++.
 *
 * Quantum++ is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Quantum++ is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Quantum++.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef INCLUDE_CONSTANTS_H_
#define INCLUDE_CONSTANTS_H_

// constants

namespace qpp
{

/**
* \brief User-defined literal for complex \f$i=\sqrt{-1}\f$ (integer overload)
*
* Example: \code auto z = 4_i; // type of z is std::complex<double> \endcode
*/
constexpr std::complex<double> operator
""

_i(unsigned long long int x)
{
    return
            {0., static_cast<double>(x)};
}

/**
* \brief User-defined literal for complex \f$i=\sqrt{-1}\f$ (real overload)
*
* Example: \code auto z = 4.5_i; // type of z is std::complex<double> \endcode
*/
constexpr std::complex<double> operator
""

_i(long double x)
{
    return
            {0., static_cast<double>(x)};
}

/**
* \brief  Used in qpp::disp() and qpp::displn() for setting to zero
* numbers that have their absolute value smaller than qpp::ct::chop
*/
constexpr double chop = 1e-10;

/**
* \brief Used to decide whether a number or expression in double precision
* is zero or not
*
* Example: \code if(std::abs(x) < qpp::eps) // x is zero \endcode
*/
constexpr double eps = 1e-12;

/**
* \brief Maximum number of qubits
*
* Used internally to allocate arrays on the stack (for speed reasons)
*/
constexpr idx maxn = 64; // maximum number of qudits a state may have

/**
* \brief \f$ \pi \f$
*/
constexpr double pi = 3.141592653589793238462643383279502884;
/**
* \brief Base of natural logarithm, \f$e\f$
*/
constexpr double ee = 2.718281828459045235360287471352662497;

/**
* \brief Used to denote infinity
*/
constexpr idx infty = -1;

/**
* \brief D-th root of unity
*
* \param D Non-negative integer
* \return D-th root of unity \f$\exp(2\pi i/D)\f$
*/
std::complex<double> omega(idx D)
{
    return exp(2.0 * pi * 1_i / static_cast<double>(D));
}

} /* namespace qpp */

#endif	/* INCLUDE_CONSTANTS_H_ */
<commit_msg>minor modifications<commit_after>/* 
 * Quantum++
 *
 * Copyright (c) 2013 - 2014 <NAME> (<EMAIL>)
 *
 * This file is part of Quantum++.
 *
 * Quantum++ is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Quantum++ is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Quantum++.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef INCLUDE_CONSTANTS_H_
#define INCLUDE_CONSTANTS_H_

// constants

namespace qpp
{

/**
* \brief User-defined literal for complex \f$i=\sqrt{-1}\f$ (integer overload)
*
* Example: \code auto z = 4_i; // type of z is std::complex<double> \endcode
*/
constexpr cplx operator
""

_i(unsigned long long int x)
{
    return
            {0., static_cast<double>(x)};
}

/**
* \brief User-defined literal for complex \f$i=\sqrt{-1}\f$ (real overload)
*
* Example: \code auto z = 4.5_i; // type of z is std::complex<double> \endcode
*/
constexpr cplx operator
""

_i(long double x)
{
    return
            {0., static_cast<double>(x)};
}

/**
* \brief  Used in qpp::disp() for setting to zero  numbers
* that have their absolute value smaller than qpp::chop
*/
constexpr double chop = 1e-10;

/**
* \brief Used to decide whether a number or expression in double precision
* is zero or not
*
* Example: \code if(std::abs(x) < qpp::eps) // x is zero \endcode
*/
constexpr double eps = 1e-12;

/**
* \brief Maximum number of qubits
*
* Used internally to allocate arrays on the stack (for speed reasons)
*/
constexpr idx maxn = 64; // maximum number of qudits a state may have

/**
* \brief \f$ \pi \f$
*/
constexpr double pi = 3.141592653589793238462643383279502884;
/**
* \brief Base of natural logarithm, \f$e\f$
*/
constexpr double ee = 2.718281828459045235360287471352662497;

/**
* \brief Used to denote infinity
*/
constexpr idx infty = -1;

/**
* \brief D-th root of unity
*
* \param D Non-negative integer
* \return D-th root of unity \f$\exp(2\pi i/D)\f$
*/
cplx omega(idx D)
{
    return exp(2.0 * pi * 1_i / static_cast<double>(D));
}

} /* namespace qpp */

#endif	/* INCLUDE_CONSTANTS_H_ */

{'fraction_non_alphanumeric': 0.1292503479817061, 'fraction_numerical': 0.040962417975740704, 'mean_word_length': 3.393013100436681, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4780998', 'n_tokens_mistral': 1819, 'n_tokens_neox': 1657, 'n_words': 617}