How to use the dotDivide function from mathjs

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

66
67
68
69
70
71
72
73
74

// Vector of ranks for the ith node, scaled between [0, 1]
let v = math.ones(N, 1);

// Normalize
v = math.dotDivide(v, N);

// Initial solution
let lastV = math.zeros(N, 1);
fork icon4
star icon5
watch icon3

+ 3 other calls in file

30
31
32
33
34
35
36
37
38
39
};

_exports.normalizeColumns = function normalizeColumns(A) {
  var colSums = this.colSum(A);
  var colSumMatrix = this.repmat(colSums, A.size()[0]);
  var newMatrix = math.dotDivide(A, colSumMatrix);
  return newMatrix;
};

_exports.inflate = function inflate(A, factor) {
fork icon2
star icon6
watch icon2

28
29
30
31
32
33
34
35
36
37
};

exports.normalizeColumns = function normalizeColumns(A) {
  const colSums = this.colSum(A);
  const colSumMatrix = this.repmat(colSums, A.size()[0]);
  const newMatrix = math.dotDivide(A, colSumMatrix);
  return newMatrix;
};

exports.inflate = function inflate(A, factor) {
fork icon2
star icon6
watch icon2

64
65
66
67
68
69
70
71
72
73
function dTanh(x) {
    return math.subtract(1, math.square(tanh(x)));
}

function sigmoid(x) {
    return math.dotDivide(1, math.add(1, math.exp(math.multiply(-1, x))));
}

function dSigmoid(x) {
    return math.dotMultiply(sigmoid(x), math.subtract(1, sigmoid(x)));
fork icon0
star icon4
watch icon2

28
29
30
31
32
33
34
35
36
37
        std = math.matrix(std)
    }

    var gamma = math.dotDivide(math.subtract(mean, bestObjective), std);

    var pdf = math.dotDivide(math.exp(math.dotDivide(math.square(gamma), -2)), math.sqrt(2 * 3.14159));
    var cdf = math.dotDivide(math.add(math.erf(math.dotDivide(gamma, math.sqrt(2))), 1), 2);

    return math.dotMultiply(std, math.add(math.dotMultiply(gamma, cdf), pdf));
}
fork icon0
star icon2
watch icon2

+ 11 other calls in file

93
94
95
96
97
98
99
100
101
102
let max_delta_f = mathjs.max(school_delta_f);

school.forEach((fish) => {
    let delta_f = mathjs.subtract(fish.next_fitness, fish.fitness);

    let ratio   = mathjs.dotDivide(delta_f, max_delta_f);
    let weight  = mathjs.add(fish.weight, ratio);

    if (weight < config.fss.min_weight) {
        weight = config.fss.min_weight;
fork icon0
star icon0
watch icon0

+ 15 other calls in file

59
60
61
62
63
64
65
66
67
68
// seleção aleatória
console.log('seleção aleatória:', math.random([2, 2]));
// adição 3, 5
console.log('adição:', math.add([1, 2], [2, 3]));
// divisão 5, 4
console.log('divisão:', math.dotDivide([10, 12], [2, 3]));
// logaritmo
console.log('logaritmo:', math.log([10, 12]));
// logaritmo na base 2
console.log('logaritmo na base 2:', math.log2([10, 12]));
fork icon0
star icon0
watch icon0

+ 2 other calls in file

430
431
432
433
434
435
436
437
438
439
//func_calls = func_calls + 1;
if (dp[j][0] < 0) {		// backwards difference
    //J(:,j) = math.dotDivide(math.subtract(y1, y),del[j]);//. / del[j];
    //console.log(del[j]);
    //console.log(y);
    var column = math.dotDivide(math.subtract(y1, y),del[j]);

    for(var k=0;k< m;k++){
        J[k][j]=column[k][0];
    }
fork icon0
star icon0
watch icon0

+ 8 other calls in file