solve_ols: Solve OLS

Description Usage Arguments Value Examples

Description

Solve ordinary least square using iterative methods

Usage

1
solve_ols(A, b, method = "Jacobi", n_cores = 1, iter = 10)

Arguments

A

design matrix

b

target vector

method

Jacobi(Jacobi), or Gauss-Seidal(GS)

n_cores

Number of parallel processes

iter

number of iteration for the iterative method

Value

list(x, run_time)

Examples

1
2
3
4
5
6
A = diag(2, 10, 10)
b = 1:10
Jacobi_res = solve_ols(A,b,method="Jacobi",n_cores=2)
GS_res = solve_ols(A,b,method="GS")
print(Jacobi_res[1])
print(GS_res[1])

shihhowie/hw2 documentation built on May 21, 2019, 12:35 a.m.