Is there any open source Java implementation for LDPC (Low Density Parity Check) codes, I found only MATLAB codes.
My scenario is I will take text file and divide into block and I will delete some data in text file, and by using LDPC codes I need to recover data from text files.
Thanks.
I haven't tried this but the code here should get you started
http://www.cs.utoronto.ca/~radford/ftp/LDPC-2006-02-08/install.html
http://www.cs.utoronto.ca/~radford/ftp/LDPC-2006-02-08/examples.html
It's in C though. Might be easy to port. Or not.
I'd suggest looking into ways of calling matlab functions in java. I know there are a couple. Also why LDPC? While its one of the best FEC, it involves lots of matrix manipulation if I recall correctly. This is stuff much better suited for mat[rix]lab. The right tool for the right job...
There are also these two pure Java implementations:
https://github.com/a4a881d4/ldpc-java
https://github.com/pierroweb/LDPC-correcting-codes
I haven't tested them and would appreciate feedback from anyone else that has.
There's also a Java wrapper around a C++ library: http://cpham.perso.univ-pau.fr/MULTICAST/Java_wrapper_for_LDPC.html
Not the most promising results, but something to start from, at the very least.
Related
I'm a decent C++ programmer, good enough to do what I want. But I'm working on my first Android App (obviously not C++ related), and I'm having an issue where I'd like to translate what I know from C++ over to the XML/Java used in Android Studio.
Basically I have (in C++) an array of structures. And maybe I didn't do the perfect search, but I sure as heck tried to look around for the answer, but I didn't come up with anything.
How would I go about placing an array of structures inside the XML file and utilizing it in Java?
As a bit of a buffer, let me say that I'm not really looking for code, just verification that this is possible, and a method on how to go about it. I don't mind researching to learn what I want, but I haven't come up with anything. Like I said, I probably haven't googled it properly because I'm unsure of exactly how to ask it.
EDIT: So it appears that XML doesn't have a structure (or anything similar? not sure). But I can utilize a Java class with public variables. Now my question is more or less: What would be the best way to go about inserting all the information into the array/class/variables?
In C++ terms, I could neatly place all the info into a text file and then read from it, using a FOR loop to place all the info in the structures. Or, if I don't want to use an outside source/file, I could hardcode the information into each variable. Tedious, but it'd work. I'm not sure, in Android terms, if I could use the same method and pack in a text file with the app, and read from the file using a FOR loop to insert the information into the array/class/variables
class answerStruct
{
public String a;
public boolean status;
};
class questionStruct
{
public String q;
answerStruct[] answer = new answerStruct[4];
};
I'm not placing this here to brag at my super high tech program, but to give a visual, and frankly that's less I have to write out. This is the method I plan on going with. But, being Java, I'm open to possibly better options. My question still stands as far as inputting information into the variables. Hard code? or does Android/Java allow me to place a text file with my app, and read from it into the variables?
XML is just a markup language for tree-structured data, and imposes no restrictions on how you name or structure your tree nodes.
What I think that you're looking for is an XML Object Serialiser: a way to serialise your in-memory structure into XML for a more permanent storage, and then at a later run, deserialise it back into memory. There are many XML Serialisers for Java, each with an own proprietary XML format.
I've used Simple XML in the past, and found it easy and flexible.
So I'm reading up on delta encoding, and I was looking around for some good examples of it. I think Google Chrome uses something like that for patch updates, rsync might, and the Wikipedia article implies that alot of online backup tools use this.
I'm curious if there are any good Java libraries out there that do this kind of work? There seem to be an abundance of *nix and C-based tools, but little or no Java equivalents that do much more than compress data structures.
In any event, this is an entirely new concept for me, so I'm curious to read up on anything about it, with a particular interest in seeing anyone using Java to do it.
I know this is an outrageously old question, but I decided to post this here just incase anyone else stumbles onto the same problem.
This is what I am currently using. It's really simple and works great.
https://code.google.com/p/xdeltaencoder/
You will need to make sure to checksum the source though (in my case fileAJson), as it does not do it automatically for you!
Anyways, code below:
//Create delta
String[] deltaArgs = new String[]{fileAJson.getAbsolutePath(), fileBJson.getAbsolutePath(), fileDelta.getAbsolutePath()};
XDeltaEncoder.main(deltaArgs);
//Apply delta
deltaArgs = new String[]{"-d", fileAJson.getAbsolutePath(), fileDelta.getAbsolutePath(), fileBTarget.getAbsolutePath()};
XDeltaEncoder.main(deltaArgs);
//Trivia, Surpisingly this also works
deltaArgs = new String[]{"-d", fileBJson.getAbsolutePath(), fileDelta.getAbsolutePath(), fileBTarget.getAbsolutePath()};
XDeltaEncoder.main(deltaArgs);
Update data only by difference between files (delta for java)
Wikipedia lists several Java implementations for the VCDIFF delta format.
There also exist Java implementations of the rsync algorithm, which can be used to create binary diffs. They don't seem production-ready, but if you just want to see the code they're fine. See Any good rsync library for Java?.
I have to use a java program . I need to understand it and then modify it. The program has a source folder. It has a lot of java files. the program has a GUI interface. i have imported the program in eclipse and i can run the program. i want to learn and understand the code but since its too big i want to only read the relevant portions of the code which i need to understand to modify / add features to the program. This program requires input data . this data can be in a CSV file or a MySql database. the immediate problem i am facing with the program is that i need to use float data as input data in one of the columns. when i put data in decimal form in the CSV file . the program has no problem in accepting it and processing it. but when i create a MYSQL database table with floating datatype as one of the column . the program while importing data gives error - "unknown data type float . add this entry is xxx.props file " even after i add the float entry in xxx.props file in the proper way just as other entries are there for other data types in xxx.props file, i still get the same error . what should i do next ? which part of the code should i study to find out the problem?
When you say it "gives error" - does it throw an exception? If so, find out where that exception is thrown from, and work backwards from there.
You haven't explained what the xxx.props file is, how you created the mysql table, or what you're then doing with it, which makes it kinda hard to give any more specific help...
Without a direct question, I can't help you much. However, I can advise you on how to solve the problem.
Learn the basics before you try to make a leap to do everything at once. Try to learn these before coming everything:
Get a working knowledge of Java
Figure out how to develop a GUI that isn't binded to your logic. (Take a look at the MVC design pattern)
Break up the big program into manageable parts
Implement your logic separately from your data access (M C part of MVC)
Use Unit Testing to verify that your components work
Implement the CSV reading, and then move it to the database
This way you have seperable components that will make your job easier to deal with, and you will learn quite a bit along the way.
You've got a lot of small questions but I think your main question is "why am I getting this 'unknown data type float' error". Without looking at any code my first suggestion would be to validate how you're inserting/updating the MySQL table. Hopefully the developer extrapolated the data tier from the UI tier meaning there should only be one or two java classes to look at to verify how the data is inserted.
Overall, it sounds like you're new to Java and application design. Try to follow how the program works from point A to point B. Hopefully the code was broken out into tiers to make it easier for you; IE the GUI is in it's own package/project and the business logic is in it's own package/project, so on and so on.
What's the best way to do spreadsheet-like calculations in a programming language? Example: A multi-user application needs to be available over the web that crunches columns and cells of numbers like a spread-sheet based on user submission. What are the best data structures/ database models/patterns to handle this type of work so that handling the different columns are done efficiently and easily in php, java, or even .Net. Is it better to use data structures within the language, or is it better to use a database? If using a database is the way, how does one go about doing this?
To do the actual calculation, look at graph theory. Basically you want to represent each cell as a node in a graph and each dependency as a directed edge. Next, do a topological sort to calculate the value of each cell in the right order.
Aspose.Cells (formerly Aspose.Excel.Web) is a good way to get the functionality you are looking for.
Unless you are asking more for a "How is it done?" than "I need to do it." Then I would look at the other answers given.
Along the lines of "I need to do it"
Microsoft has Excel Services which does just what you want.
Spreadsheet operations on the server. It is available via a web services interface, so you can connect and drive calculations from Java, PHP, .NET, whatever.
Excel Services is part of Sharepoint 2007.
Resolver One is a Spreadsheet app made in IronPython.
There is an explanation of the overall mechanic for the calculation [pythonology.org] it uses for user generated ecuations.
The relevant image showing Resolver One's overall algorithm.
Should note that users can write python code to be interpreted both on the cells and a special 'outside of sheet' place.
Look at another question here in SO, from where I reused my answer.
I can't tell you how to do it. But I would recommend you to look at the code of PHPExcel. PHPExcel is a library that allows you to create Excel files within PHP.
The workflow of PHPExcel is simplified like this:
Create an empty Excel file object
Add cells (with either data or formulas) to the "Excel file"
Call the create function which is generating the file itself
In your case you would have to replace 3. with something like "Create web interface".
Therefore I would recommend you to look at the code of this open source project and look how the general structure is. This should help you solving your problem.
I once used a binary tree to store the output of parsing a string using BODMAS. Each node was an operation between two other nodes, which could be a number, a variable or another operation.
So y = x * x + 2
became:
+
* 2
x x
Sadly this was at school in Pascal and is stored on a 5 1/4" disk, so you don't want it :)
SpreadsheetGear for .NET will let you load Excel workbooks, plug in values, calculate and then get the results.
You can see a few simple ASP.NET calculation samples here, other ASP.NET samples here and download a free trial here.
Disclaimer: I own SpreadsheetGear LLC
I must point out that google spreadsheets already does this kind of stuff.
I'd like to generate an image file showing some mathematical expression, taking a String like "(x+a)^n=∑_(k=0)^n" as input and getting a more (human) readable image file as output. AFAIK stuff like that is used in Wikipedia for example. Are there maybe any java libraries that do that?
Or maybe I use the wrong approach. What would you do if the requirement was to enable pasting of formulas from MS Word into an HTML-document? I'd ask the user to just make a screenshot himself, but that would be the lazy way^^
Edit: Thanks for the answers so far, but I really do not control the input. What I get is some messy Word-style formula, not clean latex-formatted one.
Edit2: http://www.panschk.de/text.tex
Looks a bit like LaTeX doesn't it? That's what I get when I do
clipboard.getContents(RTFTransfer.getInstance()) after having pasted a formula from Word07.
First and foremost you should familiarize yourself with TeX (and LaTeX) - a famous typesetting system created by Donald Knuth. Typesetting mathematical formulae is an advanced topic with many opinions and much attention to detail - therefore use something that builds upon TeX. That way you are sure to get it right ;-)
Edit: Take a look at texvc
It can output to PNG, HTML, MathML. Check out the README
Edit #2 Convert that messy Word-stuff to TeX or MathML?
My colleague found a surprisingly simple solution for this very specific problem: When you copy formulas from Word2007, they are also stored as "HTML" in the Clipboard. As representing formulas in HTML isn't easy neither, Word just creates a temporary image file on the fly and embeds it into the HTML-code. You can then simply take the temporary formula-image and copy it somewhere else. Problem solved;)
What you're looking for is Latex.
MikTex is a nice little application for churning out images using LaTeX.
I'd like to look into creating them on-the-fly though...
Steer clear of LaTeX. Seriously.
Check out JEuclid. It can convert MathML expressions into images.