ublas

filling a boost vector or matrix

Is there a single-expression way to assign a scalar to all elements of of a boost matrix or vector? I'm trying to find a more compact way of representing: boost::numeric::ublas::c_vector<float, N> v; for (size_t i=0; i<N; i++) { v[i] = myScalar; } The following do not work: boost::numeric::ublas::c_vector<float, N> v(myScal...

C++ Question about Boost UBLAS

Does the Boost UBLAS library have a built-in solver for solving systems of equations? The documentation implies that all the ublas solver routines require the matrix to already be in triangular form. But, if a matrix is not in triangular form, is there anything in ublas that can reduce the matrix and then back-substitute, to solve a ...

UBLAS Matrix Finding Surrounding Values of a Cell?

I am looking for an elegant way to implement this. Basically i have a m x n matrix. Where each cell represents the pixel value, and the rows and columns represent the pixel rows and pixel columns of the image. Since i basically mapped points from a HDF file, along with their corresponding pixel values. We basically have alot of empty p...

Initializing a ublas vector from a C array

I am writing a Matlab extension using the C++ ublas library, and I would like to be able to initialize my ublas vectors from the C arrays passed by the Matlab interpeter. How can I initialize the ublas vector from a C array without (for the sake of efficiency) explicitly copying the data. I am looking for something along the following li...

Looping over the non-zero elements of a uBlas sparse matrix.

I have the following sparse matrix that contains O(N) elements boost::numeric::ublas::compressed_matrix<int> adjacency (N, N); I could write a brute force double loop to go over all the entries in O(N^2) time like below, but this is going to be too slow. for(int i=0; i<N; ++i) for(int j=0; j<N; ++j) std::cout << adjacency(...

Operator overloading for a class containing boost::numeric::ublas::matrix<double>

I have a class which contains a few boost::numeric::ublas::matrix's within it. I would like to overload the class's operators (+-*/=) so that I can act on the set of matrices with one statement. However this seems to require temporary instances of my class to carry values around without modifying the original class. This makes sense...

ublas::bounded_vector<> being resized?

Now, seriously... I'll refrain from using bad words here because we're talking about the Boost fellows. It MUST be my mistake to see things this way, but I can't understand why, so I'll ask it here; maybe someone can enlighten me in this matter. Here it goes: uBLAS has this nice class template called bounded_vector<> that's used to crea...

ublas matrix expression tutorial/examples

hi I am trying to implement certain matrix operations but I am lost in the internals of ublas library. is there a resource such as tutorial or an example on how to implement new ublas matrix expressions? Thanks ...

how to set base index in ublas matrix?

hello I have searched the web but could not find an answer. how do I have set base index in the matrix, such that indexes start from values other than zero? for example: A(-3:1) // Matlab/fortran equivalent A.reindex(-3); // boost multi-array equivalent thanks ...

How to create a array of boost matrices?

How can I define a array of boost matrices as a member variable? None of the following worked. boost::numeric::ublas::matrix<double> arrayM(1, 3)[arraySize]; boost::numeric::ublas::matrix<double>(1, 3) arrayM[arraySize]; boost::numeric::ublas::matrix<double> arrayM[arraySize](1, 3); Thanks, Ravi. ...

How to create a const boost matrix?

How can I create a const boost matrix? The following did not work: const boost::numeric::ublas::matrix<double> arrayM(1, 3) = { {1.0, 2.0, 3.0} }; ...

boost ublas: rotate 2d vector

Erm. I hope I am seriously overlooking something. I want to rotate a 2d vector (kartesian) v by a certain angle phi. I can't find a function that generates the appropriate matrix or just performs that function. I know how to do this by hand. I am looking for a ublas utility "something" that does this for me. ...

Passing Boost uBLAS matrices to OpenGL shader

I'm writing an OpenGL program where I compute my own matrices and pass them to shaders. I want to use Boost's uBLAS library for the matrices, but I have little idea how to get a uBLAS matrix into OpenGL's shader uniform functions. matrix<GLfloat, column_major> projection(4, 4); // Fill matrix ... GLuint projectionU = glGetUniformLocat...

C++ boost ublas + units dimension constraints

hello. I am seeking advice on design/general idea on how to force matrix dimension constraints on ublas matrix/vector possibly using boost units. For example, let matrix A have dimensions of time x force (for example) // does not have dimensions, time x force and force x time are not distinguished. matrix<double> A; //something like?...

What are the differences between the various boost ublas sparse vectors?

In boost::numeric::ublas, there are three sparse vector types. I can see that the mapped_vector is essentially an stl::map from index to value, which considers all not-found values to be 0 (or whatever is the common value). But the documentation is sparse (ha ha) on information about compressed_vector and coordinate_vector. Is anyone ...

where is the ublas::vector push_back ?

hi may i know where is the ublass::vector push_back or what ever does the same ? p.s (i'm not talking about std::vector) ...

How to use Boost uBLAS C++ library in an iPhone project?

I want to use Boost library in my iPhone project, specifically only boost::numeric::ublas. I managed to build static libraries for boost in order to link them in my iPhone project. However, when I look at those .a libraries I can't find one that's related to ublas (I tried ./bootstrap.sh --with-libraries=ublas in terminal but no luck). D...

eigen value solver based on BOOST UBLAS

Hi All These days I am starting learning BOOST UBLAS and BOOST MATH for my tasks. I was bit surprised to find that there is no eigenvalue/vector solver in it. Since I would like to stick with Boost libs and their matrix classes, do you know about any library built on top of boost ublas capables to find eigenvalues and other stuff that...