Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.6 / 3....
  • Linux Kernel 3.0.82 LTS...
  • KDE Software Compilatio...
  • PulseAudio 4.0
  • Wireshark 1.10.0
  • NetworkManager 0.9.8.2
  • LibreOffice 3.6.6 / 4.0...
  • SystemRescueCd 3.7.0
  • Linux Kernel 3.10 RC6
  • Ubuntu Tweak 0.8.5
  • Home > Linux > Programming > Libraries

    Math::Macopt 0.02

    Download button

    No screenshots available
    Downloads: 319  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Tom Chau | More programs
    Perl Artistic License / FREE
    June 9th, 2007, 04:05 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    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.

    INSTALLATION

    The package can be installed by the standard PERL module installation procedure:

    perl Makefile.PL
    make
    make test
    make install

    Please 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]-$i)**2;
    }

    return $sum;
    };
    my $dfunc = sub {
    my $x = shift;

    my $size = $macopt->size();
    my $g = ();
    foreach my $i (0..$size-1) {
    $g->[$i] = 2*($x->[$i]-$i);
    }

    return $g;
    };
    $macopt->setFunc(&$func);
    $macopt->setDfunc(&$dfunc);

    # Optimizer using macopt
    my $x = [(1)x($N)];
    $macopt->maccheckgrad($x, $N, $epsilon, 0) ;
    $macopt->macoptII($x, $N);

    # Display the result
    printf "[%s]n", join(',', @$x);
    }

    Requirements:

    · Perl



    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    macopt++ wrapper | conjugate gradient | gradient library | Math::Macopt | macopt++ | wrapper

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM