Skip to content

Instantly share code, notes, and snippets.

@chibi314
Last active September 16, 2021 11:57
Show Gist options
  • Save chibi314/f3cd2ebcf3406016f1f30b3ad0eb0f52 to your computer and use it in GitHub Desktop.
Save chibi314/f3cd2ebcf3406016f1f30b3ad0eb0f52 to your computer and use it in GitHub Desktop.
esp_dsp matrix subtraction
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "dsp_platform.h"
#include "esp_log.h"
#include "esp_dsp.h"
static const char *TAG = "main";
extern "C" void app_main();
void app_main()
{
ESP_LOGI(TAG, "Start Example.");
dspm::Mat A(3, 3);
A(0, 0) = 10;
A(0, 1) = 11;
std::cout << "Matrix A" << std::endl;
std::cout << A;
std::cout << std::endl;
std::cout << "A - I" << std::endl;
std::cout << A - dspm::Mat::eye(3);
std::cout << std::endl;
float data[3] = {0, 0, 0};
float data2[3] = {1, 1, 1};
dsps_sub_f32(data, data2, data, 3, 1, 1, 1);
std::cout << "{0, 0, 0} - {1, 1, 1}" << std::endl;
std::cout << data[0] << " " << data[1] << " " << data[2] << std::endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment