Boost logo

Boost Users :

From: Jon Agiato (JonAgiato_at_[hidden])
Date: 2003-03-19 11:00:03


Hi, you need to add in #include <boost/numeric/ublas/io.hpp>

#include <iostream>
#include <cstdlib>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>

int main(int argc, char *argv[])
{
 using namespace boost::numeric::ublas;
 
 matrix<double> m (3, 3);
 for (int i = 0; i < m.size1 (); ++ i)
  for (int j = 0; j < m.size2 (); ++ j)
   m (i, j) = 3 * i + j;

 std::cout << m << std::endl;
}

Jon Agiato
JonAgiato_at_[hidden]

----- Original Message -----
  From: Zdenek Hurak
  To: boost-users_at_[hidden]
  Sent: Wednesday, March 19, 2003 10:13 AM
  Subject: [Boost-Users] Help with my first compilation with uBLAS

  Hello,

  Could anybody help me with my first compilation of a simple code using
  MATRIX class from uBLAS library?

  Namely, I can't set all the "include" properly. Have a look at the code
  snipet:

  ----------------------------------------------------------------------------------
  #include <iostream.h>
  #include <stdlib.h>

  #include <boost/numeric/ublas/matrix.hpp>

  int main(int argc, char *argv[])
  {
      using namespace boost::numeric::ublas;
      matrix<double> m (3, 3);
      for (int i = 0; i < m.size1 (); ++ i)
        for (int j = 0; j < m.size2 (); ++ j)
          m (i, j) = 3 * i + j;
      std::cout << m << std::endl;
  }
  ------------------------------------------------------------------------------------

  I get an error message:
  main.cpp:21:42: boost/numeric/ublas/matrix.hpp: No such file or directory

  I use gcc/g++ on i386-linux and I set a parameter of the compiler to:

  --x-includes=/home/hurak/Documents/cpluspluswork/boost_1_29_0/

  which is exactly the parent directory of "boost/numeric/ublas/matrix.hpp".

  Could you please explain to me what is still missing? I cannot find any
  example on the BOOST web. I am not much experienced in all this "include"
  stuff. Before delving deeper into the compiler options I would like to know
  if everything else is correct.

  Thanks
  Zdenek Hurak

        Yahoo! Groups Sponsor
              ADVERTISEMENT
             
       
       

  Info: <http://www.boost.org>
  Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl>
  Unsubscribe: <mailto:boost-users-unsubscribe_at_[hidden]>

  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

[Non-text portions of this message have been removed]


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net