For this I would urge the use of “transpose” to be ultra-clear about the intention; “mv(0,-1)” would not achieve the desired effect if there were >2 dimensions!
Eric, great work on getting something working! I’d recommend you put it on CPAN (with suitable tests and test data, obviously) as PDL::IO::Touchstone (if that last bit is the most meaningful label). These days in PDL we refer to “broadcasting” and “pthreading” (because the old terminology of “threading” was ambiguous and confusing). Luis’s steer to read PDL::ParallelCPU is exactly right; my hypersummary is that for things like multiplication (which are inherently of scalars), any higher-dimension thing than the inherent dimensions of the operation (even multiplying of a multi-element vector) will automatically do “broadcasting”. The only limitation is that POSIX threading (aka “pthreading”) will only take place with ndarrays with >1e6 elements. That is configurable; see the document for more. Best regards, Ed From: Luis Mochán<mailto:moc...@fis.unam.mx> Sent: 06 July 2022 13:43 To: Eric Wheeler<mailto:p...@lists.ewheeler.net>; Luis Mochan<mailto:moc...@icf.unam.mx> Cc: pdl-general@lists.sourceforge.net<mailto:pdl-general@lists.sourceforge.net> Subject: Re: [Pdl-general] How do you create a set of cdouble matrices from (real, imag) values? Hi Eric On July 5, 2022 11:19:58 PM CDT, Eric Wheeler <p...@lists.ewheeler.net> wrote: >On Fri, 1 Jul 2022, Luis Mochan wrote: >> ... >> my $Sm=$S->mv(0,-1) # position, filerow >> ->reshape(2,2, $rows); # column, row, filerow > >Can you explain what $S->mv(0,-1) does with respect to the -1 value? The >pdl docs don't cover what -1 means (or at least its not covered near the >`mv` function). Maybe -1 is has a standard meaning in PDL terminology? > 'mv(0,-1)' moves the first to the last dimension. In this case there are only two dimensions before the reshape, so you could also use 'mv(0,1)', 'transpose', 'xchg(0,1)'. >I think I have it working for our dataset. The resulting code is more >complicated than your beautiful example because I had to handle touchstone >edge cases (like 2-port is col-major and all others are row-major) as well >as arbitrary matrix sizes (2x2, 4x4, etc)---but it works! Great! > >Questions: > >Does PDL parallelize vector arithmetic somehow or do I need to do >something further to enable threading? > >If so, how does it parallelize the work? > >Is there anything to consider when building PDL code so it scales for >parallelization? > I understand that in your case, the range of your row index, the 'broadcast' dimension, would be split into subranges and each fed to a different core. Look at the documentation of PDL::ParallelCPU Regards, Luis -- Enviado desde mi celular; disculpe la horrografía _______________________________________________ pdl-general mailing list pdl-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pdl-general
_______________________________________________ pdl-general mailing list pdl-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pdl-general