Skip to content

Instantly share code, notes, and snippets.

View bluescarni's full-sized avatar

Francesco Biscani bluescarni

  • European Space Agency
  • Germany
View GitHub Profile
Timer unit: 1e-06 s
Total time: 130.51 s
File: /home/biscani/.local/lib/python2.7/site-packages/reproject-0.0.dev97-py2.7-linux-x86_64.egg/reproject/spherical_intersect/reproject.py
Function: reproject_celestial at line 59
Line # Hits Time Per Hit % Time Line Contents
==============================================================
59 @profile
60 def reproject_celestial(array, wcs_in, wcs_out, shape_out, method = "default", nproc = None):
namespace std
{
template <>
struct hash<std::pair<unsigned long long,piranha::integer>>
{
typedef size_t result_type;
typedef std::pair<unsigned long long,piranha::integer> argument_type;
result_type operator()(const argument_type &p) const
{
return std::hash<unsigned long long>()(p.first));
struct term_comparator
{
template <typename T>
bool operator()(const T &p1, const T &p2) const noexcept
{
return p1.first == p2.first;
}
};
// This is the full definition of the hash set.
auto s = C.evaluate_sparsity();
for (const auto &p: s) {
std::cout << p.first << ',' << p.second << '\n';
}
0,11478
1,3625
2,1196
3,85
using ka = kronecker_array<long long>;
std::vector<int> foo{1,2,3,4,5};
std::cout << ka::encode(foo) << '\n';
std::vector<int> out(5u);
ka::decode(out,ka::encode(foo));
struct my_pair
{
unsigned long long first;
mutable piranha::integer second;
};
my_pair temp;
for (auto &a: A) {
for (auto &b: B) {
temp.first = a.first + b.first;
auto it = C.find(temp);
if (it == C.end()) {
temp.second = a.second * b.second;
C.insert(temp);
} else {
it->second += a.second * b.second;
const hash_set::iterator begin = B.begin(), end = B.end();
for (auto &a: A) {
for (hash_set::iterator it = begin; it != end; ++it) {
temp.first = a.first + it->first;
size_t bucket = C._bucket(temp);
auto it = C._find(temp, bucket);
if (it == C.end()) {
// Check it the load factor of C is too large.
if ((double(C.size()) + 1) / C.bucket_count() > C.max_load_factor()) {
// Increase the size of the table.
In [26]: g.write(f)
---------------------------------------------------------------------------
OverflowError Traceback (most recent call last)
<ipython-input-26-9261ff4722c5> in <module>()
----> 1 g.write(f)
/home/yardbird/.local/lib64/python2.7/site-packages/hyperion/grid/voronoi_grid.pyc in write(self, group, quantities, copy, absolute_paths, compression, wall_dtype, physics_dtype)
460 # Write the tables.
461 voronoi_table.write(g_geometry, path='cells', compression=True)
--> 462 g_geometry.create_dataset('sparse_neighs', self._st[0], compression=True, dtype=np.int32)