##### How often do you use vectorized operations?

Vectorized operations are operations that apply to vectors.

Pseudo code:

```
vector<integer> x = [ 1 2 3 4 5 ];
x = x + 3;
# x : [ 4 5 6 7 8 ]
```

They're often used in languages like R, that provide first-class support for them.

They're also often used in multi-dimentional programs, ex: one might use a vector of 4 integers to represent the four corners of a square, to move it up, they perform a vectorized addition on all corners at once.

And in languages that don't provide first class support for them, ex: JavaScript, one might find someone making something like this:

```
class Vector {
constructor(x, y, z) {
this.x = x;
this.y = y;
this.z = z;
}
add(rhs) {
return new Vector(
this.x + rhs.x,
this.y + rhs.y
this.z + rhs.z
);
}
}
// or
[ 1, 2, 3, 4, 5 ].map(i => i + 3);
```

But I've only seen that ^ done in code that creates and manipulates 2D/3D objects.

I'd like to survey Replers on the following 4 things:

- have you had any use for vectorized math outside of graphics-related code?
- do you commonly use arbitrarily long vectors, or do you more commonly use vectors that have a staticially known length? (ex: that JS class could be seen as a vector of 3 elements)
- how often have you needed to perform vectorized division? (ex: [ 2 4 8 ] / 2 = [ 1 2 4 ])
- ^ but for division remainder? (ex: [ 1 2 3 ] % 2 = [ 1 0 1 ])
- For the last two, can you provide actual code on when you have, or what situations it's useful for?

- Not really
- If I read the post correctly, yes
- A lot
- Not really

Finally - I do an unhealthy amount of vector math in SortaCraft (voxel engine/data processing)

Do not look at the code, thank you

Also, here is the module I wrote to make this easier: Methods (ignore WASM)

@tussiez

Ohh, oops, I should clarify, I meant "arbitrarily long vectors" **vs** "staticially known length," which one did you end up with more often?

Also, we'd best to move it elsewhere if you want to discuss it, but

a) Baconman is making that code execute a lot slower by using Wasm.

b) I'm legitametely making a small vector lib, so I wanted to know what people want and often use, https://repl.it/@xxpertHacker/SIMDts#main.ts, but it's too bleeding-edge for use today.

@xxpertHacker

Ah, statically known length.

Yee, he noted that LOL

Oooo

Well vectors are usually used for when you need to abstract well, a vector. Vectors are pertaining to 2D and 3D objects in themselves so this is in a way a really dumb question.

Anyways maybe matrix addition?

@Coder100 I've updated the question, to those who've used matrix/vector arithmetic, I honestly only care about the last three bullet points, see the bottom of the post.

And yes, this was a dumb question, and I couldn't make it not sound dumb.

Matrix operations might've fit better here, a lot better.

In what situations have you found yourself using them?

doing my math homework @xxpertHacker

@Coder100 Lmao; math vector =/= programming vector =/= engineering vector

lmao fair enough @xxpertHacker

in your use case, it appears you were using math vector `<1, 2>`

@xxpertHacker

Not really, since I don't do a lot of graphics and math related code

@programmeruser Got any friends who write math-heavy code?

@xxpertHacker no

@xxpertHacker I'm more interested in 3D graphics now, so

1. Not really

2. Vectors with a static length

3. I haven't really written any code that uses vector division

4. Why

@programmeruser 4) because, as I presumed, vector division is rare, as opposed to multiplication, addition, subtraction, exponentation, etc.

If anyone really used division, I'd have liked to see where in the world someone would need it, or where it could genuinely prove useful.

@programmeruser Btw, it's actually kinda funny, since I was able to rewrite the code from your recent post to use vector division...

https://replit.com/@xxpertHacker/fragment-shader-cube#shader.c

But in that particular case, it could be * 0.5, eliminating the division entirely.