title: R Cran ldei: error in svd(V2, nu = 0, nv = unsolvable) : a dimension is zero
body: <p>I am quite new to R-Cran. I would like to solve a  linear inverse model with constrains. I am using the ldei-function  in the limSolve package.
  Here are my linear system and constrains:</p>
  
  <p>A x X = C</p>
  
  <p>G x X >=H, with  G=I and H=0. (Basically: X>=0)   </p>
  
  <p>where:</p>
  
  <p>A in a 2x2 matrix; </p>
  
  <p>X (nrow=2, ncol=n) is the unknown-vector-(matrix);</p>
  
  <p>C (nrow=2, ncol=n) is the constant-known vector-(matrix). </p>
  
  <p>The matrix G is the identity matrix and H is a vector-(matrix) with zero values. </p>
  
  <p>The constrain X>=0 needs to be satisfied as X represents concentrations of nitrogen dioxide and ozone in outdoor air, and they cannot be negative.</p>
  
  <p>Here is my r-code, I assume n=10:</p>
  
  <pre><code>library(limSolve)
  
  A &lt;- matrix(data = NA, nrow=2,ncol=2)
  A[1,c(1:2)] &lt;- c(-3.956946e-05,-1.558643e-05)
  A[2,c(1:2)] &lt;- c(-8.785099e-05, 1.540414e-04)
  
  ctmp1 &lt;- c(-3.000286e-04,-0.0003545647,-0.0002958569,-0.000356863,-0.0003602479,-0.0004177914,-0.0004280350,-0.0003890670,-0.0004984785,-0.0005695379) 
  ctmp2 &lt;- c(-6.462205e-05,-0.0007740174,-0.0006427914,-0.001056369,-0.0009569179,-0.0008562010,-0.0005402486,-0.0005043381,-0.0006366220,-0.0009332219)
  inC &lt;- rbind(ctmp1,ctmp2)
  C &lt;- matrix(data=inC, nrow=2, ncol=10)              
  
  G &lt;- matrix(ncol=2,nrow=2,data= c(1,0,0,1))
  inH &lt;- rbind(rep(0., length.out=10),rep(0., length.out=10))
  H &lt;- matrix(data=inH, nrow=2, ncol=10)
  
  # I am aware I need to use the apply-family instead of do loops-- this is my work in progress--.. 
  for (i in 1:10){ 
                  print(i)
                  E &lt;- A
                  FF &lt;- c(C[1,i],C[2,i])
                  GG &lt;- G
                  HH &lt;- H[,i]
                  res &lt;-ldei(E,FF,GG,HH)
                  print(res$X)
                  }
  
  ### Here the output:
  [1] 1
  [1] 6.326385 3.188475
  [1] 2
  [1] 8.93305028 0.06985077
  [1] 3
  [1] 7.44753875 0.07454004
  [1] 4
     Error in svd(V2, nu = 0, nv = unsolvable) : a dimension is zero
  </code></pre>
  
  <p>I would be very grateful for any hint to solve the issue:</p>
  
  <p>"<strong><em>Error in svd(V2, nu = 0, nv = unsolvable) : a dimension is zero</em></strong>" </p>
  
  <p>Many thanks for your help!</p>