AI-NeuralNet-Hopfield
view release on metacpan or search on metacpan
lib/AI/NeuralNet/Hopfield.pm view on Meta::CPAN
my $new_matrix = Math::SparseMatrix->new($matrix_rows, 1);
for (my $row = 1; $row <= $matrix_rows; $row++) {
my $value = $matrix->get($row, $col);
$new_matrix->set($row, 1, $value);
}
return $new_matrix;
}
sub print_matrix() {
my $matrix = shift;
my $rs = $matrix->{_rows};
my $cs = $matrix->{_cols};
for (my $i = 1; $i <= $rs; $i++) {
for (my $j = 1; $j <= $cs; $j++) {
say "[$i,$j]" . $matrix->get($i, $j);
}
}
}
t/00-load.t view on Meta::CPAN
#!perl -T
use 5.006;
use strict;
use warnings FATAL => 'all';
use Test::More;
plan tests => 2;
BEGIN {
use_ok( 'AI::NeuralNet::Hopfield' ) || print "Bail out!\n";
use_ok( 'Math::SparseMatrix' ) || print "Bail out\n";
}
diag( "Testing AI::NeuralNet::Hopfield $AI::NeuralNet::Hopfield::VERSION, Perl $], $^X" );
( run in 1.025 second using v1.01-cache-2.11-cpan-de7293f3b23 )