ESP-IDF Firmware
Firmware architecture and call graph
Loading...
Searching...
No Matches
dspm_mult_f32_ansi.c
Go to the documentation of this file.
1// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15
16#include "dsps_dotprod.h"
17#include "dspm_mult.h"
18
19// Matrinx A(m,n), m - amount or rows, n - amount of columns
20// C(m,k) = A(m,n)*B(n,k)
21// c(i,j) = sum(a(i,s)*b(s,j)) , s=1..n
22esp_err_t dspm_mult_f32_ansi(const float *A, const float *B, float *C, int m, int n, int k)
23{
24 for (int i = 0 ; i < m ; i++) {
25 for (int j = 0 ; j < k ; j++) {
26 C[i * k + j] = A[i * n] * B[j];
27 for (int s = 1; s < n ; s++) {
28 C[i * k + j] += A[i * n + s] * B[s * k + j];
29 }
30 }
31 }
32 return ESP_OK;
33}
esp_err_t dspm_mult_f32_ansi(const float *A, const float *B, float *C, int m, int n, int k)
Matrix multiplication.
int esp_err_t
Definition esp_err.h:21
#define ESP_OK
Definition esp_err.h:23
float C[4][16]
Definition test_mmult.c:22
const int m
Definition test_mmult.c:16
float B[8][16]
Definition test_mmult.c:21
float A[4][8]
Definition test_mmult.c:20
const int n
Definition test_mmult.c:17
const int k
Definition test_mmult.c:18