Currently I am using some functions available in math kernel library dll mkl_rt.dll in a C# program so I have
using mkl;
namespace mklDirect
{
int LAPACK_ROW_MAJOR = 101;
int LAPACK_COL_MAJOR = 102;
int n, m, lda;
n = 3;m = 3;
lda = n;
int ldu = m;
int ldvt = n;
Double[] superb = new Double[m - 1];
Double[] s = new Double[n];
Double[] u = new Double[n * n];
Double[] vt = new Double[n * n];
Double[] A = new Double[9]
{
8.79, 9.93, 9.83,
6.11, 6.91, 5.04,
-9.15, -7.93, 4.86
};
Char a1 = 'A';
Char a2 = 'A';
int mat_order = LAPACK_ROW_MAJOR;
int info = 0;
double[] work1 = new double[1];
MKLImports.LAPACKE_dgesvd(mat_order, a1, a2, m, n, A, lda, s, u, ldu, vt, ldvt, superb);
//PRINT RESULT
}
namespace mkl
{
internal sealed class MKLImports
{
private MKLImports()
{
}
[DllImport("mkl_rt.dll", ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern void LAPACKE_dgesvd(
int matrix_order,
char a1,
char a2,
int m,
int n,
[In, Out] double[] input_matrix,
int lda,
[In, Out] double[] s,
[In, Out] double[] u,
int ldu,
[In, Out] double[] vt,
int ldvt,
double[] superb
);
}
}
I want to keep on adding functions in the namespace mkl, and then, use those functions in another file. I do not know if this can have side effects or what would be the best way to do this. In the code I loads the dlls, to make a huge library from mkl and other dlls .
Are you just trying to create an interop file? There are ways of generating complete interop files for you that will automatically generate such code for you to utilize as you please.
http://msdn.microsoft.com/en-us/library/tw4zwhbe.aspx
http://msdn.microsoft.com/en-us/library/aa302338.aspx
http://msdn.microsoft.com/en-us/library/1w557csx.aspx