Question

What is it LAPACK bindings How do I use them to read that chunk of memory?

  • How to make a memory chunk containing this matrix "table" in SQL Server 2008?
  • If that is not possible, a memory pointer, containing the matrix is feasible?
Was it helpful?

Solution

LAPACK is a linear algebra library written in Fortran or C (can't remember which). To use it from a different programming environment you need a wrapper for the library, sometimes called 'Bindings'.

I'm not clear whether you want to do a computation and use the results within a stored procedure, or just want to extract data from the database and run the computation on it.

If you need to use LAPACK from within a stored procedure, the most likely option to use would be to make a CLR stored procedure (i.e. C#) that wraps your code that uses the LAPACK library. You may need to build a wrapper (maybe using managed C++) to use it from .Net. LAPACK will provide functionality that allows you to allocate this memory and return a pointer or handle to it.

The CLR Stored Procedure could present the results (as a table-valued function for example) that would return the results of the matrix computation in a form that could be used within a query.

If you want to extract data to use within LAPACK, you need to query the data from the database and then load it into the matrix ('chunk of memory'). You can do this from any language that can both bind to LAPACK and read from the database. In order to do this, you need to have a wrapper that you can use to construct the matrix with data from your query. If this doesn't need to reside within the database then you could write this in any language with both LAPACK and ODBC bindings. If it does need to reside within the database (avoid this if possible) then you can use a CLR stored procedure in much the same way as above.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top