Question: Does Maple there a way to set Maple to do broadcasting when adding a matrix and a vector?


 

M := `<,>`(`<|>`(1, 2, 3), `<|>`(4, 5, 6), `<|>`(7, 8, 9))

Matrix(%id = 18446745804653824710)

(1)

b := `<|>`(10, 11, 12)

Vector[row](%id = 18446745804653819654)

(2)

M+b

Error, (in rtable/Sum) invalid input: dimensions do not match: Matrix(1 .. 3, 1 .. 3) cannot be added to Vector[row](1 .. 3)

 

``

Of course the above addition will throw an error because M and b have different dimensions. But if broadcasting was allowed, then the row vector b is added to each row in the matrix M. For example, in Python:

 

 

Is there a similar feature in Maple?


 

Download question.mw

Please Wait...