Project

General

Profile

Actions

Bug #12356

closed

Vector covector incorrect multiplication with another vector.

Added by edmorte (Rafael Silva) almost 8 years ago. Updated over 4 years ago.

Status:
Rejected
Target version:
-
ruby -v:
ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-linux]
[ruby-core:75394]

Description

Version 2.2.4

v1 = Vector[2,3,4]
v2 = Vector[4,5,6]
v1.covector.row_size #1
v1.covector.column_size #3
v2.covector.row_size #1
v2.covector.column_size #3

Vector does not have distinction between row and column, there's no column vector notion in the language.

v1 * v2.covector #Matrix[[8,10,12],[12,15,18],[16,20,24]]

Should be illegal. But works like if v2.covector is transposed / column vector which it's clearly not.

v1.covector * v2.covector #ExceptionForMatrix::ErrDimensionMismatch: Matrix dimension mismatch

Expected

v1 * v2 #ExceptionForMatrix::ErrOperationNotDefined: Operation(*) can't be defined: Vector op Vector

No comments, see my observation below.

v1.covector * v2 #Vector[47]
#Again covector treated like transposed / column vector.

Personal observation: Terrible choice to represent Vector like an Array, Vector should be a shortcut to Matrix.

Actions

Also available in: Atom PDF

Like0
Like0Like0