A Boost C++ library directed towards scientific computing on the level of basic linear algebra constructions with matrices and vectors and their corresponding abstract operations.
Questions tagged [boost-ublas]
50 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
6
votes
3 answers
GDB Can't Display Boost uBLAS Matrix?
I have a successfully compiled program using Boost's implementation of uBLAS matricies. Alas, debugging with gdb is proving problematic as I could find no way to see the contents of my matrices while debugging. When I try to see an element of a…

Richard
- 56,349
- 34
- 180
- 251
5
votes
2 answers
Remove non-generic template parameter on C
I'm using ublas for my matrix code, but I want it to be exchangeable, so I was doing this:
typedef boost::numeric::ublas::matrix cMatrix;
Today, I need to change some of this matrixes to bounded sizes, so I will also have this:
typedef…

renatolond
- 106
- 1
- 7
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 c_vector
Is it possible to create a c_vector with the values [12 398 -34] (as an example), in a single line?
As far as I can see the only viable constructor is:
c_vector(vector_expression const&)
which takes a VectorExpression, which seem to be…

Shoe
- 74,840
- 36
- 166
- 272
4
votes
1 answer
boost::ublas how to get determinant of int matrix?
I found the function that calculates the determinant of boost::ublas matrix:
template
ValType det_fast(const ublas::matrix& matrix)
{
// create a working copy of the input
ublas::matrix mLu(matrix);
…

AeroSun
- 2,401
- 2
- 23
- 46
4
votes
2 answers
Why doesn't the arrow operator "->" work on boost::numeric::ublas::vector<...>::iterator?
Consider this code:
struct CData
{
int bar() { return 1; }
};
int main()
{
typedef boost::numeric::ublas::vector vec_data_t;
vec_data_t foo;
for (vec_data_t::iterator it = foo.begin();
it != foo.end();
…

oxygene
- 621
- 4
- 14
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
2 answers
how do I pass the boost matrix prod() function as a multiplies function?
I'm trying to perform a matrix exponentiation, but I don't want to copy/paste my exponentiation function, and would rather use class templates. The problem is that for boost matrices, to multiply matrices, you use the prod function (instead of…

Brian
- 2,499
- 3
- 24
- 26
3
votes
1 answer
uBLAS matrix clear memory
I have a uBLAS matrix, like so:
boost::numeric::ublas::matrix mat(50000,50000);
Once I'm done with a set of calculations on the matrix, I want its memory freed.
I have been using mat.clear() which, according to the docs, "clears the…

Richard
- 56,349
- 34
- 180
- 251
3
votes
1 answer
Can double's overflow to negative values?
Hi I am using the g++ compiler and am experiencing (what I think) is underflow of doubles, is this possible and if so how is the behaviour defined
I have uploaded the csv format of the covariance matrix (51x51) here: http://pastebin.com/r0fx1qsx…

Aly
- 15,865
- 47
- 119
- 191
3
votes
1 answer
Why can I initialize a regular Boost matrix like a scalar matrix?
Why does this work? It's not in the documentation anywhere...
#include
#include
#include
int main()
{
boost::numeric::ublas::matrix twoByTwoMat(2,2,-2);
std::cout <<…

John Doe
- 301
- 3
- 11
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
1 answer
What are, and how to use, iterator1 and iterator2 of Boost matrix?
I am looking for a way to iterate over elements of a Boost matrix using iterators. Documentation reports Matrix methods returning an iterator1 and iterator2:
iterator1 begin1 () Returns a iterator1 pointing to the beginning of the matrix.
iterator1…

Fanta
- 2,825
- 5
- 26
- 35
2
votes
1 answer
identity_matrix/zero_matrix: do they allocate?
matrix classes identity_matrix and zero_matrix are templates with ALLOC as a second parameter. But do they really allocate memory?

Andrei R.
- 2,374
- 1
- 13
- 27