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: guwi17 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 guwi17

  • Type changed from Bugs to Feature Requests

comment:2 Changed 8 years ago by guwi17

(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 guwi17

(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 7 years ago by david.bellot

  • Owner changed from guwi17 to david.bellot
  • Status changed from new to assigned

I will explore eigen solution to the problem of 3 matrices

comment:5 Changed 7 years ago by anonymous

  • Resolution set to duplicate
  • Status changed from assigned to closed

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?

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain david.bellot.
The resolution will be deleted. Next status will be 'reopened'.

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

Note: See TracTickets for help on using tickets.