# Vector outer product

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

Compute the outer product of two finite-number vectors, producing a matrix.

**Use when you need to: vector outer product · tensor product of two vectors · rank-1 matrix from two vectors.**

## Supported

- vector outer product
- tensor product of two vectors
- rank-1 matrix from two vectors

## Not supported

- inner/dot product (use vector-dot)
- outer product of more than two vectors

## Behavior

- Inputs a (length M) and b (length N) are arrays of 1 to 64 finite JSON numbers each, magnitude bounded to at most 1000000; a and b may have different lengths.
- The result is the MxN matrix result[i][j] = a[i] * b[j], computed in IEEE-754 double precision.
- A result entry of -0 is normalized to 0.

## Input

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

## Output

- `result` (array of array of number, required)

## Limits

- max dim: 64
- max abs value: 1000000

## Example

Request input:

```json
{
  "a": [
    1,
    2
  ],
  "b": [
    3,
    4,
    5
  ]
}
```

Response:

```json
{
  "result": {
    "result": [
      [
        3,
        4,
        5
      ],
      [
        6,
        8,
        10
      ]
    ]
  }
}
```

## How to call it

### MCP

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

```json
{
  "id": "vector-outer-product",
  "version": "1.0.0",
  "input": {
    "a": [
      1,
      2
    ],
    "b": [
      3,
      4,
      5
    ]
  }
}
```

### HTTP (no key)

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

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

### CLI

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

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

## Related tools

- [Vector dot](/tools/vector-dot): Compute the dot (scalar) product of two equal-length finite-number vectors.
- [Matrix multiply](/tools/matrix-multiply): Multiply an MxK finite-number matrix by a KxN finite-number matrix, producing an MxN matrix.
- [Vector add](/tools/vector-add): Add two equal-length finite-number vectors elementwise.
- [Vector lerp](/tools/vector-lerp): Linearly interpolate (or extrapolate) between two equal-length finite-number vectors.
- [Matrix determinant](/tools/matrix-determinant): Compute the determinant of a small square finite-number matrix.
- [Matrix hadamard](/tools/matrix-hadamard): Multiply two equal-shape finite-number matrices elementwise (Hadamard product).
