// Test the num module
var num = use('num');

// Test matrix creation and operations
var A = new num.Matrix([
    [1, 2, 3],
    [4, 5, 6],
    [7, 8, 10]
]);

log.console("Matrix A:");
log.console(A.toArray());

// Test matrix inversion
var A_inv = A.inverse();
log.console("\nMatrix A inverse:");
log.console(A_inv.toArray());

// Verify A * A_inv = I (approximately)
var I = A.multiply(A_inv);
log.console("\nA * A_inv (should be identity):");
log.console(I.toArray());

// Test array creation
var v = new num.Array([1, 2, 3]);
log.console("\nVector v:");
log.console(v.toArray());

// Test matrix-vector multiplication
var result = A.multiply(v);
log.console("\nA * v:");
log.console(result.toArray());

// Test dot product
var u = new num.Array([4, 5, 6]);
var dot_product = v.dot(u);
log.console("\nv · u =", dot_product);

// Test norm
var v_norm = v.norm();
log.console("||v|| =", v_norm);

// Test matrix-matrix multiplication
var B = new num.Matrix([
    [1, 0, 0],
    [0, 2, 0],
    [0, 0, 3]
]);

var C = A.multiply(B);
log.console("\nA * B:");
log.console(C.toArray());

$_.stop()
