can i do this? i am learning this on my own..and from the book..simple unix i am not sure if the syntax would work
if
statement
then
statement
do or for or while
statement
done
else
statement
fi....
I dont know how else to explain that...I hope I... (2 Replies)
I am having trouble parsing rpm filenames in a shell script.. I found a snippet of perl code that will perform the task but I really don't have time to rewrite the entire script in perl. I cannot for the life of me convert this code into something sed-friendly:
if ($rpm =~ /(*)-(*)-(*)\.(.*)/)... (1 Reply)
Folks! Anyone please explain the behavior of this program step by step. Thanks.
#! /usr/bin/perl
$testfile = "./testfile2";
for ( $i = 1, $i <= 5, $i++) {
open ($FILE, ">", $testfile);
print ($FILE "Output 1 \n");
close ($FILE);
}
print "The value of (4 * 2) / 2 is ";
print (4 * 2)... (1 Reply)
Hello Unix graduates,
I have gone through 50 posts here in this Unix.com, out of which 35-40 are answered with regex.. Regex is always been a problem for me. :wall:
I have gone through few URLs still it doesn't help me to reach what you guys are.. :confused:
How to get skilled on... (1 Reply)
I have a file of protein sequences with headers (my source file). Based on a list of IDs (which are included in some of the headers), I'd like to print out only the specified sequences, with only the ID as header.
In other words, I'd like to search source.txt for the terms in IDs.txt, and print... (3 Replies)
Hello All,
I am a beginner in C, although I believe my learning curve is rather steep.
I would like to know if any of you would have some recommendations with some learning materials to become a good C developer.
I am particularly thinking about some CBT courses or some good Quizz that would... (2 Replies)
I am not a big expert in regex and have just little understanding of that language.
Could you help me to understand the regular Perl expression:
^(?!if\b|else\b|while\b|)(?:+?\s+){1,6}(+\s*)\(*\) *?(?:^*;?+){0,10}\{
------
This is regex to select functions from a C/C++ source and defined in... (2 Replies)
I'm trying to get some exclusions into our sendmail regular expression for the K command. The following configuration & regex works:
LOCAL_CONFIG
#
Kcheckaddress regex -a@MATCH
+<@+?\.++?\.(us|info|to|br|bid|cn|ru)
LOCAL_RULESETS
SLocal_check_mail
# check address against various regex... (0 Replies)
Discussion started by: RobbieTheK
0 Replies
LEARN ABOUT REDHAT
pdl::opt::simplex
Simplex(3) User Contributed Perl Documentation Simplex(3)NAME
PDL::Opt::Simplex -- Simplex optimization routines
SYNOPSIS
use PDL::Opt::Simplex;
($optimum,$ssize) = simplex($init,$initsize,$minsize,
$maxiter,
sub {evaluate_func_at($_[0])},
sub {display_simplex($_[0])}
);
DESCRIPTION
This package implements the commonly used simplex optimization algorithm. The basic idea of the algorithm is to move a "simplex" of N+1
points in the N-dimensional search space according to certain rules. The main benefit of the algorithm is that you do not need to calculate
the derivatives of your function.
$init is a 1D vector holding the initial values of the N fitted parameters, $optimum is a vector holding the final solution.
$initsize is the size of $init (more...)
$minsize is some sort of convergence criterion (more...) - e.g. $minsize = 1e-6
The sub is assumed to understand more than 1 dimensions and threading. Its signature is 'inp(nparams); [ret]out()'. An example would be
sub evaluate_func_at {
my($xv) = @_;
my $x1 = $xv->slice("(0)");
my $x2 = $xv->slice("(1)");
return $x1**4 + ($x2-5)**4 + $x1*$x2;
}
Here $xv is a vector holding the current values of the parameters being fitted which are then sliced out explicitly as $x1 and $x2.
$ssize gives a very very approximate estimate of how close we might be - it might be miles wrong. It is the euclidean distance between the
best and the worst vertices. If it is not very small, the algorithm has not converged.
FUNCTIONS
simplex
Simplex optimization routine
($optimum,$ssize) = simplex($init,$initsize,$minsize,
$maxiter,
sub {evaluate_func_at($_[0])},
sub {display_simplex($_[0])}
);
See module "PDL::Opt::Simplex" for more information.
CAVEATS
Do not use the simplex method if your function has local minima. It will not work. Use genetic algorithms or simulated annealing or conju-
gate gradient or momentum gradient descent.
They will not really work either but they are not guaranteed not to work ;) (if you have infinite time, simulated annealing is guaranteed
to work but only after it has visited every point in your space).
SEE ALSO
Ron Shaffer's chemometrics web page and references therein: "http://chem1.nrl.navy.mil/~shaffer/chemoweb.html".
Numerical Recipes (bla bla bla XXX ref).
The demonstration (Examples/Simplex/tsimp.pl and tsimp2.pl).
AUTHOR
Copyright(C) 1997 Tuomas J. Lukka. All rights reserved. There is no warranty. You are allowed to redistribute this software / documenta-
tion under certain conditions. For details, see the file COPYING in the PDL distribution. If this file is separated from the PDL distribu-
tion, the copyright notice should be included in the file.
perl v5.8.0 2000-05-30 Simplex(3)