help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: yet another DLD question


From: Andy+Alison Adler
Subject: Re: yet another DLD question
Date: Thu, 05 Nov 1998 23:04:19 -0500

John W. Eaton wrote: 
> On  4-Nov-1998, Andy+Alison Adler <address@hidden> wrote:
> | I've got this bizarre bug:
> |
> | if I put my code
> |
> | [SNIP]
> |    Octave_map As;
> | [SNIP]
> |    ColumnVector coefV=  As["coef"] . vector_value();
> |    double * coef =  coefV . fortran_vec();
> |    for ( int i= 0; i<  nnz; i++ )
> |       printf("a= %f\n", *(coef+i));
> | [SNIP]
> |
> | then it works fine, giving output
> |
> | a= 1.000000
> | a= 2.000000
> | a= 3.000000
> | etc.
> |
> |
> | However, if I try to abbreviate by putting
> |
> | [SNIP]
> |    double * coef =  As["coef"] . vector_value() . fortran_vec();
> |    for ( int i= 0; i<  nnz; i++ )
> |       printf("a= %f\n", *(coef+i));
> | [SNIP]
> |
> | then the first value printed is always wrong
> | a= 39.399666
> | a=  1.000000
> | a=  2.000000

> 
> I think either approach should work.  I created a simple test example
> and it worked fine.  Perhaps there is another problem in your code
> that causes a memory overwrite.  Can you please send me a complete
> example that demonstrates the problem?

I has this problem in two places. I solved one, which was
caused by the SuperLU routine I was calling freeing my
pointer.

The one here is probably something equally stupid. I'll 
try to figure it out myself before I post the code.

Thanks for your help

andy,



reply via email to

[Prev in Thread] Current Thread [Next in Thread]