diff options
author | XANTRONIX Development | 2022-02-18 23:03:23 -0500 |
---|---|---|
committer | XANTRONIX Development | 2022-02-18 23:03:42 -0500 |
commit | b989e759008884e95545ad9c7f8b64da9267298c (patch) | |
tree | 98e92d81010e189ec98c1c1faf5d2a301343c8a4 /src | |
parent | b1811358664496f79ef8030dee1f5c53e1a8569f (diff) | |
download | xas-b989e759008884e95545ad9c7f8b64da9267298c.tar.gz xas-b989e759008884e95545ad9c7f8b64da9267298c.tar.bz2 xas-b989e759008884e95545ad9c7f8b64da9267298c.zip |
Implement dotf()
Implement dotf() to produce dot product of matrices
Diffstat (limited to 'src')
-rw-r--r-- | src/spatial.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/spatial.c b/src/spatial.c index 98728df..f35749c 100644 --- a/src/spatial.c +++ b/src/spatial.c @@ -43,6 +43,28 @@ static int point_within_cone(xas_spatial_coord coord, return 1; } +static float dotf(float *sets, size_t count, size_t len) { + float ret = 0.0f; + + size_t x, y; + + if (count == 0 || len == 0) { + return 0.0f; + } + + for (x=0; x<count; x++) { + float num = sets[x*len+0]; + + for (y=1; y<len; y++) { + num *= sets[x*len+y]; + } + + ret += num; + } + + return ret; +} + static int buffer_realloc(xas_spatial_scene *scene, xas_spatial_buffer *buffer) { float seconds = scene->radius / scene->speed; |