Questions tagged [ublas]

uBLAS is a C++ template class library that provides BLAS level 1, 2, 3 functionality for dense, packed and sparse matrices.

uBLAS is a C++ template class library that provides BLAS level 1, 2, 3 functionality for dense, packed and sparse matrices. The design and implementation unify mathematical notation via operator overloading and efficient code generation via expression templates.

http://www.boost.org/doc/libs/release/libs/numeric

99 questions
48
votes
3 answers

Why is boosts matrix multiplication slower than mine?

I have implemented one matrix multiplication with boost::numeric::ublas::matrix (see my full, working boost code) Result result = read (); boost::numeric::ublas::matrix C; C = boost::numeric::ublas::prod(result.A, result.B); and another one…
Martin Thoma
  • 124,992
  • 159
  • 614
  • 958
17
votes
1 answer

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…
Translunar
  • 3,739
  • 33
  • 55
14
votes
2 answers

Boost vectors versus STL vectors

How do boost::numeric::ublas::vector and std::vector compare in runtime efficiency? Is it safe to assume that I can convert an entire program from using std::vector to use boost::numeric::ublas::vector just by writing: #include…
Rafael S. Calsaverini
  • 13,582
  • 19
  • 75
  • 132
14
votes
3 answers

ublas matrix expression tutorial/examples

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
Anycorn
  • 50,217
  • 42
  • 167
  • 261
13
votes
1 answer

How to transpose matrix using uBLAS?

I am a newbie in C++ Boost uBLAS library so I have a noob question - how to transpose a matrix using this library? I could not find question here: http://www.boost.org/doc/libs/1_44_0/libs/numeric/ublas/doc/html/index.html
user306080
  • 1,409
  • 3
  • 16
  • 37
11
votes
2 answers

Why Eigen is 5x slower than ublas on following example?

At Eigen version I use "true" fixed size matrices and vectors, better algorithm (LDLT versus LU at uBlas), it uses SIMD instructions internally. So, why it is slower than uBlas on following example? I am sure, I am doing something wrong - Eigen MUST…
qble
  • 1,256
  • 2
  • 12
  • 29
9
votes
2 answers

Prevent expression templates binding to rvalue references

I understand that doing something like the following: auto&& x = Matrix1() + Matrix2() + Matrix3(); std::cout << x(2,3) << std::endl; Will cause a silent runtime error if the matrix operations use expression templates (such as boost::ublas). Is…
Clinton
  • 22,361
  • 15
  • 67
  • 163
8
votes
4 answers

Initializing boost matrix with a std::vector or array

I have a method that takes a std::vector as one of its parameters. Is there a way I can initialize a matrix by assigning the std::vector to the matrix? Here's what I tried to do below. Does anyone know how i can achieve assigning the vector (or even…
user399540
  • 269
  • 1
  • 4
  • 7
7
votes
5 answers

filling a boost vector or matrix

Is there a single-expression way to assign a scalar to all elements of a boost matrix or vector? I'm trying to find a more compact way of representing: boost::numeric::ublas::c_vector v; for (size_t i=0; i
Mr Fooz
  • 109,094
  • 6
  • 73
  • 101
7
votes
2 answers

Boost uBLAS matrix/vector product

can someone please provide an example of how to use uBLAS product to multiply things? Or if there's a nicer C++ matrix library you can recommend I'd welcome that too. This is turning into one major headache. Here's my code: vector
Budric
  • 3,599
  • 8
  • 35
  • 38
7
votes
1 answer

Traversing a boost::ublas matrix using iterators

I simply want to traverse a matrix from start to finish touching upon every element. However, I see that there is no one iterator for boost matrix, rather there are two iterators, and I haven't been able to figure out how to make them work so that…
The Vivandiere
  • 3,059
  • 3
  • 28
  • 50
7
votes
1 answer

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 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…
D R
  • 21,936
  • 38
  • 112
  • 149
6
votes
1 answer

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
AJM
  • 655
  • 1
  • 9
  • 19
6
votes
6 answers

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…
D R
  • 21,936
  • 38
  • 112
  • 149
5
votes
2 answers

Why is vectorization beneficial for Matlab programs? Is it the same for NumPy and Boost(uBLAS)?

Using vectorization to replace for-loops may increase Matlab programs' speed significantly. Is it because the vectorized codes are runned in parallel? Is vectorization also beneficial for program using NumPy or uBLAS?
zhanwu
  • 1,508
  • 5
  • 16
  • 27
1
2 3 4 5 6 7