blob: c2f03f02d1aea1191704f14b9a217d5b459f1a91 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ftm_vecdot.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/05/09 21:06:09 by charles #+# #+# */
/* Updated: 2020/05/11 12:48:12 by charles ### ########.fr */
/* */
/* ************************************************************************** */
#include "libftm_vec.h"
float ftm_vecdot(t_ftmvec *a, t_ftmvec *b)
{
size_t i;
float total;
if (a->size != b->size)
return (0.0);
total = 0.0;
i = 0;
while (i < a->size)
{
total += a->v[i] * b->v[i];
i++;
}
return (total);
}
|