Look at me ma, my library is going to have a matrix type, a row vector type and a column vector type, isn't that wonderful? I read a math book. I study math I'm so smart ^-^

-_-
o_o
O_O
O-O
O^O
>0< NOOOOO!

>.<
>0< ROW VECTOR IS JUST A VECTOR!
(>-.-)>
vector(1,2,3)

>.<
>0< MATRIX IS JUST A VECTOR!
(>-.-)>
vector
(
vector(1,2,3),
vector(4,5,6),
vector(7,8,9)
)

>.<
>0< COLUMN VECTOR IS JUST A VECTOR!
(>-.-)>
vector
(
vector(1),
vector(2),
vector(3)
)

>0< VECTOOOOOOORRRR!

what's a column vector plus a row vector? huh? :v
huh?! :V

(>-.-)>

vector
(
vector(1),
vector(2),
vector(3)
)

+

vector(.1, .2, .3)

||

vector
(
vector(1.1, 1.2, 1.3),
vector(2.1, 2.2, 2.3),
vector(3.1, 3.2, 3.3)
)

Follow

@mc nah, nothing too sophisticated, it's a matrix, with corresponding elements taken from the two vectors and added. Similar to matrix multiplication (3x1 and 1x3) expect with addition. Looking at the whole part and the fractional part of the resulting numbers separately you should see the original column and the row repeating across the matrix.

@namark

Dunno what software you're using, but this is the intended behaviour in many linear algebra systems. It's known as "binary singleton expansion" and is basically just a bit of syntactic sugar so you don't have to first multiply by a vector of all ones.

@mc

@khird I'm writing my own here git.qoto.org/namark/libsimple_
and the other usual places.

In my case this is emergent behaviour from generalizing basic vector ops to vector/matrices of any shape with support of usual c++ style arithmetic type promotion, nice to know it's a thing! This particular "fix" is not commuted yet though.

@mc

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.