code: def getTheta(k, nTrials=100000):
    
    theDots = np.zeros(nTrials)
    w1 = getSparseTensor(k, k, nTrials, fixedRange=1.0/k)
    for i in range(nTrials):
      theDots[i] = w1[i].dot(w1[i])
  
    dotMean = theDots.mean()
    print("k=", k, "min/mean/max diag of w dot products",
          theDots.min(), dotMean, theDots.max())
  
    theta = dotMean / 2.0
    print("Using theta as mean / 2.0 = ", theta)
  
    return theta, theDots
docs: Estimate a reasonable value of theta for this k.