aboutsummaryrefslogtreecommitdiff
path: root/vendor/libftm/src/vec/ftm_vecdot.c
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-05-11 13:29:51 +0200
committerCharles <sircharlesaze@gmail.com>2020-05-11 13:29:51 +0200
commitd07d87964f13d3c1e6ad8c2f6d7db21101f1ef34 (patch)
tree52dd2e82580eb3c70201991b53a2a2b4c434908b /vendor/libftm/src/vec/ftm_vecdot.c
parent0700a8f567ab733a57fe688e45e5092d3fa1c1a0 (diff)
downloadscop-d07d87964f13d3c1e6ad8c2f6d7db21101f1ef34.tar.gz
scop-d07d87964f13d3c1e6ad8c2f6d7db21101f1ef34.tar.bz2
scop-d07d87964f13d3c1e6ad8c2f6d7db21101f1ef34.zip
libftm matrix, dynamic vector instead of fixed size
Diffstat (limited to 'vendor/libftm/src/vec/ftm_vecdot.c')
-rw-r--r--vendor/libftm/src/vec/ftm_vecdot.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/vendor/libftm/src/vec/ftm_vecdot.c b/vendor/libftm/src/vec/ftm_vecdot.c
new file mode 100644
index 0000000..c2f03f0
--- /dev/null
+++ b/vendor/libftm/src/vec/ftm_vecdot.c
@@ -0,0 +1,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);
+}