Opened 8 years ago

Closed 7 years ago

Last modified 4 years ago

#3397 closed Feature Requests (duplicate)

provide overloads for operator* for matrix/vector multiplies

Reported by: Gunter Owned by: David Bellot
Milestone: To Be Determined Component: uBLAS
Version: Boost 1.40.0 Severity: Not Applicable
Keywords: Cc:


Since many people a familiar with using operator* we should add the corresponding overloads to uBLAS. A good reference is the syntax used by MATLAB. The final syntax should be

    matrix<double> A;
    vector<double> x;
    vector<double> y;

    cout << 2.0 * y << endl;
    cout << y * 2 << endl;
    cout << A * 2 << endl;
    cout << 2 * A  << endl;
    cout << A * y << endl;
    cout << trans(y) * A  << endl;
    cout << A * A << endl;

Similar to trans() we should provide herm() for complex matrices.

the syntax for inner and outer products could be

    vector<double> x,a,b;
    x = trans(a) * b;     // inner prod
    x = a * trans(b);     // outer prod

the syntax for products with higher precision should be

  prec(trans(a) * b);

a *= operator should also be provided

b *= A; 
A *= B;

which could be mapped to the correspondy axpy_prod() call.

further tasks:

  • find a solution for the product of three matrices which is currently only possible by stating an explicit temporary matrix.

Attachments (0)

Change History (6)

comment:1 Changed 8 years ago by Gunter

Type: BugsFeature Requests

comment:2 Changed 8 years ago by Gunter

(In [56045]) see #3397

vector_expression.hpp: added enable_if to expression scalar * vector and vector * scalar

matrix_expression.hpp: added enable_if to expression scalar * matrix and matrix * scalar

comment:3 Changed 8 years ago by Gunter

(In [56625]) see #3397

  • merged [56045] into release
  • add enable_if to operator* for scalar*vector, vector*scalar, scalar*matrix, matrix*scalar in order to hinder unexpected instantiation.

comment:4 Changed 8 years ago by David Bellot

Owner: changed from Gunter to David Bellot
Status: newassigned

I will explore eigen solution to the problem of 3 matrices

comment:5 Changed 7 years ago by anonymous

Resolution: duplicate
Status: assignedclosed

a new ticket 4442 with a simple implementation has been opened and a patch proposed.

comment:6 Changed 4 years ago by maxim.yegorushkin@…

When is this functionality expected to merged into a boost release please?

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain David Bellot.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.