I rewrote entire question to make it clear.
I need a type that can hold a stochastic matrix. I need this to be in Java or C# (Java preffered).
I need a built-in type. It could be a class written by someone but a problem is that in my thesis I need reference to everything so it should come from an article, book, etc…
As in stochastic matrix, all elements in a row need to sum to 1, I need a datatype that will guarantee that. I am aware of the fact that a built-in types can’t guarantee that. But is there a type that can guarantee that is we assume that every value calculated is rounded up to e.g. 10 digits?
I also need a reference to a book or article where it is mentioned that this data type can be used for storing stochastic matrices in computer memory.
Is BigDecimal from Java or decimal from C# suitable?
There’s no inbuilt type (in either of those languages) that will satisfy the (reasonably arbitrary) requirement that all the rows sum to 1. Of course, it’s pretty trivial to write this yourself (and in the case of floating points, using the appropriate error margin …).
I can’t imagine why you need a reference for just saying “the matrix will be stochastic”. If you need to clearly specify the type (for some bizarre reason …) then you’ll have to resort to specifying the algorithm that will enforce the integrity you need (which, obviously, is remarkably trivial.)