| Summary | Package variables | Synopsis | General documentation | Methods |
| Summary | Top |
| verifyCount |
| verifyLength |
| Package variables | Top |
| |
| $countError = -1 | |
| $error = "e" | |
| $lengthError = -1 |
| Synopsis | Top |
| Description | Top |
| Methods | Top |
| add | No description | Code |
| average | No description | Code |
| innerProduct | No description | Code |
| subtract | No description | Code |
| verifyCount | No description | Code |
| verifyLength | No description | Code |
| add | description | prev | next | Top |
sub add
{
my $count = verifyCount (@_);
my $length = verifyLength (@_);
if (($count == $countError) || ($length == $lengthError)) {
return $error;
}
else {
my @input = @_;
my $result = shift(@input);
my @result = @{$result};
while (scalar @input > 0) {
my $v1 = shift(@input);
my @v1vals = @{$v1};
foreach $i (0..($length-1)) {
$result[$i] = ($result[$i]+$v1vals[$i]);
}
}
return @result;
}} |
| average | description | prev | next | Top |
sub average
{
my $count = verifyCount (@_);
my $length = verifyLength (@_);
if (($count == $countError) || ($length == $lengthError)) {
return $error;
}
else {
my @input = @_;
my $interim = shift(@input);
my @interim = @{$interim};
while (scalar @input > 0) {
my $v1 = shift(@input);
my @v1vals = @{$v1};
foreach $i (0..($length-1)) {
$interim[$i] = ($interim[$i]+$v1vals[$i]);
}
}
my @result;
foreach $ii (0..($length-1)) {
$result[$ii] = ($interim[$ii]/$count);} |
| innerProduct | description | prev | next | Top |
sub innerProduct
{ my $count = verifyCount (@_);
my $length = verifyLength(@_);
if ($count == $countError || $count > 2) {
# print "Error - Unable to perform an Inner Product on more than two vectors.\n";} |
| subtract | description | prev | next | Top |
sub subtract
{
my $count = verifyCount (@_);
my $length = verifyLength (@_);
if (($count == $countError) || ($length == $lengthError)) {
return $error;
}
else {
my @input = @_;
my $result = shift(@input);
my @result = @{$result};
while (scalar @input > 0) {
my $v1 = shift(@input);
my @v1vals = @{$v1};
foreach $i (0..($length-1)) {
$result[$i] = ($result[$i]-$v1vals[$i]);
}
}
return @result;
}} |
| verifyCount | description | prev | next | Top |
sub verifyCount
{
$count = scalar @_;
if ($count < 2) {
return -1;
}
else {
return $count;
}} |
| verifyLength | description | prev | next | Top |
sub verifyLength
{
my @array = @_;
$v = pop(@array);
my $length = (scalar @{$v});
my $index = (scalar @array);
for $i (0..$index) {
$vt = $_[$i];
if ( scalar @{$vt} != $length ) {
return -1;
}
else {
return $length;
}
}} |
| NAME (1) | Top |
| LinearAlgebra::InnerProduct |
| SYNOPSIS(1) | Top |
| @a = (1,4,2,3,6);
@b = (4,1,2,2,3); $result = innerProduct(\@a,\@b); |
| DESCRIPTION (1) | Top |
| Computes inner product of two arrays of numbers. |
| ERRORS (1) | Top |
| Returns "e" if arrays are not the same length. Returns "e" if only one array is given as input. Returns "e" if more than one array is given as input. |
| AUTHOR(1) | Top |
| Mark Thomas Joseph |
| NAME (2) | Top |
| LinearAlgebra::Subtract |
| SYNOPSIS(2) | Top |
| @a = (1,4,2,3,6);
@b = (4,1,2,2,3); $result = subtract(\@a,\@b); |
| DESCRIPTION (2) | Top |
| Subtracts arrays of numbers. |
| ERRORS (2) | Top |
| Returns "e" if arrays are not the same length. Returns "e" if only one array is given as input. |
| AUTHOR(2) | Top |
| Mark Thomas Joseph |
| NAME (3) | Top |
| LinearAlgebra::Add |
| SYNOPSIS(3) | Top |
| @a = (1,4,2,3,6);
@b = (4,1,2,2,3); $result = add(\@a,\@b); |
| DESCRIPTION (3) | Top |
| Adds arrays of numbers. |
| ERRORS (3) | Top |
| Returns "e" if arrays are not the same length. Returns "e" if only one array is given as input. |
| AUTHOR(3) | Top |
| Mark Thomas Joseph |
| NAME (4) | Top |
| LinearAlgebra::Average |
| SYNOPSIS(4) | Top |
| @a = (1,4,2,3,6);
@b = (4,1,2,2,3); $result = average(\@a,\@b); |
| DESCRIPTION (4) | Top |
| Computes average of arrays of numbers. |
| ERRORS (4) | Top |
| Returns "e" if arrays are not the same length. Returns "e" if only one array is given as input. |
| AUTHOR(4) | Top |
| Mark Thomas Joseph |
| NAME(1) | Top |
| verifyCount |
| SYNOPSIS(5) | Top |
| Counts the number of lists/arrays passed into LinearAlgebra in the @_ array |
| NAME(2) | Top |
| verifyLength |
| SYNOPSIS(6) | Top |
| Verifies matching lengths between all lists/arrays passed into LinearAlgebra in the @_ array |