This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const name = 'square'; | |
| export function draw(ctx, length, x, y, color) { | |
| ctx.fillStyle = color; | |
| ctx.fillRect(x, y, length, length); | |
| return { | |
| length: length, | |
| x: x, | |
| y: y, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| print("Hello World") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class LinearRegression { | |
| w: Mat; | |
| constructor() { } | |
| //x: M-by-N matrix. M data with N dimensions. Each row is an N-dim vector | |
| //y: M-by-1 matrix | |
| fit(x_: Mat, y_: Mat) : LinearRegression{ | |
| let y = y_; | |
| if (y_.rows != 1 && y_.cols == 1) {y = y_.T();} //check the dimension of y | |
| var x = x_.resize(x_.rows, x_.cols + 1, 1); //expan x_ with one more column with 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function abc(x){return x*100;} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function myFunction1(A) | |
| { | |
| return A+A; | |
| } | |
| print("including library: test1"); | |
| let a = mat([[1]]); | |
| print("a+a is " + myFunction1(a)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function demo_add(a, b) | |
| { | |
| return a+b; | |
| } |
NewerOlder