向量化R代码,该代码已使用序列符号

我正在努力编写快速代码来计算以下向量的函数:

enter image description here

目前,我使用for循环对其进行编码,这非常慢:

rho <- 0.9
E_D <- numeric(100)
E_D[1] <- 1
for (t in 2:100){
  summm <- sum(cumsum(0.9^(0:(t-2)))^2)
  E_D[t] <- t+exp(summm)
}

summm是上图中我分析定义的向量的元素。 E_D是一个向量,是该向量的某些函数。如果将最大t设置为5000,则以上代码在我的计算机上运行1秒钟以上,这对于我的目的而言太慢了。

I tried data.table solution, but it can not accommodate intermediate vector output within a cell:

tempdt <- data.table(prd=2:100 ,summm=0)
tempdt[, summm:=sum(cumsum(rho^(0:(prd-2)))^2)]
Warning message:
In 0:(prd - 2) : numerical expression has 99 elements: only the first used

如何使上面的代码更快?请不要告诉我我必须在Matlab中进行...