Boost logo

Ublas :

Subject: Re: [ublas] Converting Fortran 90 array access to use Matrix?
From: Reich, Darrell (DARRELL.REICH_at_[hidden])
Date: 2014-01-10 20:40:42

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...

Darrell the rookie apprentice

-----Original Message-----
From: Hartley, Bob [mailto:Bob.Hartley_at_[hidden]]
Sent: Thursday, January 09, 2014 9:49 AM
To: ublas_at_[hidden]
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::subrange(p, 0,n, 0,n) = -trans(a);
  boost::numeric::ublas::subrange(p, 0,n, n,size) =
  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?