Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 923903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:15:59+00:00 2026-05-15T19:15:59+00:00

I have this: using namespace boost::numeric::ublas; matrix<double> m (3, 2); int k = 0;

  • 0

I have this:

  using namespace boost::numeric::ublas;
    matrix<double> m (3, 2);

    int k = 0;
    for (int j = 0; j < m.size1 (); j++) {
        for (int i = 0; i < m.size2 (); i++)
            m (j, i) = k++;
    }

   m =
     0 1 
     2 3
     4 5

And I need to append another matrix m2 to m

 matrix<double> m2 (3, 1);
k = 0;
for (int i = 0; i < m2.size2 (); i++)
    m (i, 0) = k++;

m2 = 
  0
  1
  2

So, what I need to do to have this

  m =
         0 1 0
         2 3 1 
         4 5 2

Where can I find more information about operations like this? I ask because the information on http://www.boost.org/doc/libs/1_43_0/libs/numeric/ublas/doc/index.htm resembles more like an API, and it has not been so useful so far.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T19:16:00+00:00Added an answer on May 15, 2026 at 7:16 pm

    Well, this is not elegant, but is my first try:

    m.resize(m.size1(), m.size2()+1, true);
    column(m, m.size2()) = column(m2, 0);
    

    and, of course it needs to be adjusted if m2 has more than one column (or if there are differences in size1 between the two matrices)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code #include <iostream> using namespace std; int main(int argc,char **argv) {
I have this program in c++: #include <iostream> using namespace std; int main() {
I have a very simple function in C++: double testSpeed() { using namespace boost;
I have the following code: #include <boost/smart_ptr/shared_ptr.hpp> #include <boost/numeric/interval.hpp> #include <boost/math/distributions/students_t.hpp> using namespace boost::numeric;
I have this code (C#): using System.Collections.Generic; namespace ConsoleApplication1 { public struct Thing {
I have this web service : using System.Web.Services; namespace Contracts { [WebService(Namespace = http://tempuri.org/)]
If I have a service definition/implementation like this: using System; using System.ServiceModel; namespace aspace.service
I have the following code: #include <iostream> #include boost/unordered_map.hpp using namespace std; using namespace
Okay so basically : i have this simple example: main.cpp using namespace VHGO::Resource; std::list<BaseTable*>
I am using Numeric Library Bindings for Boost UBlas to solve a simple linear

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.