Nima is correct.

On 2/24/12 1:24 PM, Nima Asadi wrote:
>> +        * (-1.0 / 12.0 + f
>> +            * (1.0 / 120.0 + f
>> +                * (-1.0 / 252.0 + f
>> +                    * (1.0 / 240.0 + f
>> +                        * (-1.0 / 132.0 + f
>> +                            * (691.0 / 32760.0 + f * (-1.0 / 12.0 + f * 3617.0 / 8160.0)))))));
>> +    return r + Math.log(x) - 0.5 / x + t;
>> +  }
>> +
>> +  /**
>> +   * Approximate the trigamma of x.
>> +   *
>> +   * @param x
>> +   * @return
>> +   */
>> +  public static double trigamma(double x) {
>
> I'm not hundred percent sure that it's faster. However:
>
> - It simplifies your code-writing
> - Makes it more readable
> - You are not restricted to one single implementation of the Map interface:
> Suppose you want to use another implementation of HashMap. Instead of going
> through your old, dusty code and replacing "new HashMap<blah, blah>" with
> "new MyHashMap<blah, blah>", you can simply change extend Guava (for
> example). So it lowers the maintenance cost.
> - It's just beautiful!
>
> In addition to Guava's collections, there are very nice IO classes in Guava
> that you may want to take a look at. They don't work on HDFS
> (unfortunately), but if you're writing stand-alone programs, they are very
> helpful. For example, you can write JUnit tests for a method that parses a
> particular file, without having to feed in an actual file - that means you
> can junit-test your io code without dealing with the file system...
> Besides, they do a lot of boilerplate low-level coding for you, so you
> don't have to worry about closing files, etc.
>
> Nima
>
> On Fri, Feb 24, 2012 at 1:06 PM, Zhai Ke<
> reply@reply.github.com
>> wrote:
>
>>> +        * (-1.0 / 12.0 + f
>>> +            * (1.0 / 120.0 + f
>>> +                * (-1.0 / 252.0 + f
>>> +                    * (1.0 / 240.0 + f
>>> +                        * (-1.0 / 132.0 + f
>>> +                            * (691.0 / 32760.0 + f * (-1.0 / 12.0 + f * 3617.0
>> / 8160.0)))))));
>>> +    return r + Math.log(x) - 0.5 / x + t;
>>> +  }
>>> +
>>> +  /**
>>> +   * Approximate the trigamma of x.
>>> +   *
>>> +   * @param x
>>> +   * @return
>>> +   */
>>> +  public static double trigamma(double x) {
>>
>> Thanks.
>>
>> a more general question: com.google.common.collect.Maps is faster? what
>> are the advantage of those?
>>
>>
>> On Feb 24, 2012, at 1:04 PM, Nima Asadi wrote:
>>
>>>> +        * (-1.0 / 12.0 + f
>>>> +            * (1.0 / 120.0 + f
>>>> +                * (-1.0 / 252.0 + f
>>>> +                    * (1.0 / 240.0 + f
>>>> +                        * (-1.0 / 132.0 + f
>>>> +                            * (691.0 / 32760.0 + f * (-1.0 / 12.0 + f
>> * 3617.0 / 8160.0)))))));
>>>> +    return r + Math.log(x) - 0.5 / x + t;
>>>> +  }
>>>> +
>>>> +  /**
>>>> +   * Approximate the trigamma of x.
>>>> +   *
>>>> +   * @param x
>>>> +   * @return
>>>> +   */
>>>> +  public static double trigamma(double x) {
>>>
>>> Yes, I believe that's what Jimmy is saying:
>>>
>>> Map<T1, T2>  object = new HashMap<T1, T2>();
>>>
>>> Even better, use com.google.common.collect.Maps for Guava:
>>>
>>> Map<T1, T2>  object = Maps.newHashMap();
>>>
>>> Nima
>>>
>>> On Fri, Feb 24, 2012 at 12:59 PM, Zhai Ke<
>>> reply@reply.github.com
>>>> wrote:
>>>
>>>>> +        * (-1.0 / 12.0 + f
>>>>> +            * (1.0 / 120.0 + f
>>>>> +                * (-1.0 / 252.0 + f
>>>>> +                    * (1.0 / 240.0 + f
>>>>> +                        * (-1.0 / 132.0 + f
>>>>> +                            * (691.0 / 32760.0 + f * (-1.0 / 12.0 + f
>> * 3617.0
>>>> / 8160.0)))))));
>>>>> +    return r + Math.log(x) - 0.5 / x + t;
>>>>> +  }
>>>>> +
>>>>> +  /**
>>>>> +   * Approximate the trigamma of x.
>>>>> +   *
>>>>> +   * @param x
>>>>> +   * @return
>>>>> +   */
>>>>> +  public static double trigamma(double x) {
>>>>
>>>> I don't understand, Map is an interface, right? Are you staying
>> something
>>>> like Map map = new HashMap()?
>>>>
>>>> On Feb 24, 2012, at 12:53 PM, Nima Asadi wrote:
>>>>
>>>>> (that's sed syntax: substitute Map for HashMap)
>>>>>
>>>>> Nima
>>>>
>>>> ---
>>>> Reply to this email directly or view it on GitHub:
>>>> https://github.com/lintool/Mr.LDA/pull/1/files#r486093
>>>>
>>>
>>> ---
>>> Reply to this email directly or view it on GitHub:
>>> https://github.com/lintool/Mr.LDA/pull/1/files#r486124
>>
>> ---
>> Reply to this email directly or view it on GitHub:
>> https://github.com/lintool/Mr.LDA/pull/1/files#r486137
>>
>
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/lintool/Mr.LDA/pull/1/files#r486249
>