目前我在 C# 程序中使用数学内核库dll mkl_rt.dll中可用的一些函数,所以我有
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
);
}
}
我想继续在命名空间 mkl 中添加函数,然后在另一个文件中使用这些函数。我不知道这是否会产生副作用或最好的方法是什么。在我加载 dll 的代码中,从 mkl 和其他 dll 创建一个巨大的库。