matrix calculation error

前端 未结 3 1186
梦谈多话
梦谈多话 2021-01-29 05:22

I am using R tool to calculate SVD (svd(m)) and it works on small matrix but as I pass it 20Kx20X matrix. After processing, it gives the following erro

3条回答
  •  清歌不尽
    2021-01-29 05:50

    I am guessing that your problem is not related to memory size, although I am not able to process a 20Kx20K matrix on my 4GB memory machine.

    The reason for this guess is that the first line of code inside svd() is the following:

    if (any(!is.finite(x))) 
        stop("infinite or missing values in 'x'")
    

    In other words, the svd() function test first whether there are any infinite values in your data.

    This happens before any further processing. So, if you had memory problems, these would be apparent even before your call to svd().

    I suggest you check for infinite values:

    x <- c(0, Inf, NA, NULL)
    which(!is.finite(x))
    
    [1] 2 3
    

    This indicates that the second and third values are considered to be not finite. In other words, any NA values in your data will cause your error.

提交回复
热议问题