[Developers] Fwd: Re: [ADMB Users] fill matrix with a vector

John Sibert sibert at hawaii.edu
Thu Mar 24 12:09:17 PDT 2011


This is a good suggestion from Dave in response to a query about how to 
fill a matrix. It is pretty general. All the user needs to do is fill 
the src vector with whatever is wanted and then call fill(..) with the 
appropriate arguments.

But there may be issues with ragged matrices, and the prototypes might 
be better as

    void fill(dvar_matrix& dest, const dvar_vector& src);

    void fill(dmatrix& dest, const dvector& src);

If you wanted to get fancy, you could replace the src argument with a 
pointer to the desired vector fill function. But that might be risky

John

-------- Original Message --------
Subject: 	Re: [ADMB Users] fill matrix with a vector
Date: 	Thu, 24 Mar 2011 11:33:37 -0700
From: 	dave fournier <davef at otter-rsch.com>
To: 	users at admb-project.org



It is a simple matter to write a function that uses a loop to do what
you want and then you just call
that function.  prototypes could be

     void fill(const dvar_matrix&  dest,const dvar_vector&  src);

     void fill(const dmatrix&  dest,const dvector&  src);



then you just use

            fill(M,v);



why wouldn't that do the job?




_______________________________________________
Users mailing list
Users at admb-project.org
http://lists.admb-project.org/mailman/listinfo/users




More information about the Developers mailing list