CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    May 2010
    Posts
    33

    Boost prod function

    I have a weird problem with the "prod" function of the Boost library. I am trying to multiply a vector with a matrix and get the result vector but I am failing


    The code is:

    Code:
    matrix <double> m_matrix1(2,2);
    matrix <double> m_matrix2(2,2);
    std::vector <double> m_result;
    
    
    
    m_result = prod(row(m_matrix1, 1), m_matrix2);

    The error is a long log starting with
    binary '=' : no operator found which takes a right-hand operand of type 'boost::numeric::ublas::matrix_vector_binary2<E1,E2,F>' (or there is no acceptable conversion)


    Can someone help me or link a simple and understandeable guide for the boost library? I already read the official documentation and could not solve

  2. #2
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: Boost prod function

    There's a big difference between a uBLAS vector, which is a mathematical construct, an a std::vector, which is merely a container representing a dynamic array.

  3. #3
    Join Date
    May 2010
    Posts
    33

    Re: Boost prod function

    I tried using matrix <double>, it did not work either

  4. #4
    Join Date
    May 2010
    Posts
    33

    Re: Boost prod function

    Bump this topic: I need to solve this problem.


    How can I multiply a matrix <double> single row with a complete matrix <double> to obtain an accessible vector of values with uBLAS?


    Someone help me please! Links to helping papers are well-accepted since boost mailing list is not helping

  5. #5
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: Boost prod function

    You had the right idea before, but you were trying to use a std::vector where you needed a boost::numeric::ublas::vector.

    (Note that row(matrix, i) returns a vector, so the matrix/vector form of prod() will be used which returns a vector.)

  6. #6
    Join Date
    May 2010
    Posts
    33

    Re: Boost prod function

    Thank you so much Lindley!

    Problem solved with your help!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured