# Use case: An FFT in C

If you want to follow this example by doing it yourself, before following this use case do the following:

* Clone the FFT library:

  ```bash
  git clone https://github.com/muditbhargava66/FFT-implementation-in-C
  ```

### Create configuration file

{% hint style="info" %}
If you installed WedoLow VSCode extension, run command `WedoLow: Setup project` to help you create the configuration file using a form.
{% endhint %}

This configuration should be written in a file named <mark style="color:$primary;">wedolow\_mcp\_project\_config.json</mark> at the project root. Jump at the end of this section to copy the content of this file if you'd like faster:

* Build command:

  ```bash
  make
  ```
* Clean command:

  ```bash
  make clean 
  ```
* Test command:

  ```bash
  make test
  ```
* Benchmark command:

  ```bash
  make benchmark
  ```
* Top Function

  ```json
   "top_function": {
          "name": "radix2_dit_fft",
          "file": "algorithms/core/radix2_dit.c"
      }
  ```
* Target Platform

  ```json
  "target_platform": "native"
  ```
* Optimization techniques:&#x20;

  * For this example we select an arbitrary set of optimization techniques

  ```json
  "optim_techniques": {
          "math-libc-options": "false",
          "const-volatile": "false",
          "track-cast": "true",
          "libm-function-tracking": "true",
          "vector-reserve" : "false",
          "divide-hunter" : "true",
          "function-factorization" : "true",
          "copy-hunter" : "false",
          "branch-reordering" : "false",
          "memory-operations" : "true",
          "simd-external-functions" : "false",
          "simd-data-dependencies" : "true",
          "enum-switch" : "false",
          "nested-container-operations" : "false",
          "simd-control-flow" : "false",
          "rtti-remove-dynamic_cast" : "false",
          "aos-to-soa" : "false",
          "memory-access-optimization" : "true",
          "double-to-float": "false",
          "redundant-hash-calculations" : "false",
          "string-operations" : "false",
          "push-to-emplace-back" : "false"
      }
  ```

  * Every technique is activated by default so we could also write just this:

  ```json
  "optim_techniques": {
          "math-libc-options": "false",
          "const-volatile": "false",
          "vector-reserve" : "false",
          "copy-hunter" : "false",
          "branch-reordering" : "false",
          "simd-external-functions" : "false",
          "enum-switch" : "false",
          "nested-container-operations" : "false",
          "simd-control-flow" : "false",
          "rtti-remove-dynamic_cast" : "false",
          "aos-to-soa" : "false",
          "double-to-float": "false",
          "redundant-hash-calculations" : "false",
          "string-operations" : "false",
          "push-to-emplace-back" : "false"
      }
  ```

  * If you prefer to activate every optimization just don't fill this field of the config file or set it to null:

  ```json
  "optim_techniques": null
  ```
* Full configuration file

```json
{
  "build_cmd": {
    "cmd": [
      "make"
    ],
    "run_dir": "."
  },
  "clean_cmd": {
    "cmd": [
      "make",
      "clean"
    ],
    "run_dir": "."
  },
  "test_cmd": {
    "cmd": [
      "make",
      "test"
    ],
    "run_dir": "."
  },
  "benchmark_cmd": {
    "cmd": [
      "make",
      "benchmark"
    ],
    "run_dir": "."
  },
  "top_function": {
    "name": "fft",
    "file": "fft/fft.c"
  },
  "target_platform": "native",
  "optim_techniques": {
    "math-libc-options": "false",
    "const-volatile": "false",
    "vector-reserve": "false",
    "copy-hunter": "false",
    "branch-reordering": "false",
    "simd-external-functions": "false",
    "enum-switch": "false",
    "nested-container-operations": "false",
    "simd-control-flow": "false",
    "rtti-remove-dynamic_cast": "false",
    "aos-to-soa": "false",
    "double-to-float": "false",
    "redundant-hash-calculations": "false",
    "string-operations": "false",
    "push-to-emplace-back": "false"
  }
}
```

{% hint style="info" %}
You could also use your AI Agent to generate this file as presented in [Project configuration](/documentation/wedolow-mcp-server/usage/project-configuration.md#generate-your-configuration).
{% endhint %}

***

### Optimize your project!

{% hint style="info" %}
If using VSCode extension, you may just run `/optimize_wedolow` command in the Chat in agent mode.
{% endhint %}

The project is configured now, we're ready to optimize it with the WedoLow MCP Server.

* The simplest part for you, just ask your AI agent to:

> Optimize my project with WedoLow MCP Server. Start with getting the initial instructions.

{% hint style="info" %}
For a flawless experience you can enable the "auto-approve" option that some agents may suggest you.
{% endhint %}

Now, you just have to let the MCP Server do the work, and it'll modify the code directly in your IDE. Let the AI agent interact with the MCP server and your code until your code is fully optimized.

* Finally, you just have to read the <mark style="color:$primary;">wedolow\_optimization\_report.md</mark> which will provide you information on every optimization technique used in the project but also a summary of the global impact on the project.

<figure><img src="/files/pJBsV09HtyD4Ya0sx45q" alt=""><figcaption><p>Example of final agent output for this project - GitHub Copilot + Claude Sonnet 4 in VSCode</p></figcaption></figure>

You can see here the 3 possible decisions for a technique optimization after its analysis.&#x20;

It's either:

* **Successfully applied** if the analysis proves that the code modification better the performance within the tolerance boundaries of the code
* **Non-applicable** if the code is already optimized regarding this technique according to the WedoLow tool or if the es not align with the project's goals or requirements. The analysis shows that either there is no impact or the technique is irrelevant due to constraints or context of the project.
* **Reverted Solution** decision is made if the optimization attempt affects performance, introduces errors, or if the analysis fails. All the changes concerning this technique are then reverted.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wedolow.com/documentation/wedolow-mcp-server/use-case-an-fft-in-c.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
