This queue is for tickets about the PDL-VectorValued CPAN distribution.

Report information
The Basics
Id:
134962
Status:
resolved
Priority:
Low/Low

People
Owner:
moocow [...] cpan.org
Requestors:
zmughal [...] cpan.org
Cc:
AdminCc:

BugTracker
Severity:
(no value)
Broken in:
1.0.9
Fixed in:
(no value)

Attachments
0001-Do-not-use-complex-FP-types-for-PP.patch



Date: Wed, 07 Apr 2021 03:32:32 -0400
To: bug-PDL-VectorValued@rt.cpan.org
Subject: [PATCH] Skip PDL native complex types
From: zmughal@cpan.org
Hello, I have made a small patch to fix the build after the introduction of native complex types to PDL: <https://github.com/zmughal/PDL-VectorValued/compare/skip-complex-types> The last PDL version that I have tested that works with PDL::VectorValued@1.0.9 is PDL@2.026. At PDL@2.028, the build fails due to using comparison operators on complex types. for PDL_v in 2.026 2.028; do cpm install -g --verbose PDL@$PDL_v; git checkout v1.0.9 ; cpanm --test-only -q . ; make clean >/dev/null; git clean -xf; done I have patched the code to use a new type attribute introduced in PDL@2.030. for PDL_v in 2.026 2.030 2.034; do cpm install -g --verbose PDL@$PDL_v; git checkout skip-complex-types ; cpanm --test-only -q . ; make clean >/dev/null; git clean -xf; done The build still fails at PDL == 2.028, but works for PDL > 2.028. Downstream dependencies continue to work: cpanm -q PDL::CCS PDL::Ngrams Best regards, - Zaki Mughal
Subject: 0001-Do-not-use-complex-FP-types-for-PP.patch
From 3cebbef242f8b43e5034872b6e0ea0e6c5e89d28 Mon Sep 17 00:00:00 2001 From: Zakariyya Mughal <zaki.mughal@gmail.com> Date: Sat, 27 Mar 2021 15:45:17 -0500 Subject: [PATCH] Do not use complex FP types for PP --- Utils/utils.pd | 18 ++++++++++++++---- VectorValued/Dev.pm | 10 +++++++++- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/Utils/utils.pd b/Utils/utils.pd index 3f1c65e..9bc836c 100644 --- a/Utils/utils.pd +++ b/Utils/utils.pd @@ -435,8 +435,13 @@ EOD # note: we export them to the PDL Core structure for use in # other modules (eg Image2D) foreach (keys %PDL::Types::typehash) { - my $ctype = $PDL::Types::typehash{$_}{ctype}; - my $ppsym = $PDL::Types::typehash{$_}{ppsym}; + my $type_info = $PDL::Types::typehash{$_}; + + # skip non-real value types (do not support comparison operators). + next if(exists $type_info->{real} && ! $type_info->{real}); + + my $ctype = $type_info->{ctype}; + my $ppsym = $type_info->{ppsym}; pp_addhdr(<<"FOO" @@ -557,8 +562,13 @@ Vectors with bad components should be moved to the end of the array. # Internal utility sorting routine for vv_qsortveci foreach (keys %PDL::Types::typehash) { - my $ctype = $PDL::Types::typehash{$_}{ctype}; - my $ppsym = $PDL::Types::typehash{$_}{ppsym}; + my $type_info = $PDL::Types::typehash{$_}; + + # skip non-real value types (do not support comparison operators). + next if(exists $type_info->{real} && ! $type_info->{real}); + + my $ctype = $type_info->{ctype}; + my $ppsym = $type_info->{ppsym}; pp_addhdr(<<"FOO" /*-- vector-based sorted index acquisition --*/ diff --git a/VectorValued/Dev.pm b/VectorValued/Dev.pm index d77455d..1a321d7 100644 --- a/VectorValued/Dev.pm +++ b/VectorValued/Dev.pm @@ -86,12 +86,20 @@ Wrapper for pp_def() which calls vvpp_expand() on 'Code' and 'BadCode' values in %args. =cut - +our @_REAL_TYPES = + map { $_->{ppsym} } + # Older PDLs: + # - no native complex types, did not have real key + # Newer PDLs: + # - native complex types, have real key + grep { ! exists $_->{real} || $_->{real} } + @PDL::Types::typehash{PDL::Types::typesrtkeys()}; sub vvpp_def { my ($name,%args) = @_; foreach (qw(Code BadCode)) { $args{$_} = vvpp_expand($args{$_}) if (defined($args{$_})); } + $args{GenericTypes} = \@_REAL_TYPES unless exists $args{GenericTypes}; PDL::PP::pp_def($name,%args); } -- 2.20.1
Hi Zaki, Many thanks for the patch & the clear report! I've applied your patch to the master repository (which unfortunately is still SVN-based and "private") and pushed it to CPAN as PDL::VectorValued v1.0.10. marmosets, Bryan


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.