Gabriel Landi
Reputation
1,001
Next privilege 2,000 Rep.
 Mar 10 comment Addition of sparse array objects @rm-rf My version is 9.0.1.0. And I have disabled the suggestive interface (in the Preferences menu) and it did not change anything. Mar 13 comment Counting the number of a specific type of permutation This is precisely the type of Sort syntax that I was trying to figure out. Thanks for the help. Mar 13 comment Counting the number of a specific type of permutation This works great and also agrees with Carraher's answer. Thank you very much. Do you have any references in which I could learn more from these types of calculations. I think I will soon encounter more complicated combinations. Thank you very much for the help. Mar 6 comment Why does compiling a function with ConstantArray give an error when used in parallel? Thank you all for the support and the useful feedback, and sorry about the 'bug' labelling. ConstantArray seemed like a simple function, and I have found other seemingly more complicated functions which compiled fine. Jan 16 comment More efficient matrix-vector product @Jens Actually, I asked that question :) Jan 15 comment More efficient matrix-vector product @rcollyer What exactly do you mean by generating in eigenspace: if $A = S \Lambda S^{-1}$ then I should do $Ax = S \Lambda S^{-1} x$? Also, I read your link on spherical components, but didn't really get how that would translate to the present problem. Again, thanks for the help. Jan 15 comment More efficient matrix-vector product Hi all. Sorry for the delay in answering. Yes, $A$ will usually have full rank. It is also symmetric and has zero diagonal. But I don't know all the $x$'s in advance, so I need one dot product at a time. Thank you all for the support. Dec 8 comment Converting other C++ classes to MTensor in LibraryLink @halirutan Oh yeah! Very much :) Aug 25 comment Computing polynomial eigenvalues in Mathematica @J.M. Amazing answer. Thank you a lot. Aug 24 comment Computing polynomial eigenvalues in Mathematica @ruebenko the example above comes from solving Newtons law for a system of particles. Gotta think about more examples. :) Aug 23 comment Odd behavior of GridGraph and DirectedEdges @DavidCarraher Thanks for the answer. I'll report it as a possible bug. I am not sure this is related, but GridGraph draws the graph differently from other graphs. Aug 14 comment LeastSquare Solution for the Continuous Time Lyapunov Equation No. I saw that on the documentation for LyapunovSolve but I don't understand the Mathematics of e Kronecker product. Aug 14 comment LeastSquare Solution for the Continuous Time Lyapunov Equation For least squares what I do is write a symbolic symmetric matrix in the sorts of R = Array[r,{n,n}]/.r[i_,j_]/;jr[j,i]. Then I do {b,B} = CoefficientArrays[Flatten[A.R + R.A[Transpose] + G], vars] where vars = DeleteDuplicates@Flatten@R. Finally, I do LeastSquares[B,b]. Aug 1 comment Converting other C++ classes to MTensor in LibraryLink @LeonidShifrin I'm sorry Mr. Shifrin. I am still learning about LibraryLink and most of what you said I did not understand. Say I have a 2x2 matrix a[i][j]. Then what I want is to define a 2x2 MTensor m such that m[i][j]=a[i][j]. Hopefully, it would be nice to do this without a double for loop with m[i][j]=a[i][j]. Jul 31 comment Converting other C++ classes to MTensor in LibraryLink @LeonidShifrin I have edited the question with a situation where it is possible to access the data via a pointer. In that case, a simple solution exists? Jul 27 comment Efficient Langevin Equation Solver @acl I am not sure how to do this. But I note that it depends strongly on the choice of parameters and, since the equations are non-linear, I am not sure a closed form solution for this has been found. Jul 27 comment Methods to speed up numerical NDSolve, NIntegrate, @ruebenko Ok, sure thing! :) Jul 26 comment Efficient Langevin Equation Solver I just tried running an index through through the NestList with pre-generated RandomVariate; apparently it is slower. Jul 26 comment Efficient Langevin Equation Solver acl, your timing is the same as mine i Think. In the first one you compute two simulations (data1 and data2) and in the second one you compute only one. Both have similar run times, and given the simplicity of NestList + the ability to accept any function, I don't really see much advantage. Jul 26 comment Efficient Langevin Equation Solver I don't think so. This only generates the random numbers once. $r$ must be re-computed within each iteration. Ideally this would be done with r = RandomVariate[NormalDistribution[0,s],{m,n}]. But then you can't really nest this matrix; or at least I don't really know how.