Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > PDL code

Reply
Thread Tools

PDL code

 
 
Mark Ohlund
Guest
Posts: n/a
 
      05-03-2004
I'm trying to use the PDL modules to perform a Vector Space search as
shown in: http://www.perl.com/pub/a/2003/02/19/engine.html

I'm running FreeBSD 4.9 w/ Perl 5.6.1 and 2.4.1 of PDL.

The source code for the search is:
http://www.perl.com/2003/02/19/examples/VectorSpace.pm

I'm calling this with the following code:

#!/usr/bin/perl

use Search::VectorSpace;

my @docs = ("the cat in the hat.", "A cat is a fine pet.",
"Dogs and cats make good pets.", "I haven't got a hat.");
my $engine = Search::VectorSpace->new( docs => \@docs, threshold => .04);
$engine->build_index();

while ( my $query = <STDIN> ) {
my %results = $engine->search( $query );
print join "\n>>", keys %results;
}

When I call the VectorSpace code, I get an error at line 180:

Can't modify non-lvalue subroutine call in concatenation (.) or string
at /usr/local/lib/perl5/5.6.1/Search/VectorSpace.pm line 180, near "$value;"

Line 180 is:

index( $vector, $offset ) .= $value;

I *think* the problem is that rather than using the PDL index function
which should set the value of the PDL vector object at $offset to
$value, Perl thinks I'm trying to access the intrinsic Perl index
function. I've tried prefacing the index call with PDL:: to no avail.

Does anyone have insight into what I may be doing wrong? I'll admit my
Perl is pretty rusty, but making use of this search would be a big help.
Thanks.

Mark.
 
Reply With Quote
 
 
 
 
Anno Siegel
Guest
Posts: n/a
 
      05-04-2004
Mark Ohlund <(E-Mail Removed)> wrote in comp.lang.perl.misc:

[snip]

> When I call the VectorSpace code, I get an error at line 180:
>
> Can't modify non-lvalue subroutine call in concatenation (.) or string
> at /usr/local/lib/perl5/5.6.1/Search/VectorSpace.pm line 180, near "$value;"
>
> Line 180 is:
>
> index( $vector, $offset ) .= $value;
>
> I *think* the problem is that rather than using the PDL index function
> which should set the value of the PDL vector object at $offset to
> $value, Perl thinks I'm trying to access the intrinsic Perl index
> function. I've tried prefacing the index call with PDL:: to no avail.


No, the error message would be different ("Can't modify index in
concatenation (.) or string at..."). It's calling a user-defined
sub alright, and the sub *would* have to be an lvalue sub for the
modification to work. It looks like you have found a bug.

Anno
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PDL - Errors in PDL::Gaussian, maybe install? Keflavich Perl Misc 0 02-15-2007 08:03 PM
PDL function call failing Mark Ohlund Perl 1 05-02-2004 08:48 AM
I am having problems installing PDL using CPAN Jeff Silverman Perl Misc 0 11-11-2003 08:26 PM
linear algebra extensions (similar to PDL) in Ruby? Jose Quesada Ruby 1 09-20-2003 03:29 AM
PDL::Slatec Problem of eigenvalue of Matrix Junmou Zhang Perl 0 07-10-2003 03:10 AM



Advertisments