Skip to content

matrix vector multiplication broken in ulab #4250

Closed
@kevin-tracy

Description

@kevin-tracy

Matrix vector multiplication isn't working in ulab on the following version:
Adafruit CircuitPython 6.1.0 on 2021-01-21; Adafruit Grand Central M4 Express with samd51p20

Here is an example of it's current functionality:

import ulab as np
A = np.eye(3)
B = np.array([1,2,3.0])

# the following two lines don't work 
C = np.linalg.dot(A,B)                    # ValueError: matrix dimensions do not match
C = np.linalg.dot(A,B.transpose())        # ValueError: matrix dimensions do not match

# this does work, but the resulting array C is a 2D column vector 
C = np.linalg.dot(A,B.reshape((3,1)))
C = C.flatten()                           # flatten to 1D vector

Ideally, this would work similarly to NumPy where a 2D array multiplied by a 1D array results in a 1D array. Does this functionality exist under a different function? Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugulabRelated to the ulab module

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions