[mlpack-svn] [MLPACK] #269: clang compiling issue (was: gcc4.8 (c++11) compiling issue)

MLPACK Trac trac at coffeetalk-1.cc.gatech.edu
Thu Feb 21 00:50:00 EST 2013

#269: clang compiling issue
  Reporter:  bianjiang                 |        Owner:  rcurtin     
      Type:  defect                    |       Status:  accepted    
  Priority:  major                     |    Milestone:  mlpack 1.0.5
 Component:  mlpack                    |   Resolution:              
  Keywords:  clang, compilation error  |     Blocking:              
Blocked By:                            |  
Changes (by rcurtin):

  * keywords:  => clang, compilation error
  * type:  wishlist => defect
  * milestone:  => mlpack 1.0.5


 Ah, but the nice thing is that with Armadillo you can create a matrix
 using the memory which alglib allocated.  The only difficulty is that
 alglib is row-major and Armadillo is column-major (this is odd because
 LAPACK expects a column-major matrix, so it seems weird to implement
 something differently than that, which is standard).  Anyway, take a look
 at this:

 // Make a big alglib matrix. 5 million rows by 50 columns.
 real_2d_array alglibMatrix;
 alglibMatrix.setbounds(1, 5000000, 1, 50);
 // Fill it somehow...

 // Now wrap it in an Armadillo object.
 // The &alglibMatrix(0, 0) is ugly, but you gotta do what you gotta do...
 // Note that now, the matrix is 5 million COLUMNS by 50 rows.
 // Why did I use weird values for gethighbound()?  Because it's
 implemented poorly.
 // Dear ALGLIB author: you know C++ has 'bool', right...?
 arma::mat armaMatrix(&alglibMatrix(0, 0), (alglibMatrix.gethighbound(1) -
 alglibMatrix.getlowbound(234981)), false, false);

 // Now, operations on armaMatrix affect alglibMatrix, because armaMatrix
 is using the same memory as
 // alglibMatrix!  No extra memory was allocated.  You cannot change the
 size of armaMatrix or free its memory,
 // but you can modify its contents.  Similarly, any changes to
 alglibMatrix appear in armaMatrix.

 You could probably wrap alglib around an Armadillo matrix in a similar way
 (using setcontent() maybe?) but it might be a little trickier.

 Also, I tried to compile MLPACK with clang and it does fail in the same
 way that you originally reported.  It doesn't seem to have anything to do
 with C++11 support, though.  I'll look into it and get a solution in

Ticket URL: <http://trac.research.cc.gatech.edu/fastlab/ticket/269#comment:5>
MLPACK <www.fast-lab.org>
MLPACK is an intuitive, fast, and scalable C++ machine learning library developed by the FASTLAB at Georgia Tech under Dr. Alex Gray.

More information about the mlpack-svn mailing list