code: private VarTensor calcFactorBeliefs(Factor factor) {
          if (factor instanceof GlobalFactor) {
              log.warn("Getting marginals of a global factor is not supported."
                      + " This will require exponential space to store the resulting factor."
                      + " This should only be used for testing.");
          }        
          // Compute the product of all messages sent to this factor.
          VarTensor prod = safeNewVarTensor(factor);
          calcProductAtFactor(factor.getId(), prod, -1, -1);
          return prod;
      }
docs: Gets the unnormalized factor beleifs.