Matrix scale
matrix-scale · version 1.0.0 · Vectors & matrices · free, no key needed
Multiply every entry of a finite-number matrix by a scalar.
Use when you need to: matrix scalar multiplication · scale a matrix.
Supported
- matrix scalar multiplication
- scale a matrix
Not supported
- complex-valued scalars
- arbitrary-precision arithmetic
Behavior
- Input matrix is a rectangular array of 1 to 20 rows of 1 to 20 finite JSON numbers, magnitude bounded to at most 1000000.
- 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[r][c] = matrix[r][c] * scalar.
- A result entry of -0 is normalized to 0.
Input
matrix(array of array of number, required): min items 1; max items 20scalar(number, required)
Output
result(array of array of number, required)
Limits
- max rows: 20
- max cols: 20
- max abs value: 1000000
Example
Request input:
{
"matrix": [
[
1,
2
],
[
3,
4
]
],
"scalar": 2
}
Response:
{
"result": {
"result": [
[
2,
4
],
[
6,
8
]
]
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "matrix-scale",
"version": "1.0.0",
"input": {
"matrix": [
[
1,
2
],
[
3,
4
]
],
"scalar": 2
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/matrix-scale/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"matrix":[[1,2],[3,4]],"scalar":2}'
The machine-readable contract is at /v1/tools/matrix-scale/versions/1.0.0.
CLI
node cli.mjs run matrix-scale 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 vector multiply: Multiply an MxN finite-number matrix by a length-N finite-number vector, producing a length-M vector.
- 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.
- Matrix multiply: Multiply an MxK finite-number matrix by a KxN finite-number matrix, producing an MxN matrix.