wdmm v0.5.6
WDMM
WDMM (Wamu Data Manage Module) is a project to manage data with matrices and more functions oriented to IA making, of course you can use this module for all the things that you want.
How does it work ?
WDMM is an object with a lot of functions so you might require the module by this way:
{DataSet,wdmm_functions} = require("wdmm");
or
wd = require("wdmm");
The first one is the most practic And the expamples are going to be with this one.
· DataSet:
The DataSet constructor is a matrix constructor.
let dataSet = new DataSet();// You create the object.
//Actualy DataSet is an empty object
createWithArray is a function whitch create a matrix with an array you have to use it by this way:
dataSet.createWithArray([1,2,3,1,2,3,1,2,3,1,2,3],3)
//createWithArray(Array,numberOfColones)
Now dataSet.value is this.
[
[1,2,3],
[1,2,3],
[1,2,3],
[1,2,3]
]
You can also create a matrix with a function:
dataSet.createWithFunction(200,[30,30,0],[100,1000,10],(va)=>{
let Y = va[0]+va[1]/va[2]
return Y;
})
How does it work ?
The first parameter is the number of lines that you want in this case 200. va is a random array that you should put in your code. va1 is a random number betwen theSecondParameter1 and theThirdParameter1. So the value is going to be something like.
[
...
[...]
[30,400,5,120],
[60,850,2,485],
[100,900,3,400],
[...],
...
]
Methods
the DataSets objects have these methods:
- clone();
- transpose();
- manageVColone();
clone
clone returns, in the case of a createWithArray DataSet the same DataSet. In the case of a createWithFunction DataSet it returns a DataSet created with the same parameters If the DataSet was transpose its going to transpose the DataSet automaticly (to disable this use this instead: .clone(true))
transpose
This basicly transpose the matrix
manageVColone
manageVColone("get",x) lets you get an array with all the values of the colone x. manageVColone("delete",x) deletes the x colone. manageVColone("add",x,ary)Adds the Array ary at x position.
· wdmm_functions:
wdmm_functions returns a lot of functions, you can specify if you only want one this way
wdmm_functions("THE NAME OF THE FUNCTION");
If not, you only call the function with none parameters.
The functions:
- mxMath
mxMath
mxMath works by this way:
mxMath("the type of operation",matrixOne,matrixTwo)
This function returns a matrix create doing an operation betwen the first matrix and the second.
List of operations:
- add
- subtract
- multiply
- power
- root
If you want to do another kind of operation like power to 2 a matrix do something like:
matrix.forEach(i=>{
i.forEach(e=>{
e = parseInt(e)**2
})
});