# Vector scale

`vector-scale` · version 1.0.0 · Vectors & matrices · free, no key needed

Multiply every entry of a finite-number vector by a scalar.

**Use when you need to: vector scalar multiplication · scale a vector · multiply vector by number.**

## Supported

- vector scalar multiplication
- scale a vector
- multiply vector by number

## Not supported

- complex-valued scalars
- arbitrary-precision arithmetic

## Behavior

- Input vector is an array of 1 to 64 finite JSON numbers, each bounded to at most 1000000 in magnitude.
- Input scalar is a finite JSON number bounded to at most 1000000 in magnitude.
- The result is the elementwise IEEE-754 double-precision product result[i] = vector[i] * scalar.
- A result entry of -0 is normalized to 0.

## Input

- `vector` (array of number, required): min items 1; max items 64
- `scalar` (number, required)

## Output

- `result` (array of number, required)

## Limits

- max dim: 64
- max abs value: 1000000

## Example

Request input:

```json
{
  "vector": [
    1,
    2,
    3
  ],
  "scalar": 2
}
```

Response:

```json
{
  "result": {
    "result": [
      2,
      4,
      6
    ]
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "vector-scale",
  "version": "1.0.0",
  "input": {
    "vector": [
      1,
      2,
      3
    ],
    "scalar": 2
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/vector-scale/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"vector":[1,2,3],"scalar":2}'
```

The machine-readable contract is at [/v1/tools/vector-scale/versions/1.0.0](/v1/tools/vector-scale/versions/1.0.0).

### CLI

```sh
node cli.mjs run vector-scale 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Matrix scale](/tools/matrix-scale): Multiply every entry of a finite-number matrix by a scalar.
- [Matrix vector multiply](/tools/matrix-vector-multiply): Multiply an MxN finite-number matrix by a length-N finite-number vector, producing a length-M vector.
- [Matrix multiply](/tools/matrix-multiply): Multiply an MxK finite-number matrix by a KxN finite-number matrix, producing an MxN matrix.
- [Vector dot](/tools/vector-dot): Compute the dot (scalar) product of two equal-length finite-number vectors.
- [Vector hadamard](/tools/vector-hadamard): Multiply two equal-length finite-number vectors elementwise (Hadamard product).
- [Vector projection](/tools/vector-projection): Compute the vector projection of a finite-number vector onto another.
