* @brief Return the results for the L-BFGS method. */
| 961 | * @brief Return the results for the L-BFGS method. |
| 962 | */ |
| 963 | AnyType stateToResult( |
| 964 | const Allocator &inAllocator, |
| 965 | const HandleMap<const ColumnVector, TransparentHandle<double> > &incoef, |
| 966 | double loglikelihood, const uint32_t &iterations) { |
| 967 | // FIXME: We currently need to copy the coefficient to a native array |
| 968 | // This should be transparent to user code |
| 969 | MutableNativeColumnVector coef( |
| 970 | inAllocator.allocateArray<double>(incoef.size())); |
| 971 | coef = incoef; |
| 972 | |
| 973 | // Return all coefficients, loglikelihood in a tuple |
| 974 | AnyType tuple; |
| 975 | tuple << coef << loglikelihood << iterations; |
| 976 | return tuple; |
| 977 | } |
| 978 | |
| 979 | } // namespace crf |
| 980 |