I는 R 큰 정방 행렬을 가지고R 계산이 큰 NOR 매트릭스
norMat <- matrix(NA, nrow=1024, ncol=1024)
이 빈 행렬은 모든 행렬 인덱스 쌍 모두 동일 비트의 합계로 채워질 필요가있다.
그래서 논리 NOR i
(rowIndex에) 및 j
(colIndex) 미국을 계산하고 그 결과를 합산해야 예 :
sum(intToBits(2)==intToBits(3))
Currenty, I는 행렬을 채운다이 기능을 갖는다
norsum <- function(bucket1, bucket2)
{
res = sum(intToBits(bucket1)==intToBits(bucket2))
return(res)
}
:
norMatrix <- function()
{
matDim=1024
norMat <<- matrix(NA, nrow=matDim, ncol=matDim)
for(i in 0:(matDim-1)) {
for(j in 0:(matDim-1)) {
norMat[i+1,j+1] = norsum(i,j)
}
}
return(norMat)
}
그리고 여기가 norsum
기능입니다3210
매트릭스를 채우기위한 효율적인 솔루션입니까? 내 컴퓨터에서 5 분 이상 걸리기 때문에 의심 스럽습니다.
Thx, 정말 큰 속도입니다! – juxeii