help-octave
[Top][All Lists]

## yet another DLD question

 From: John W. Eaton Subject: yet another DLD question Date: Wed, 4 Nov 1998 22:48:07 -0600 (CST)

```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
|
| (the first value is often 39.??? but is sometimes different)
|
| MY QUESTION IS:
|
| is As["coef"] . vector_value() . fortran_vec() illegal?
| or is this a bug?
| or am I doing something wrong

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?

Thanks,

jwe

```