Hi,
I use the routine
    PDL::LinearAlgebra::Complex::cgtsv
to solve systems of linear equations described by a tridiagonal
matrix. The arguments are the sub-diagonal, the diagonal, the
supradiagonal and the right hand side of the equations. I found one of
my programs has a misterious error, as  it uses cgtsv to solve a
symmetric tridiagonal system,

my $sub_diagonal=my $supra_diagonal;
cgstv($sub_diagonal, $diagonal, $supra_diagonal, $right_hand_side);

I didn't realize until today that cgstv modified the contents of the
$sub_diagonal array, and thus, it silently and erroneously modified the
$supra_diagonal, which in my case was an ndarray that shared the
numerical data.

The signature of the function is:

 cgtsv
      Signature: (complex [phys]DL(n);complex  [phys]D(n);complex  
[phys]DU(n);complex  [io,phys]B(n,nrhs); int [o,phys]info())

As the parameter 'DL' is not marked 'io' I erroneously assumed it wouldn't be
modified, although the documentations states further down that it
does.

My questions are: Is the signature above correct? Should parameters
that are modified be marked 'io' or something else? Or would it be better
for routines such as cgtsv to make a copy of their inputs to avoid
modifying the original arguments? Would it be considered too costly in
general?

Best regards,
Luis


-- 

                                                                  o
W. Luis Mochán,                      | tel:(52)(777)329-1734     /<(*)
Instituto de Ciencias Físicas, UNAM  | fax:(52)(777)317-5388     `>/   /\
Av. Universidad s/n CP 62210         |                           (*)/\/  \
Cuernavaca, Morelos, México          | moc...@fis.unam.mx   /\_/\__/
GPG: 791EB9EB, C949 3F81 6D9B 1191 9A16  C2DF 5F0A C52B 791E B9EB


_______________________________________________
pdl-devel mailing list
pdl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pdl-devel

Reply via email to