[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Casting a Matrix object as a single dimensional array
From: |
Chidambaram Annamalai |
Subject: |
Re: Casting a Matrix object as a single dimensional array |
Date: |
Tue, 8 Jun 2010 18:54:17 +0530 |
> Please reply on the bottom of the post. It makes the thread easier to
> follow.
>
> Matrix mymatrix (4, 4);
> double * ptr;
>
> ptr = mymatrix.fortran_vec ();
>
> for (int i = 0; i < 16; i++)
> ptr[i] = i;
>
> const double * cptr;
>
> cptr = mymatrix.fortran_vec (); // or data ()
>
> for (int i = 0; i < 16; i++)
> printf ("%1.0f, ", cptr[i]);
>
> David
>
Thank you Mr. Hajek and thank you David! That was exactly what I wanted.
Regards,
Chillu