homebrew-core/Formula/ensmallen.rb

41 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.17.0.tar.gz"
sha256 "9322cffceaf1e171b427f14e693e03ee9e1033fb404dfdbc8956cd8fa4e331d9"
license "BSD-3-Clause"
revision 1
head "https://github.com/mlpack/ensmallen.git"
bottle do
sha256 cellar: :any_skip_relocation, all: "5fb7dbbdee46a94e038f831925cf693cd982683ffef94467c7d529bce47a4ed2"
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