Skip to content
Back to skills

Convert Python Event Camera Algorithm To Optimized C

ASecurity

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.

  • 611 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added November 11, 2026
educationpythongoc++performance

Security analysis

A100/100

Scanned November 11, 2026

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

Installs into .claude/skills of the current project.

Are you the author of Convert Python Event Camera Algorithm To Optimized C?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Convert Python Event Camera Algorithm To Optimized C
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-convert-python-event-camera-algorithm-to-optimized/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-convert-python-event-camera-algorithm-to-optimized)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "48c5f19f-7c43-4595-8d46-f06e5c75d301"
name: "Convert Python Event Camera Algorithm to Optimized C++"
description: "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."
version: "0.1.0"
tags:
  - "C++"
  - "Event Camera"
  - "Optimization"
  - "Code Conversion"
  - "Algorithm Implementation"
triggers:
  - "convert python code to C++ code"
  - "optimize c++ scatter variance"
  - "implement create_window c++"
  - "event camera c++ implementation"
---

# 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

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in education →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.