Linear Algebra Library for Sparse Matrices [closed] - matlab

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I am interested in porting my Matlab implementation to C++ for speed improvement. I tried armadillo. It is perfect for porting code from Matlab because Armadillo's library functions names/syntax is very close to that of Matlab programming. However I realized that at some places Matlab out performed armadillo because my data is mainly sparse and armadillo does not give it any special treatment and simply treats it as dense matrices. Armadillo team is working on sparse matrices support but currently it is not available. So I am looking for a library which like Armadillo has syntax very close to Matlab (or is easy to use) and supports sparse matrices for speed and space optimization.

Not sure what you are trying to do but try SPAMS. it's a good and fast sparse modeling implementation.

Version 3.6.2 has more Sparse Matrices support.

As of version 3.4, Armadillo has preliminary support for sparse matrices. This is likely to get more complete in future versions.

Related

Danielsson Function [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I am implementing an image segmentation algorithm, at some point I need to implement a function named "Danielsson Function" which 'transforms a binary image into a grayscale distance map in which each particle pixel is assigned a gray-level value equal to its shortest Euclidean distance from the particle border'.
I'm not an expert in image processing and the only way I can imagine is using a BFS algorithm for every pixel but that would take ages.
I couldn't find much in web, so I want to know is there any optimized way to implement this or is there any Matlab/Octave function that can do such thing?
you can simply do that by using the "bwdist" matlab function, as the comments mentioned
and here is the link for help if you needed any :
Distance transform of binary image - MATLAB bwdist
And here is the code :
I=uint8(bwdist(some_binary_image))
Be sure to use the 'uint8' because 'bwdist' only gives you the distance matrix which has double number values.

software for non linear dynamic system simulation [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I am looking for a software package (free better) that can be used for stochastic dynamic system simulation with minimal coding. For example it should allow me to model a system by specifying:
Xn = AXn−1 + Vn,
Yn = BXn + α Wn
where X is the state, Y observation, A,B matrices and Vn and Wn are noise sources with different pdf's such as normal, T, etc.
I've already tried scilab and R. Although they seem to be very powerful, it does not seem to provide direct support to create models by specifying above equations.
If the noise is Gaussian, what you have is a stochastic differential equation (SDE) written as a recurrence relation. If you're looking for something with "direct support" such systems you should specify what they represent physically – economic models, neural models, Kalman filtering, etc. – rather than just the abstract equations because such packages are generally written with an application in mind.
Matlab does have the Econometrics toolbox which is usually not included with most installs but can solve general SDE problems outside of finance as well. For a free option, you can also look at my SDETools which is a Matlab toolbox for the numerical solution of SDEs that works very similarly to Matlab's own ODE solvers such as ode45. You will need to transform your recurrence relations to differential equations. And of course if you want the fastest code possible (stochastic simulations can be slow) it will always be better to code up the Euler-Maruyama method for your particular problem.
If you're looking for something that will do what you want without having to learn much about the underlying math you will most likely be out of luck. Also, if your noise is not Gaussian then the rules are different and you may need to learn about jump processes and the family of alpha-stable distributions.
"Open modellica" (https://www.openmodelica.org) might be what you are looking for.

Any tool to differentiate a tensor wrt another tensor? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I have been dealing with continuum mechanics, and there are a lot of operations where I need to get the derivative of a tensor with respect to another tensor. I'd love to try to do that symbolically, on computers.
For example, the elasticity tensor c = d(2nd PK stress) / d(strain tensor), while both 2nd PK stress tensor and strain tensor are 3x3 matrices, and the resulting elasticity tensor is 3x3x3x3 4th order tensor.
I tried to use sympy, but it seems that the most it would support is a matrix (tensor of order 2). The ndarray in numpy is simply not in sympy.
I used to use matlab, and am now aware of any way that it would work in matlab either.
Therefore, I was wondering that, is there any tool that is available for this purpose? Can mathematica do that?
Thanks a lot in advance!
-Shawn
A way to do this in python would be to use numpy arrays using dtype=object so that you can fill them with sympy expressions instead of numbers. However you will have to write all the convenience methods yourself (but they would be extremely simple, just looping already implemented sympy function over the numpy arrays).
This obviously can be done in Mathematica as well or in Matlab if you install the necessary symbolic packages.
Mathematica also has packages for tensor analysis, but they would be an overkill for the problem that you are describing. In the same way, there are various packages for differential geometry and tensor analysis in SymPy, but again, they would be an overkill.

How to find the solution space (x,y,z) for a function f(x,y,z)=0 in MATLAB [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have a function, dependant on a vector k=(x,y,z) and a function f(x,y,z)=0, I would like to find the solution space for (x,y,z).
Can this even be done analytically in matlab? I imagine it can be done numerically because my initial thought was to plot the surface created by this function, however this is of no use to me as I have 9 other constants in my equation with no numerical value assigned to them. Many thanks in advance for any help.
EDIT: This is for a polynomial degree 4.
There are no generic, analytical solvers for given function f(x,y,z) neither in matlab, nor in any other language. If such solution would exist, the Riemann hypothesis (and dozens others) would be solved ;)
For simple problems you could use symbolic math toolbox and a solve function:
http://www.mathworks.com/help/symbolic/solve.html
And obbiously there are numerical solvers, which you can use like vpasolve and others
http://www.mathworks.com/help/symbolic/vpasolve.html

Scala environment for statistical computing and graphics? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
Please advise on Scala environment for statistical computing and graphics similar to R or Weka.
Thanks!
Perhaps Scalalab is what you're looking for.
The scripting language is based on the Scala programming language
enhanced with high level scientific operators and with an integrated
environment that provides a Matlab-like working style. Also, all the
huge libraries of Java scientific code can be easily accessible (and
many times with a more convenient syntax). [...] A major design
priority of ScalaLab is its user-friendly interface.
See also Is there a good math/stats library for Scala?
I'd suggest Breeze : http://www.scalanlp.org/ , https://github.com/dlwh/breeze/
It has some predefined Classifiers, Learning Algorithms (SVM , Regeression...), a Plotting Library and support for matrix Multiplication.
Here you can get a quick overview: https://github.com/dlwh/breeze/wiki/Quickstart