Math::Macopt

Math::Macopt is a Perl wrapper for macopt++, which is a conjugate gradient library.
Download

Math::Macopt Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Tom Chau
  • Publisher web site:
  • http://search.cpan.org/~tom/Math-Macopt-0.02/Macopt.pod

Math::Macopt Tags


Math::Macopt Description

Math::Macopt is a Perl wrapper for macopt++, which is a conjugate gradient library. Math::Macopt is a Perl wrapper for macopt++, which is a conjugate gradient library.INSTALLATIONThe package can be installed by the standard PERL module installation procedure: perl Makefile.PL make make test make installPlease noted that the original "macopt++" C++ source code is included in this PERL package. The static linking avoids the possible conflict to any pre-installed version of "macopt++".SYNOPSIS use strict; use Math::Macopt; &main(); sub main { # Some settings my $N = 10; my $epsilon = 0.001; # Initialize the Macopt my $macopt = new Math::Macopt::Base($N, 0); # Setup the function and its gradient my $func = sub { my $x = shift; my $size = $macopt->size(); my $sum = 0; foreach my $i (0..$size-1) { $sum += ($x->-$i)**2; } return $sum; }; my $dfunc = sub { my $x = shift; my $size = $macopt->size(); my $g = (); foreach my $i (0..$size-1) { $g-> = 2*($x->-$i); } return $g; }; $macopt->setFunc(&$func); $macopt->setDfunc(&$dfunc); # Optimizer using macopt my $x = ; $macopt->maccheckgrad($x, $N, $epsilon, 0) ; $macopt->macoptII($x, $N); # Display the result printf "n", join(',', @$x); }Requirements:· Perl Requirements: · Perl


Math::Macopt Related Software