Matrix vector multiply
matrix-vector-multiply · version 1.0.0 · Vectors & matrices · free, no key needed
Multiply an MxN finite-number matrix by a length-N finite-number vector, producing a length-M vector.
Use when you need to: matrix-vector multiplication · apply a matrix to a vector · linear transformation.
Supported
- matrix-vector multiplication
- apply a matrix to a vector
- linear transformation
Not supported
- vector-matrix multiplication on the left (transpose the matrix first)
- mismatched dimensions
Behavior
- Input matrix is an MxN matrix of finite JSON numbers (M, N from 1 to 20). Input vector has exactly N finite JSON number entries.
- Each entry magnitude is bounded to at most 1000000.
- The result is the length-M vector result[r] = sum over c of matrix[r][c] * vector[c], accumulated left-to-right in IEEE-754 double precision.
- A result entry of -0 is normalized to 0.
Input
matrix(array of array of number, required): min items 1; max items 20vector(array of number, required): min items 1; max items 20
Output
result(array of number, required)
Limits
- max matrix dim: 20
- max vector dim: 64
- max abs value: 1000000
Example
Request input:
{
"matrix": [
[
1,
2
],
[
3,
4
]
],
"vector": [
5,
6
]
}
Response:
{
"result": {
"result": [
17,
39
]
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "matrix-vector-multiply",
"version": "1.0.0",
"input": {
"matrix": [
[
1,
2
],
[
3,
4
]
],
"vector": [
5,
6
]
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/matrix-vector-multiply/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"matrix":[[1,2],[3,4]],"vector":[5,6]}'
The machine-readable contract is at /v1/tools/matrix-vector-multiply/versions/1.0.0.
CLI
node cli.mjs run matrix-vector-multiply 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Vector scale: Multiply every entry of a finite-number vector by a scalar.
- Matrix multiply: Multiply an MxK finite-number matrix by a KxN finite-number matrix, producing an MxN matrix.
- Matrix scale: Multiply every entry of a finite-number matrix by a scalar.
- Matrix determinant: Compute the determinant of a small square finite-number matrix.
- Matrix hadamard: Multiply two equal-shape finite-number matrices elementwise (Hadamard product).
- Matrix inverse: Compute the inverse of a small square finite-number matrix.