aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_tensor.h
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-08-05 15:36:41 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-08-05 21:05:09 +0100
commit568fd73ab8ba4cf27a2a8c068885444e87cbd148 (patch)
treeb2e0847d8a1535e2c0c8b8f1ccb1c9ccd5f589b0 /src/lua/lua_tensor.h
parent1b0ed3b3a44bb9fec28a65e6624be09de78fa530 (diff)
downloadrspamd-568fd73ab8ba4cf27a2a8c068885444e87cbd148.tar.gz
rspamd-568fd73ab8ba4cf27a2a8c068885444e87cbd148.zip
[Project] Add a simple matrix Lua library
Diffstat (limited to 'src/lua/lua_tensor.h')
-rw-r--r--src/lua/lua_tensor.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/lua/lua_tensor.h b/src/lua/lua_tensor.h
new file mode 100644
index 000000000..554245f0b
--- /dev/null
+++ b/src/lua/lua_tensor.h
@@ -0,0 +1,32 @@
+/*-
+ * Copyright 2020 Vsevolod Stakhov
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef RSPAMD_LUA_TENSOR_H
+#define RSPAMD_LUA_TENSOR_H
+
+#define TENSOR_CLASS "rspamd{tensor}"
+
+typedef float rspamd_tensor_num_t;
+
+struct rspamd_lua_tensor {
+ int ndims;
+ int size; /* overall size (product of dims) */
+ rspamd_tensor_num_t *data;
+ int dim[2];
+};
+
+struct rspamd_lua_tensor *lua_check_tensor (lua_State *L, int pos);
+
+#endif