homebrew-core/Formula/ensmallen.rb

38 lines
1.1 KiB
Ruby
Raw Normal View History

class Ensmallen < Formula
desc "Flexible C++ library for efficient mathematical optimization"
homepage "https://ensmallen.org"
url "https://ensmallen.org/files/ensmallen-2.10.5.tar.gz"
sha256 "fa45e8f65c93d20fec3bbafbb87c66d2762942b00395159846f62e9c35ff7168"
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
cxx_with_flags = ENV.cxx.split + ["test.cpp",
"-std=c++11",
"-I#{include}",
"-I#{Formula["armadillo"].opt_lib}/libarmadillo",
"-o", "test"]
system *cxx_with_flags
end
end