Permalink
Browse files

Merge pull request #60 from tushargupta51/modeFucntion

mode function fixed
  • Loading branch information...
2 parents b4e8944 + 40b5c2d commit 55b765d3272a174878e6b1b953ea399d8ec531d1 @trevnorris trevnorris committed Sep 11, 2012
Showing with 8 additions and 3 deletions.
  1. +7 −1 src/core.js
  2. +1 −2 src/vector.js
View
@@ -28,6 +28,11 @@ var slice = Array.prototype.slice,
// test if number and not NaN
isNumber = function( arg ) {
return toString.call( arg ) === '[object Number]' && !isNaN( arg );
+ },
+
+ // converts the jStat matrix to vector
+ toVector = function( arr ) {
+ return [].concat.apply( [], arr );
};
// global function
@@ -99,7 +104,8 @@ jStat.utils = {
calcRdx : calcRdx,
isArray : isArray,
isFunction : isFunction,
- isNumber : isNumber
+ isNumber : isNumber,
+ toVector : toVector
};
// create method for easy extension
View
@@ -246,8 +246,7 @@ jStat.extend({
tmpthis = fullbool === true ? this : this.transpose();
for ( ; i < tmpthis.length; i++ )
arr[i] = jStat[ passfunc ]( tmpthis[i] );
-
- return fullbool === true ? jStat[ passfunc ]( arr ) : arr;
+ return fullbool === true ? jStat[ passfunc ]( jStat.utils.toVector(arr) ) : arr;
}
// pass fullbool if only vector, not a matrix. for variance and stdev
return jStat[ passfunc ]( this[0], fullbool );

0 comments on commit 55b765d

Please sign in to comment.