libdspl-2.0
Библиотека алгоритмов цифровой обработки сигналов
matrix_mul.c
1 /*
2 * Copyright (c) 2015-2024 Sergey Bakhurin
3 * Digital Signal Processing Library [http://dsplib.org]
4 *
5 * This file is part of libdspl-2.0.
6 *
7 * is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * DSPL is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
19 */
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include <string.h>
23 #include <float.h>
24 #include "dspl.h"
25 
26 #include "blas.h"
27 
28 
29 
30 #ifdef DOXYGEN_ENGLISH
31 
108 #endif
109 #ifdef DOXYGEN_RUSSIAN
110 
188 #endif
189 int DSPL_API matrix_mul(double* a, int na, int ma,
190  double* b, int nb, int mb,
191  double* c)
192 {
193 
194  double alpha = 1;
195  double beta = 0.0;
196 
197  if(!a || !b || !c)
198  return ERROR_PTR;
199  if(na < 1 || ma < 1 || nb < 1 || mb < 1 || ma != nb)
200  return ERROR_MATRIX_SIZE;
201 
202  /* BLAS DGEMM */
203  dgemm_("N", "N", &na, &mb, &ma, &alpha, a, &na, b, &nb, &beta, c, &na);
204 
205  return RES_OK;
206 }
207 
#define ERROR_PTR
Ошибка указателя. Данная ошибка означает, что один из обязательных указателей (память под который дол...
Definition: dspl.h:610
#define RES_OK
Функция завершилась корректно. Ошибки отсутствуют.
Definition: dspl.h:558
#define ERROR_MATRIX_SIZE
Неверный размер матрицы.
Definition: dspl.h:600
int matrix_mul(double *a, int na, int ma, double *b, int nb, int mb, double *c)
Произведение вещественных матриц.
Definition: matrix_mul.c:189