Re: Converting Fortran 90 array access to use Matrix?
"Reich, Darrell" <[email protected]>
| Newsgroups | gmane.comp.lib.boost.ublas |
|---|---|
| Message-ID | <56A4B6DB41508E44B3E3BE1603D25BCF03C833A6@0461-its-exmb01.us.saic.com> |
Good answer! I didn't realize from the nerdy / cryptic documentation pages that subrange could be used on the LHS (an L-value). When this project is over, I really should collect up a few examples and post them for boost ublas newbies on how to use the library. The current documentation assumes more of a computer science / linear algebra PhD background. Anyway, once you get it, more fun that C arrays. I promote you to Bob the advanced beginner IMHO. I was looking in the right place but close only counts in horseshoes... Thanks! Darrell the rookie apprentice -----Original Message----- From: Hartley, Bob [mailto:[email protected]] Sent: Thursday, January 09, 2014 9:49 AM To: [email protected] Subject: Re: [ublas] Converting Fortran 90 array access to use Matrix? Does subrange not do what you want? <snippet... it should be mostly readable...> (...input matrix a of size nxn ) int n = a.size2(); int size = 2*n; boost::numeric::ublas::matrix<double>p(size,size); boost::numeric::ublas::subrange(p, 0,n, 0,n) = -trans(a); boost::numeric::ublas::subrange(p, 0,n, n,size) = ublas::zero_matrix<double>(n,n); boost::numeric::ublas::subrange(p, n,size, 0,n) = temp * dt; boost::numeric::ublas::subrange(p, n,size, n,size) = a; Bob the amateur. ________________________________________ What is the most efficient way to convert Fortran's column array access like shown below to C++? a(i,:) = 0 ! set entire column to zero I suspect best solution might use matrix proxies like matrix_row? Can this be done on one line without the for loop? Can you help me fix the syntax on the commented out code that attempted to use iterators?