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
5
votes
1 answer

regarding element-by-element operations in boost::ublas

I find that boost::ublas doesn't support element-by-element operations and operations in sequence very well (but the efficiency is pretty high :)) I am trying to D = A^2 .* B^3 .* C where A, B, C are all square matrices of the same size, operator…
user1285419
  • 2,183
  • 7
  • 48
  • 70
4
votes
4 answers

BOOST uBLAS matrix product extremely slow

Is there a way to improve the boost ublas product performance? I have two matrices A,B which i want to mulitply/add/sub/... In MATLAB vs. C++ i get the following times [s] for a 2000x2000 matrix Operations OPERATION | MATLAB | C++ (MSVC10) A + B …
8472
  • 151
  • 1
  • 8
4
votes
1 answer

Creating a matrix from vectors in C++ with uBLAS

If I have n vectors of length m and want to join them to create an mxn matrix, what is the most efficient way to do this in C++ using Boost uBLAS? Obviously, I can just loop though them and assign each matrix element with the corresponding vector…
al0
  • 308
  • 1
  • 2
  • 13
4
votes
1 answer

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 arrayM(1, 3) = { {1.0, 2.0, 3.0} };
Journey Man
  • 143
  • 10
4
votes
1 answer

why has uBLAS no `operator*(matrix, vector)`?

In the doc, they say We decided to use no operator overloading for ... They provide prod instead for these. But why? Is there any good reason? I like to do matrix * vector (as in most other languages). I like to understand why they did not…
Albert
  • 65,406
  • 61
  • 242
  • 386
3
votes
1 answer

How do you get an iterator to a row of a boost::numeric::ublas::matrix?

I'm working on matrix multiplication, and I would like an iterator over a single row of a boost matrix? Can this be done? Currently, I have to get an iterator and advance it. It seems like too much CPU work /…
Zak
  • 12,213
  • 21
  • 59
  • 105
3
votes
2 answers

eigen value solver based on BOOST UBLAS

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…
Abruzzo Forte e Gentile
  • 14,423
  • 28
  • 99
  • 173
3
votes
1 answer

C++ boost ublas + units dimension constraints

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…
Anycorn
  • 50,217
  • 42
  • 167
  • 261
3
votes
4 answers

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 arrayM(1, 3)[arraySize]; boost::numeric::ublas::matrix(1, 3)…
Journey Man
  • 143
  • 10
3
votes
2 answers

C++11 compatibility of sparse matrix implementations

I try to create a compressed_matrix using a coordinate_matrix as a builder: #include #include using namespace boost::numeric::ublas; int main(int argc, char** argv) { …
choeger
  • 3,562
  • 20
  • 33
3
votes
2 answers

returning a boost ublas matrix by value working only in release config for vs2012

I'm using visual studio 2012 and I isolated a problem in my code to this, but I can't solve it. When running it in release mode it works perfect, but I get an error if I run it in debug. The code is: #include "stdafx.h" #include…
German Capuano
  • 5,183
  • 6
  • 23
  • 35
3
votes
4 answers

Efficient solution of linear system Ax= b when only one of the constant term changes

How does one solve a large system of linear equations efficiently when only a few of the constant terms change. For example: I currently have the system Ax= b. I compute the inverse of A once, store it in a matrix and each time any entry updates in…
Atlas
  • 153
  • 3
  • 12
2
votes
2 answers

Boost uBLAS Matrix Reference

I'm wondering if it's possible to get the address of an individual element of a Boost uBLAS matrix? That is boost::numeric::ublas::matrix bob(3,3); some_function(&bob[2][2]); Now, of course the second line won't work... but I'd like it…
Richard
  • 56,349
  • 34
  • 180
  • 251
2
votes
3 answers

Changing the constructor of a boost vector

I'm trying to change the constructor behaviour of a BOOST uBLAS vector and was wondering what the best way to do this is. I want to initialise the components (co-ordinates) of a 2D vector using the constructor, for example: Instead of: typedef…
kieranhood
  • 21
  • 1
  • 3
2
votes
1 answer

How does boost::uBLAS handle nested products of matrices?

I read an article about the optimisation of nested product of matrices, using dynamic programming, and I wanted to see how it is implemented in boost::uBLAS. I'm not sure I understood the documentation (they talk about it at the very end of the…
pintoch
  • 2,293
  • 1
  • 18
  • 26