Comments (6)
1. Clarification: I was referring to the get(int, int) and set(int, int)
methods.
2. Correction: MatrixMatrixMult was a bad exmaple as it does not contain calls
to these methods, but many other classes in org.ejml.alg.dense contain
references to get(int, int) or set(int, int), which could be replaced by
unsafe_get(int, int) and unsafe_set(int, int) for DenseMatrix64, the most
commonly used matrix type.
Original comment by [email protected]
on 23 Nov 2011 at 10:58
from efficient-java-matrix-library.
Do you see any place where calls to set(int,int)/get(int,int) are being called
in the inner most loops? Just noticed that insert/extract does that and that
is being changed.
In an ideal world, all calls would be made to those routines since it is
possible to catch simple errors that would otherwise go unnoticed. There might
be a few places where those calls were left in place because it was thought
that it would not effect performance.
Original comment by [email protected]
on 23 Nov 2011 at 12:24
from efficient-java-matrix-library.
There are other instances too, e.g. in CommonOpts, MatrixComponent,
MatrixFeatures, plus most decomposition classes.
Original comment by [email protected]
on 23 Nov 2011 at 12:36
from efficient-java-matrix-library.
Some places inside of CommonOps might benefit from the change. Other places,
like in MatrixComponent, would not. Inside of MatrixComponent it works with
Graphics2D at the pixel level, which is "slowish" and rendering for
visualization tends to not be a time critical task. The general rule is that
unless there is a good reason to change it is better to use the safe method.
Interested in check out some functions inside of CommonOps and benchmarking
them across a range of matrix sizes to see if they would benefit from the
change?
For examples of how to benchmark see "benchmarks/src/org/ejml/*".
Original comment by [email protected]
on 24 Nov 2011 at 5:59
from efficient-java-matrix-library.
I agree on MatrixComponent, but I think MatrixFeatures, e.g. isSymmetric(),
could benefit if the method is called often.
I kinda disagree with "don't change because it's safer" for the following
reasons:
- The bounds checks made in get(int, int) and set(int, int) can be moved
outside of the inner loops without sacrificing safety at all.
- It is library code, and library code "is allowed" to use unsafe methods
because the library "knows what it's doing".
- Library code should be very well unit-tested to avoid any errors introduced
by using unsafe methods.
Anyway, up to you really, but I think the changes might make a difference in
benchmarks (I haven't run any), and by simply moving the bound check out of the
inner loops you don't sacrifice any safety.
Original comment by [email protected]
on 25 Nov 2011 at 9:27
from efficient-java-matrix-library.
Its very hard to prove that code is correct in all situations. In EJML I try
to test as many situations as possible but even then I do occasionally find
nasty bugs in code that was deemed to be correct. If you want to have fun take
a moderate sized C/C++ program which is "bug free" that no one has run a memory
checker on and see what valgrind finds. valgrind does a good job of detecting
buffer overruns and bad pointers.
I'm going to close this ticket, but there are probably some simple functions
that would be improved with this change.
Original comment by [email protected]
on 2 Dec 2011 at 2:56
- Changed state: Done
from efficient-java-matrix-library.
Related Issues (20)
- Request for additional element-wise matrix operators HOT 1
- MatrixFeatures.isPositiveDefinite modifies the matrix if sandwiched with invert() HOT 1
- Add support for matrices with zero dimensions HOT 1
- Request for adding a multiplication method for more than two matrices HOT 2
- There's problem at Big matrix HOT 1
- Add flag to automatically order singular values in SVD HOT 1
- Erroneous calculation of the determinant of a matrix HOT 6
- Matrix inversion should fail if matrix contains NaN HOT 1
- Matrix reshape question HOT 1
- CovarianceRandomDraw documentation incorrectly states that argument cov is no modified HOT 1
- Add complex eigenvectors
- LinearSolver (symmPosDef) doesn't appear to work at all. HOT 1
- LinearSolverChol::solve(B,X) - obvious BUG in dimensions check HOT 1
- SimpleMatrix invert: no exception for singular matrix HOT 6
- Searching for org.ejml.simple HOT 1
- make 32bit float (float) versions of all matrices HOT 1
- possible problem with solve with larger dimensions HOT 1
- Add RandomMatrix.setGaussian() HOT 2
- Matrix rank seems incorrect for large matrices HOT 3
- SimpleBase.loadCSV is not extensible HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from efficient-java-matrix-library.