#include <string.h>
#include <oski/common.h>
#include <oski/mangle.h>
#include <oski/mattypes_internal.h>
#include <oski/tune.h>
#include <oski/xforms.h>
#include <oski/xforms_internal.h>
#include <lua/include/lua.h>
#include <lua/include/lualib.h>
#include <lua/include/lauxlib.h>
Functions | |
| char * | oski_GetMatTransforms (const oski_matrix_t A_tunable) |
| Returns a string representation of the data structure transformations that were applied to the given matrix during tuning. | |
| static void | DumpLuaArg (lua_State *L, int arg) |
| Print the type and, if possible, value of the element at the given position in the Lua stack. | |
| static int | RequireLua (lua_State *L, const char *modname) |
| Implements a call to Lua's "require()" function. | |
| static void | RegisterLuaMatTypes (lua_State *L) |
| Traverse the list of available matrix types, and create globally visible Lua matrix types in the given Lua state. | |
| static int | NewLuaMat (lua_State *L) |
| Leaves a newly instantiated OLUA_MAT object on the top of L's stack. | |
| static oski_matlua_t * | CheckLuaMat (lua_State *L) |
| Examines the first item (position 1) on the stack and returns it if it is a valid OLUA_MATTAB object. | |
| static int | ToStringLuaMat (lua_State *L) |
| A.__tostring(): Returns a string representation of the specified LuaMat object. | |
| static int | GCLuaMat (lua_State *L) |
| A.__gc(x): Called when the system garbage collects x. | |
| static char * | MakeLuaConvMethodName (const oski_matlua_t *A_source, const oski_matlua_t *A_dest) |
| Returns a newly created string method name for a Lua-callback matrix type conversion routine. | |
| static oski_matlua_t * | ConvertLuaMatToCSR (lua_State *L, int index) |
| Converts the Lua matrix at position 'index' on the stack to CSR format, and leaves the new matrix at the top of the stack. | |
| static int | AreSameLuaMatTypes (const oski_matlua_t *A, const oski_matlua_t *B) |
| Returns 1 if the input OSKI-Lua matrices have the same type (e.g., are both BCSR(int, double)). | |
| static int | ConvertLuaMat (lua_State *L) |
| Mat.__call( A, . | |
| static int | OpenLuaMatMod (lua_State *L) |
| Load OSKI-Lua matrix module and metatable. | |
| static lua_State * | OpenLua (void) |
| Start a OSKI-Lua process. | |
| static void | CloseLua (lua_State *L) |
| Shutdown a OSKI-Lua process. | |
| static int | RunLua (lua_State *L, const char *xforms) |
| Execute a OSKI-Lua program to transform a matrix data structure. | |
| static int | CreateLuaMatObj (lua_State *L, const oski_matcommon_t *props, oski_matspecific_t *mat, const char *name) |
| Instantiates new OLUA_MAT object wrapper around the matrix (props, mat) and assigns it to the global variable 'name'. | |
| int | oski_FreeInputMatRepr (oski_matrix_t A) |
| If the given matrix has a valid tuned representation and does not share its input representation, then this routine destroys the input matrix representation. | |
| int | oski_ReplaceTunedMatRepr (oski_matrix_t A, oski_matspecific_t *new_mat, const char *xforms) |
| Replace a matrix's tuned representation with a new one. | |
| int | oski_ApplyMatTransforms (oski_matrix_t A_tunable, const char *xforms) |
| Replace the current data structure for a given matrix object with a new data structure specified by a given string. | |
| int | oski_CreateLuaMatReprGenericFromCSR (lua_State *L, const char *mattype) |
| Routine to create a Lua matrix representation from a CSR representation for a simple matrix type. | |
| int | oski_CreateLuaMatReprGeneric2IndexFromCSR (lua_State *L, const char *mattype) |
| Routine to create a Lua matrix representation from a CSR representation for a matrix type that, on creation, expects two integer index arguments. | |
Variables | |
| static const struct luaL_reg | g_luamatlib_f [] |
| OLUA_MAT static members. | |
| static const struct luaL_reg | g_luamatlib_m [] |
| OLUA_MAT object methods. | |
|
|
Examines the first item (position 1) on the stack and returns it if it is a valid OLUA_MATTAB object. Returns NULL otherwise. |
|
|
Mat.__call( A, . .. ) --> A( ... ): Implements data structure conversion. Assumed contents of the Lua stack:
|
|
||||||||||||
|
Converts the Lua matrix at position 'index' on the stack to CSR format, and leaves the new matrix at the top of the stack. Returns a pointer to the matrix object. If an error occurs, this routine leaves the stack unchanged and returns NULL. |
|
||||||||||||||||||||
|
Instantiates new OLUA_MAT object wrapper around the matrix (props, mat) and assigns it to the global variable 'name'. The new object is left at the top of the stack.
|
|
|
Leaves a newly instantiated OLUA_MAT object on the top of L's stack. This routine implements 'Mat.new( [base_type_name] )'. |
|
|
Start a OSKI-Lua process. Calls the error handler on error and returns NULL. Otherwise, returns a pointer to valid OSKI-Lua state.
|
|
||||||||||||
|
Routine to create a Lua matrix representation from a CSR representation for a simple matrix type.
|
|
|
If the given matrix has a valid tuned representation and does not share its input representation, then this routine destroys the input matrix representation.
|
|
||||||||||||||||
|
Replace a matrix's tuned representation with a new one.
If A is invalid, this function returns ERR_BAD_MAT. |
|
|
Traverse the list of available matrix types, and create globally visible Lua matrix types in the given Lua state.
|
|
||||||||||||
|
Execute a OSKI-Lua program to transform a matrix data structure.
Available OSKI-Lua globals:
OSKI-Lua syntax examples: -- Program 1: Convert to 4x2 blocked format
return BCSR( InputMat, 4, 2 );
Lua-native module code: Make the following C-implemented routines available in Lua: loadmattype( type_name, ind_type, val_type ) |
|
|
Initial value: {
{"new", NewLuaMat},
{NULL, NULL}
}
|
|
|
Initial value: {
{"__tostring", ToStringLuaMat},
{"__gc", GCLuaMat},
{"__call", ConvertLuaMat},
{NULL, NULL}
}
|
1.4.6