Qianyv-Li8262/GR-Tensors ? reverse-engineered prompt

Reverse engineered prompt

Build me a small header only C++ library for doing general relativity tensor math at compile time.

I want it to let me define tensors with different index positions, do contractions, addition and multiplication, and work with symmetric and antisymmetric tensors. It should also support basic differential forms and a simple way to represent fields and numerical derivatives.

Please keep it lightweight and fast, with as much checking as possible done at compile time so there is no extra runtime overhead from searching or handling indices. Make it feel like a clean reusable utility that I can include in another project and use for tensor calculations in a GR setting.

If you need to, look up current C++ template techniques and best practices online. Then organize the code cleanly and make sure the main header pulls everything together in an easy way.

Are you gonna build this?

make sure you review the code using coderabbit

Try freeSponsored — opens CodeRabbit in a new tab