New answers tagged

6

Verily, this is a headache, since Table wants its iterators as Sequence rather than nested list of lists. Here is a method I used quite recently to get sufficiently fast code for this. c1c[n_] := With[{itvals = RandomReal[{0, 1}, {n, 5}]}, With[{iters = Apply[Sequence, Table[{x[j], itvals[[j]]}, {j, n}]]}, c1[n] = cCompile[{}, tTable[1, ...


4

You just need to fully compile your function: fullycompiledBSplineSurf = Hold@Compile[{{ctrlnets, _Real, 3}, {deg1, _Integer}, {deg2, _Integer}, {knots1, _Real, 1}, {knots2, _Real, 1}, {u, _Real}, {v, _Real}}, Module[{i, j, validnets, row, col}, i = searchSpan[{deg1, knots1}, u]; j = searchSpan[{deg2, knots2}, v]; validnets ...


4

As @xslittlegrass suggested in the comments, you could use CloudDeploy[]. The APIFunction[] makes it easy to accept input parameters and return the evaluation results of a function. Then you could use urlread() in Matlab to query/read answers. Here is an example for the Prime[x] case. First in Mathematica (adapted from the APIFunction documentation): ...


4

Thanks for J.M.'s suggestion and happlyfish's hint:) coeff[u_, U_, i_, p_] := If[U[[i + p + 1]] != U[[i + 1]], (u - U[[i + 1]])/(U[[i + p + 1]] - U[[i + 1]]), 0] compiledNonzeroBasis= ReleaseHold[ Hold@Compile[{{p, _Integer}, {u, _Real, 1}, {u0, _Real}}, With[{i = searchSpan[{p, u}, u0]}, Module[ {lst = Table[0., {p + 2}, {p + 1}], cc = ...



Top 50 recent answers are included