我发现我的函数的 InArray 参数将在第一次使用后被释放。例如:
static ILArray<double> UpdateU(
ILInArray<double> sigmaK, ILInArray<double> uK, ILInArray<double> vK,
ILInArray<double> t, ILOutArray<double> outU, ILOutArray<double> outV)
{
var q = t.Size[0];
var m = uK.Size[0];
var k = uK.Size[1];
var n = vK.Size[0];
ILArray<double> hBottom = multiply(t, vK);
ILArray<double> h = zeros(k + q, k);
h["0:" + (k - 1), full] = sigmaK[full, full];
h[k + ":end", full] = hBottom[full, full];
ILArray<double> uH = empty();
ILArray<double> vH = empty();
ILArray<double> sigmaH = svd(h, uH, vH);
ILArray<double> broadenUK = zeros(m + q, k + q);
broadenUK["0:" + (m - 1), "0:" + (k - 1)] = uK[full, full];
broadenUK[m + ":end", k + ":end"] = eye(q, q)[full, full];
outU.a = multiply(broadenUK, uH);
outV.a = multiply(vK, vH);
return sigmaH;
}
变量 t 和 vK 放置在该行之后
ILArray<double> hBottom = multiply(t, vK);
是不是因为我的代码遗漏了什么?谢谢!
更新:如果我将 t 和 vK 的参数声明从更改为ILInArray
,ILArray
它们将被保留。但从我在文档中读到的内容来看,前一种实际上是首选。