Matrix hadamard
matrix-hadamard · version 1.0.0 · Vectors & matrices · free, no key needed
Multiply two equal-shape finite-number matrices elementwise (Hadamard product).
Use when you need to: matrix hadamard product · elementwise matrix multiplication · pointwise matrix product.
Supported
- matrix hadamard product
- elementwise matrix multiplication
- pointwise matrix product
Not supported
- matrices of different shapes
- standard matrix multiplication (use matrix-multiply)
- arbitrary-precision arithmetic
Behavior
- Inputs a and b are rectangular arrays of rows of finite JSON numbers with identical row and column counts (1 to 20 each), magnitude bounded to at most 1000000.
- The result is the elementwise IEEE-754 double-precision product result[r][c] = a[r][c] * b[r][c].
- A result entry of -0 is normalized to 0.
Input
a(array of array of number, required): min items 1; max items 20b(array of array of number, required): min items 1; max items 20
Output
result(array of array of number, required)
Limits
- max rows: 20
- max cols: 20
- max abs value: 1000000
Example
Request input:
{
"a": [
[
1,
2
],
[
3,
4
]
],
"b": [
[
5,
6
],
[
7,
8
]
]
}
Response:
{
"result": {
"result": [
[
5,
12
],
[
21,
32
]
]
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "matrix-hadamard",
"version": "1.0.0",
"input": {
"a": [
[
1,
2
],
[
3,
4
]
],
"b": [
[
5,
6
],
[
7,
8
]
]
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/matrix-hadamard/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"a":[[1,2],[3,4]],"b":[[5,6],[7,8]]}'
The machine-readable contract is at /v1/tools/matrix-hadamard/versions/1.0.0.
CLI
node cli.mjs run matrix-hadamard 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Vector hadamard: Multiply two equal-length finite-number vectors elementwise (Hadamard product).
- Matrix multiply: Multiply an MxK finite-number matrix by a KxN finite-number matrix, producing an MxN matrix.
- Matrix add: Add two equal-shape finite-number matrices elementwise.
- Matrix scale: Multiply every entry of a finite-number matrix by a scalar.
- Matrix subtract: Subtract two equal-shape finite-number matrices elementwise (a minus b).
- Matrix vector multiply: Multiply an MxN finite-number matrix by a length-N finite-number vector, producing a length-M vector.