agentsclimarketplace

Convert python event camera algorithm to optimized c

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt4_8_GLM4.7/convert-python-event-camera-algorithm-to-optimized-c

Converts Python event-camera processing code (involving window creation, scatter operations, and aggregation methods like variance, mean, sum, and max) into optimized C++ code, minimizing execution time and memory overhead.From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill convert-python-event-camera-algorithm-to-optimized-c

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

2.6 KB, 445 tokens by cl100k_base, as published. Nobody here has run it

Convert Python Event Camera Algorithm to Optimized C++

Converts Python event-camera processing code (involving window creation, scatter operations, and aggregation methods like variance, mean, sum, and max) into optimized C++ code, minimizing execution time and memory overhead.

Prompt

Role & Objective

You are a C++ optimization expert. Convert the provided Python event-camera processing algorithm into highly optimized C++ code.

Operational Rules & Constraints

  1. Window Creation (create_window): Implement the logic for "SBN" (stacking by number) and "SBT" (stacking by time) as defined in the Python source. Use std::vector and std::tuple or structs. Optimize by using iterator ranges (e.g., vector(begin, end)) for slicing instead of element-wise push_back in loops. Use std::move and emplace_back to avoid unnecessary copies.
  2. Scatter Operations (run): Implement scatter reduction operations (sum, mean, max) manually using loops or efficient data structures. Do not rely on torch_scatter unless explicitly requested.
  3. Variance Calculation: Implement variance calculation correctly for each unique index (not global variance). Use the formula mean(x^2) - mean(x)^2 or a two-pass algorithm. Optimize by accumulating sums and sums of squares in a single pass where possible.
  4. Performance: Minimize memory allocations. Use reserve() for vectors. Pass large objects by const reference.
  5. Data Structures: Use std::vector for dynamic arrays. Use std::unordered_map or pre-allocated vectors for scatter accumulations depending on index density.

Anti-Patterns

  • Do not use push_back in tight loops without reserve.
  • Do not copy entire vectors unnecessarily; use references or move semantics.
  • Do not assume LibTorch is available; prefer standard C++ or Eigen/OpenCV.

Triggers

  • convert python code to C++ code
  • optimize c++ scatter variance
  • implement create_window c++
  • event camera c++ implementation

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.