rStats.js v1.3.0
    Preparing search index...

    Function backsolve

    • Solves the triangular system r y = x with a vector right-hand side. Equivalent to R's backsolve().

      Only the top-left k x k triangle of r (upper by default) and the first k elements of x are used. Throws if a diagonal element is exactly zero.

      Parameters

      Returns number[]

      The solution y, a vector of length k.

      backsolve([[2, 1], [0, 4]], [4, 8]);              // [1, 2]
      backsolve([[2, 1], [0, 4]], [[4, 2], [8, 4]]); // [[1, 0.5], [2, 1]]
    • Solves the triangular system r y = x with a matrix right-hand side.

      Parameters

      Returns number[][]

      The solution y, a matrix with k rows.

    • Solves the triangular system r y = x.

      Parameters

      Returns number[] | number[][]

      A vector if x is a vector, otherwise a matrix with k rows.