40 lines
1.2 KiB
Ruby
40 lines
1.2 KiB
Ruby
class Ensmallen < Formula
|
|
desc "Flexible C++ library for efficient mathematical optimization"
|
|
homepage "https://ensmallen.org"
|
|
url "https://github.com/mlpack/ensmallen/archive/2.18.1.tar.gz"
|
|
sha256 "573964639bb52f7a5518f41d1d4c673dc69685f5d36dad3d87deaaa5f8c23e87"
|
|
license "BSD-3-Clause"
|
|
head "https://github.com/mlpack/ensmallen.git", branch: "master"
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, all: "ac49dd105f936dba0923e6a061cf15c0ff20bf26809a810077993da7c0ce9a71"
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "armadillo"
|
|
|
|
def install
|
|
mkdir "build" do
|
|
system "cmake", "..", *std_cmake_args
|
|
system "make", "install"
|
|
end
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.cpp").write <<~EOS
|
|
#include <ensmallen.hpp>
|
|
using namespace ens;
|
|
int main()
|
|
{
|
|
test::RosenbrockFunction f;
|
|
arma::mat coordinates = f.GetInitialPoint();
|
|
Adam optimizer(0.001, 32, 0.9, 0.999, 1e-8, 3, 1e-5, true);
|
|
optimizer.Optimize(f, coordinates);
|
|
return 0;
|
|
}
|
|
EOS
|
|
system ENV.cxx, "test.cpp", "-std=c++11", "-I#{include}", "-L#{Formula["armadillo"].opt_lib}",
|
|
"-larmadillo", "-o", "test"
|
|
end
|
|
end
|