Skip to content

mpinv isn't broadcasting #20

@KJ7LNW

Description

@KJ7LNW

I could be wrong here, but I sort of think that mpinv() should function about the same as minv() --- but broadcasting fails for mpinv():

minv() broadcasts the inverse:

pdl> $p = sequence(2,2,5)
pdl> p $p->minv
[
 [
  [-1.5  0.5]
  [   1    0]
 ]
 [
  [      -3.5        2.5]
  [         3         -2]
 ]
 [
  [      -5.5        4.5]
  [         5         -4]
 ]
...
]

whereas mpinv() blows up when trying the pseudo-inverse:

pdl> p $p->mpinv
PDL: PDL::Ops::gt(a,b,c): Parameter 'b':
  Mismatched implicit broadcast dimension 0: size 2 vs. 5
There are 3 PDLs in the expression; 2 broadcast dims.
   PDL IN EXPR.    BROADCAST DIMS
   #  0 (normal):        2       5
   #  1 (normal):        5
   #  2 (null)

.. at ops.pd line 136.
	PDL::Ops::__ANON__(PDL=SCALAR(0x564b231f17a0), PDL=SCALAR(0x564b23290390), "") called at /usr/local/lib64/perl5/PDL/LinearAlgebra.pm line 926
	PDL::mpinv(PDL=SCALAR(0x564b232406c8)) called at (eval 65) line 4
	main::__ANON__() called at /usr/local/bin/perldl line 682
	eval {...} called at /usr/local/bin/perldl line 682
	main::eval_and_report("p \$p->mpinv\x{a}") called at /usr/local/bin/perldl line 618
	main::process_input() called at /usr/local/bin/perldl line 638
	eval {...} called at /usr/local/bin/perldl line 638

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions