11/* *
2- * @file scd .hpp
2+ * @file cd .hpp
33 * @author Shikhar Bhardwaj
44 *
5- * Stochastic Coordinate Descent (SCD ).
5+ * Coordinate Descent (CD ).
66 *
77 * ensmallen is free software; you may redistribute it and/or modify it under
88 * the terms of the 3-clause BSD license. You should have received a copy of
99 * the 3-clause BSD license along with ensmallen. If not, see
1010 * http://www.opensource.org/licenses/BSD-3-Clause for more information.
1111 */
12- #ifndef ENSMALLEN_SCD_SCD_HPP
13- #define ENSMALLEN_SCD_SCD_HPP
12+ #ifndef ENSMALLEN_CD_CD_HPP
13+ #define ENSMALLEN_CD_CD_HPP
1414
1515#include " descent_policies/cyclic_descent.hpp"
1616#include " descent_policies/random_descent.hpp"
@@ -42,19 +42,19 @@ namespace ens {
4242 * }
4343 * @endcode
4444 *
45- * SCD can optimize partially differentiable functions. For more details, see
45+ * CD can optimize partially differentiable functions. For more details, see
4646 * the documentation on function types included with this distribution or on the
4747 * ensmallen website.
4848 *
4949 * @tparam DescentPolicy Descent policy to decide the order in which the
5050 * coordinate for descent is selected.
5151 */
5252template <typename DescentPolicyType = RandomDescent>
53- class SCD
53+ class CD
5454{
5555 public:
5656 /* *
57- * Construct the SCD optimizer with the given function and parameters. The
57+ * Construct the CD optimizer with the given function and parameters. The
5858 * default value here are not necessarily good for every problem, so it is
5959 * suggested that the values used are tailored for the task at hand. The
6060 * maximum number of iterations refers to the maximum number of "descents"
@@ -70,11 +70,11 @@ class SCD
7070 * @param descentPolicy The policy to use for picking up the coordinate to
7171 * descend on.
7272 */
73- SCD (const double stepSize = 0.01 ,
74- const size_t maxIterations = 100000 ,
75- const double tolerance = 1e-5 ,
76- const size_t updateInterval = 1e3 ,
77- const DescentPolicyType descentPolicy = DescentPolicyType());
73+ CD (const double stepSize = 0.01 ,
74+ const size_t maxIterations = 100000 ,
75+ const double tolerance = 1e-5 ,
76+ const size_t updateInterval = 1e3 ,
77+ const DescentPolicyType descentPolicy = DescentPolicyType());
7878
7979 /* *
8080 * Optimize the given function using stochastic coordinate descent. The
@@ -158,6 +158,24 @@ class SCD
158158} // namespace ens
159159
160160// Include implementation.
161- #include " scd_impl.hpp"
161+ #include " cd_impl.hpp"
162+
163+ namespace ens {
164+
165+ /* *
166+ * Backwards-compatibility alias; this can be removed after ensmallen 3.10.0.
167+ * The history here is that CD was originally named SCD, but that is an
168+ * inaccurate name because this is not a stochastic technique; thus, it was
169+ * renamed SCD.
170+ */
171+ template <typename DescentPolicyType = RandomDescent>
172+ using SCD = CD<DescentPolicyType>;
173+
174+ // Convenience typedefs.
175+ using RandomCD = CD<RandomDescent>;
176+ using GreedyCD = CD<GreedyDescent>;
177+ using CyclicCD = CD<CyclicDescent>;
178+
179+ } // namespace ens
162180
163181#endif
0 commit comments