80trust / 100

Matrix Operations

by Sindri in Productivity & SaaS

x402 APIPassing, checked 18 min ago

Matrix operations: multiply, transpose, determinant, and invert, for matrices up to 20x20. Uses the ml-matrix library's LU decomposition (LuDecomposition) for determinant and inversion, with a numerical near-singularity guard beyond the library's exact-singular check.

POST https://ppu43fkyhimq5fiqpmo42eh5ri0yypid.lambda-url.us-east-1.on.aws/matrixOperations

Last 30 days

All checks passedSome failedAll failedNot checked
Uptime
100%
Response time
119 ms typical, 119 ms slowest 5%
Last check
18 min ago
Next check
in 13 min

How to call it

# See the payment challenge (nothing is charged)
curl -i -X POST "https://ppu43fkyhimq5fiqpmo42eh5ri0yypid.lambda-url.us-east-1.on.aws/matrixOperations" \
  -H "content-type: application/json" \
  -d '{"matrixA":[[1,2],[3,4]],"matrixB":[[5,6],[7,8]],"operation":"multiply"}'
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client().register(
  "eip155:8453",
  new ExactEvmScheme(privateKeyToAccount(process.env.AGENT_KEY)),
);
const pay = wrapFetchWithPayment(fetch, client);

// Not sure it's safe to pay? Preflight it first for $0.005:
// GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fppu43fkyhimq5fiqpmo42eh5ri0yypid.lambda-url.us-east-1.on.aws%2FmatrixOperations
const res = await pay("https://ppu43fkyhimq5fiqpmo42eh5ri0yypid.lambda-url.us-east-1.on.aws/matrixOperations", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({"matrixA":[[1,2],[3,4]],"matrixB":[[5,6],[7,8]],"operation":"multiply"}),
});
console.log(await res.json());

Example input

{
  "matrixA": [
    [
      1,
      2
    ],
    [
      3,
      4
    ]
  ],
  "matrixB": [
    [
      5,
      6
    ],
    [
      7,
      8
    ]
  ],
  "operation": "multiply"
}

Example output

{
  "data": {
    "params": {
      "matrixA": [
        [
          1,
          2
        ],
        [
          3,
          4
        ]
      ],
      "matrixB": [
        [
          5,
          6
        ],
        [
          7,
          8
        ]
      ],
      "operation": "multiply"
    },
    "result": [
      [
        19,
        22
      ],
      [
        43,
        50
      ]
    ]
  },
  "ok": true
}

Security scan

  • No findings. We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.

Recent checks

WhenResultHTTPTimePrice
18 min agoPassed402119 ms$0.01
5 h agoPassed402120 ms$0.01