How to use the eye function from mathjs

Find comprehensive JavaScript mathjs.eye code examples handpicked from public code repositorys.

43
44
45
46
47
48
49
50
51
52
_exports.expand = function expand(A, factor) {
  return math.pow(A, factor);
};

_exports.addDiagonal = function addDiagonal(A, value) {
  var diag = math.eye(A.size());
  return math.add(A, math.multiply(value, diag));
};

/* A is a square matrix */
fork icon2
star icon6
watch icon2

41
42
43
44
45
46
47
48
49
50
exports.expand = function expand(A, factor) {
  return math.pow(A, factor);
};

exports.addDiagonal = function addDiagonal(A, value) {
  const diag = math.eye(A.size());
  return math.add(A, math.multiply(value, diag));
};

/* A is a square matrix */
fork icon2
star icon6
watch icon2

12
13
14
15
16
17
18
19
20
21
}

constructor(){
  super();

  this.inputWeightsA = Mathjs.eye(Mathjs.matrix([this.inputSize, this.inputSize])).map( function(value, index, matrix) {
    if(Math.random() < 0.2){
      value+=  10*(Math.random()-0.5);
    }
    return value;
fork icon0
star icon1
watch icon1

+ 47 other calls in file

198
199
200
201
202
203
204
205
206
        //h = ( JtWJ + lambda * math.diag(math.diag(JtWJ)) ) \ JtWdy;
        //h = math.multiply(math.inv(JtWdy),math.add(JtWJ,math.multiply(lambda,math.diag(math.diag(Npar)))));
        h = math.solve(math.add(JtWJ,math.multiply(lambda,math.diag(math.diag(JtWJ)))),JtWdy);
        break;
    default:					// Quadratic and Nielsen
        //h = ( JtWJ + lambda * math.eye(Npar) ) \ JtWdy;

        h = math.solve(math.add(JtWJ,math.multiply(lambda,math.eye(Npar))),JtWdy);
}
fork icon0
star icon0
watch icon0

+ 2 other calls in file

36
37
38
39
40
41
42
43
44
  this.Q_k = math.matrix([[0.001, 0], [0, 0.003]]);
  this.d_T = 0.01;
}

KalmanModel.prototype.update =  function(o){
  this.I = math.eye(this.P_k.size()[0]);
  //init
  this.x_k_ = this.x_k;
  this.P_k_ = this.P_k;
fork icon0
star icon0
watch icon0