Re: [Libmesh-users] multiplication of a dense matrix of type real with a vector of type number From: John Peterson - 2013-07-23 16:16 ```On Tue, Jul 23, 2013 at 10:10 AM, Kathrin Smetana wrote: > Hi all, > > I am working on a elastodynamics-problem with a complex-valued > displacement field. Hence I want to multiply a dense matrix of type real > with a vector of type number. As the DenseMatrix class only allows > multiplication of a matrix and a vector of the same type, I was wondering > if there might be a more elegant to do this than always changing the type > of the matrix before applying the function vector_mult. > More elegant to me would just be to use DenseVector instead of whatever you are currently using. Multiplication is defined between two members of R or two members of C, but not one of each :-) -- John ```

[Libmesh-users] multiplication of a dense matrix of type real with a vector of type number Kathrin Smetana <ksmetana@MI...>
 Re: [Libmesh-users] multiplication of a dense matrix of type real with a vector of type number From: John Peterson - 2013-07-23 16:16 ```On Tue, Jul 23, 2013 at 10:10 AM, Kathrin Smetana wrote: > Hi all, > > I am working on a elastodynamics-problem with a complex-valued > displacement field. Hence I want to multiply a dense matrix of type real > with a vector of type number. As the DenseMatrix class only allows > multiplication of a matrix and a vector of the same type, I was wondering > if there might be a more elegant to do this than always changing the type > of the matrix before applying the function vector_mult. > More elegant to me would just be to use DenseVector instead of whatever you are currently using. Multiplication is defined between two members of R or two members of C, but not one of each :-) -- John ```

 Re: [Libmesh-users] multiplication of a dense matrix of type real with a vector of type number From: Manav Bhatia - 2013-07-23 16:31 ```I have been doing this for a while using some modifications to the dense_matrix class. Attached are three files dense_matrix header and source, and the dense_matrix_blas_lapack to facilitate the multiplication of real matrix with complex vector. Hope this helps. Manav On Tue, Jul 23, 2013 at 12:15 PM, John Peterson On Tue, Jul 23, 2013 at 10:10 AM, Kathrin Smetana > wrote: > > > Hi all, > > > > I am working on a elastodynamics-problem with a complex-valued > > displacement field. Hence I want to multiply a dense matrix of type real > > with a vector of type number. As the DenseMatrix class only allows > > multiplication of a matrix and a vector of the same type, I was wondering > > if there might be a more elegant to do this than always changing the type > > of the matrix before applying the function vector_mult. > > > > More elegant to me would just be to use DenseVector instead of > whatever you are currently using. > > Multiplication is defined between two members of R or two members of C, but > not one of each :-) > > -- > John > > ------------------------------------------------------------------------------ > See everything from the browser to the database with AppDynamics > Get end-to-end visibility with application monitoring from AppDynamics > Isolate bottlenecks and diagnose root cause in seconds. > Start your free trial of AppDynamics Pro today! > http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk > _______________________________________________ > Libmesh-users mailing list > Libmesh-users@... > https://lists.sourceforge.net/lists/listinfo/libmesh-users > ```

 Re: [Libmesh-users] multiplication of a dense matrix of type real with a vector of type number From: John Peterson - 2013-07-23 16:42 ```On Tue, Jul 23, 2013 at 10:31 AM, Manav Bhatia I have been doing this for a while using some modifications to the > dense_matrix class. > > Attached are three files dense_matrix header and source, and the > dense_matrix_blas_lapack to facilitate the multiplication of real matrix > with complex vector. > > Hope this helps. > Manav, There is some good stuff in here, particularly the _nonhermitian_eig_lapack stuff. I'd like to get it into libmesh, do you have any test codes that verify it is working? -- John ```

 Re: [Libmesh-users] multiplication of a dense matrix of type real with a vector of type number From: Manav Bhatia - 2013-07-23 16:47 ```On Tue, Jul 23, 2013 at 12:42 PM, John Peterson > Manav, > > There is some good stuff in here, particularly > the _nonhermitian_eig_lapack stuff. > > I'd like to get it into libmesh, do you have any test codes that verify it > is working? > > -- > John > I am not sure if I have verified this code. I had started to add this a few months ago, but then it became unnecessary and I never got around to veryfying the code. I can test it at my end, and send you an updated patch if needed? Manav ```

 Re: [Libmesh-users] multiplication of a dense matrix of type real with a vector of type number From: John Peterson - 2013-07-23 16:58 ```On Tue, Jul 23, 2013 at 10:47 AM, Manav Bhatia > > On Tue, Jul 23, 2013 at 12:42 PM, John Peterson >> >> Manav, >> >> There is some good stuff in here, particularly >> the _nonhermitian_eig_lapack stuff. >> >> I'd like to get it into libmesh, do you have any test codes that verify >> it is working? >> >> -- >> John >> > > I am not sure if I have verified this code. I had started to add this a > few months ago, but then it became unnecessary and I never got around to > veryfying the code. > I can test it at my end, and send you an updated patch if needed? > That would be good, but it would be even better if we had a very short libmesh code that also demonstrated it working (not a full application code). It looks like it's designed to work when Number=Real, but I wonder if you've tested that it compiles with Number=std::complex? Also, what do you envision the user-facing interface for _nonhermitian_eig_lapack should be? For example, lu_solve, cholesky_solve, and svd call some underlying Lapack routines. DenseMatrix::eig() maybe? -- John ```

 Re: [Libmesh-users] multiplication of a dense matrix of type real with a vector of type number From: Manav Bhatia - 2013-07-23 17:18 ```On Tue, Jul 23, 2013 at 12:57 PM, John Peterson >>> Manav, >>> >>> There is some good stuff in here, particularly >>> the _nonhermitian_eig_lapack stuff. >>> >>> I'd like to get it into libmesh, do you have any test codes that verify >>> it is working? >>> >>> -- >>> John >>> >> >> I am not sure if I have verified this code. I had started to add this a >> few months ago, but then it became unnecessary and I never got around to >> veryfying the code. >> I can test it at my end, and send you an updated patch if needed? >> > > That would be good, but it would be even better if we had a very short > libmesh code that also demonstrated it working (not a full application > code). > > It looks like it's designed to work when Number=Real, but I wonder if > you've tested that it compiles with Number=std::complex? > > Also, what do you envision the user-facing interface for _nonhermitian_eig_lapack > should be? For example, lu_solve, cholesky_solve, and svd call some > underlying Lapack routines. DenseMatrix::eig() maybe? > > > -- > John > Good observation about the real/complex design. After looking at the code, I now realize that I never really instantiate the method (shows that I never got around to using it). I think that I was porting this implementation from some of my other codes, but stopped because I was able to get analytical expressions for the eigenvalues/eigenvectors of the matrix of interest. So, to answer your question, I have not verified that it works, and certainly not verified that it compiles with complex numbers. Both of these should not be difficult to do. A specialization to interface with complex lapack routines could also be added, but I have no experience with interfacing std::complex with the complex number representation for lapack. Any thoughts here? I like DenseMatrix::eig(). Perhps with arguments to return the eigenvalues and eigenvectors. I will try to put together this code and a small example and send it your way. Manav ```

 Re: [Libmesh-users] multiplication of a dense matrix of type real with a vector of type number From: Kathrin Smetana - 2013-07-23 17:48 ```Hi Manav, Many thanks for the files. I was also thinking of modifying the DenseMatrix class, but I was just wondering if there is a way to avoid that. Best, Kathrin On 07/23/2013 12:31 PM, Manav Bhatia wrote: > I have been doing this for a while using some modifications to the > dense_matrix class. > Attached are three files dense_matrix header and source, and the > dense_matrix_blas_lapack to facilitate the multiplication of real > matrix with complex vector. > Hope this helps. > Manav > > On Tue, Jul 23, 2013 at 12:15 PM, John Peterson > wrote: > > On Tue, Jul 23, 2013 at 10:10 AM, Kathrin Smetana > > wrote: > > > Hi all, > > > > I am working on a elastodynamics-problem with a complex-valued > > displacement field. Hence I want to multiply a dense matrix of > type real > > with a vector of type number. As the DenseMatrix class only allows > > multiplication of a matrix and a vector of the same type, I was > wondering > > if there might be a more elegant to do this than always changing > the type > > of the matrix before applying the function vector_mult. > > > > More elegant to me would just be to use DenseVector instead of > whatever you are currently using. > > Multiplication is defined between two members of R or two members > of C, but > not one of each :-) > > -- > John > ------------------------------------------------------------------------------ > See everything from the browser to the database with AppDynamics > Get end-to-end visibility with application monitoring from AppDynamics > Isolate bottlenecks and diagnose root cause in seconds. > Start your free trial of AppDynamics Pro today! > http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk > _______________________________________________ > Libmesh-users mailing list > Libmesh-users@... > > https://lists.sourceforge.net/lists/listinfo/libmesh-users > > ```

 Re: [Libmesh-users] multiplication of a dense matrix of type real with a vector of type number From: Kathrin Smetana - 2013-07-23 18:39 ```Hi John, I am using DenseVector and I would like to multiply it with a DenseMatrix to avoid unnecessary computations. Best, Kathrin Am 23.07.2013 um 12:15 schrieb John Peterson : > > > > On Tue, Jul 23, 2013 at 10:10 AM, Kathrin Smetana wrote: > Hi all, > > I am working on a elastodynamics-problem with a complex-valued displacement field. Hence I want to multiply a dense matrix of type real with a vector of type number. As the DenseMatrix class only allows multiplication of a matrix and a vector of the same type, I was wondering if there might be a more elegant to do this than always changing the type of the matrix before applying the function vector_mult. > > More elegant to me would just be to use DenseVector instead of whatever you are currently using. > > Multiplication is defined between two members of R or two members of C, but not one of each :-) > > -- > John ```

 Re: [Libmesh-users] multiplication of a dense matrix of type real with a vector of type number From: Roy Stogner - 2013-07-23 18:51 ```On Tue, 23 Jul 2013, Kathrin Smetana wrote: > I am using DenseVector and I would like to multiply it with > a DenseMatrix to avoid unnecessary computations. This should actually be pretty quick to enable. Let me give it a try. --- Roy ```

 Re: [Libmesh-users] multiplication of a dense matrix of type real with a vector of type number From: Roy Stogner - 2013-07-23 21:14 ```On Tue, 23 Jul 2013, Roy Stogner wrote: > On Tue, 23 Jul 2013, Kathrin Smetana wrote: > >> I am using DenseVector and I would like to multiply it with >> a DenseMatrix to avoid unnecessary computations. > > This should actually be pretty quick to enable. Let me give it a try. Let me know if https://github.com/libMesh/libmesh/pull/114 works for you? --- Roy ```