【编程技术】求高手看看如下的VBA代码,目前总是error,说 out of memory我有如下的代码,总是提示提示 out of memory,求高手优化一下
Function Sparsekv(kv() As Double, ByRef KVD() As Double, ByRef kvsi() As Long, ByVal neq As Long, ByVal nband As Long) As Long
Dim i As Long, j As Long, k As Long, L As Long, n As Long, NumRows As Long, NumNon0 As Long, LB As Long, KVD2() As Double, KVsi2() As Long
Dim MaxRows As Long, IndexA() As Long
LB = LBound(kv)
NumRows = UBound(kv) - LB + 1
For i = LB To NumRows + LB - 1
If kv(i) 0 Then NumNon0 = NumNon0 + 1
Next i
MaxRows = neq * (nband + 1) - 1
ReDim KVD(0 To NumNon0 - 1)
ReDim kvsi(0 To NumNon0 - 1, 0 To 1)
ReDim KVD2(0 To MaxRows)
ReDim KVsi2(0 To MaxRows, 0 To 1) '在这行总是提示out of memory
ReDim IndexA(0 To neq, 0 To nband + 1) '有时候是在这行提示 提示out of memory
i = 1
n = 0
k = -1
For j = 1 To nband + 1
(more...)
二维数组太大了,50Mx 2x8=800M Byte
[本文发送自华新手机Wap版]