diff options
Diffstat (limited to 'vendor/libftm/src/mat/ftm_matmulvec.c')
| -rw-r--r-- | vendor/libftm/src/mat/ftm_matmulvec.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/vendor/libftm/src/mat/ftm_matmulvec.c b/vendor/libftm/src/mat/ftm_matmulvec.c new file mode 100644 index 0000000..48af456 --- /dev/null +++ b/vendor/libftm/src/mat/ftm_matmulvec.c @@ -0,0 +1,37 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ftm_matmulvec.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/05/11 12:56:00 by charles #+# #+# */ +/* Updated: 2020/05/11 13:18:10 by charles ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libftm_mat.h" + +t_ftmvec *ftm_matmulvec(t_ftmmat *mat, t_ftmvec *dst) +{ + size_t i; + t_ftmmat *tmp; + + if ((tmp = ftm_matnew(dst->size, 1)) == NULL) + return (NULL); + i = 0; + while (i < dst->size) + { + tmp->m[i] = dst->v[i]; + i++; + } + if (ftm_matmul(tmp, mat) == NULL) + return (NULL); + i = 0; + while (i < dst->size) + { + dst->v[i] = tmp->m[i]; + i++; + } + return (dst); +} |
