Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/documentation.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
<tr><td><tt>largeArray</tt><td>Don't prettyPrint Arrays larger than this
<tr><td><tt>leq</tt><td>Pointwise x&lt;=y
<tr><td><tt>linspace</tt><td>Generate evenly spaced values
<tr><td><tt>logspace</tt><td>Generate logarithmically spaced values
<tr><td><tt>log</tt><td>Pointwise Math.log(x)
<tr><td><tt>lshift</tt><td>Pointwise x&lt;&lt;y
<tr><td><tt>lshifteq</tt><td>Pointwise x&lt;&lt;=y
Expand Down Expand Up @@ -397,6 +398,13 @@ <h1>Utility functions</h1>
OUT> [1,1.5,2,2.5,3]
</pre>

Or a vector of logarithmically spaced values between Math.pow(10,a) and Math.pow(10,b):

<pre>
IN> numeric.logspace(0,1,5);
OUT> [1, 1.7782794100389228, 3.1622776601683795, 5.623413251903491, 10]
</pre>

<!--
<pre>
IN> numeric.blockMatrix([[[[1,2],[3,4]],[[5,6],[7,8]]],
Expand Down
6 changes: 6 additions & 0 deletions src/numeric.js
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,12 @@ numeric.linspace = function linspace(a,b,n) {
return ret;
}

numeric.logspace = function logspace(a,b,n) {
return numeric.linspace(a,b,n).map(
function(x) { return Math.pow(10,x); }
);
}

numeric.getBlock = function getBlock(x,from,to) {
var s = numeric.dim(x);
function foo(x,k) {
Expand Down