Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要编写代码来计算矩阵的累积乘积。例如,如果 A = ( 1 2 3 | 4 3 2 ) 那么 cum.sum(A) = ( 1 2 6 | 4 24 144 )
有没有什么好的算法可以做到这一点?
我将使用 R、C、Matlab 或 Octave。
A <- matrix(c(1,2,3,4,3,2),byrow=TRUE,nrow=2)
我猜你想要所有 (k,l)小于(i,j) ... 的累积乘积?
B <- A nr <- nrow(B) nc <- ncol(B) for (i in 1:max(nr,nc)) { if (i<=nr) B[i,i:nc] <- cumprod(B[i,])[i:nc] }
这适用于您的示例:您可能需要小心地将其推广到行多于列的情况......
First of all, I am using playframework 2 with Java.
I have a Bootstrap-lookahead input field in a view and I want to use a json array as source for it, as described 1 apache - WAMP apache httpd.config 和主机 - 如何将 localhost 别名为端口 8080?