Opened 13 years ago

Closed 12 years ago

Last modified 9 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:

Description

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(A*b);
  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.

Change History (6)

comment:1 by Gunter, 13 years ago

Type: BugsFeature Requests

comment:2 by Gunter, 13 years ago

(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 by Gunter, 13 years ago

(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 by David Bellot, 13 years ago

Owner: changed from Gunter to David Bellot
Status: newassigned

I will explore eigen solution to the problem of 3 matrices

comment:5 by anonymous, 12 years ago

Resolution: duplicate
Status: assignedclosed

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

comment:6 by maxim.yegorushkin@…, 9 years ago

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

Note: See TracTickets for help on using tickets.