uncomplicate

rrottier 2017-07-05T02:57:35.347188Z

Not yet, I was simply playing along with the linear algebra book and they point it out as one of the special matrixes that are quite useful.

2017-07-05T05:19:13.482795Z

That's the catch: The identity element is the most important element when you develop algebra theory (thus also linear algebra theory). It is special because it doesn't change anything under the algebraic operation at hand. So, in computing, if you don't want to change anything, simply don't run the computation 🙂

2017-07-05T05:20:52.497426Z

With matrices, additional thing that you need to consider is that for each dimension n, you can make nxn identity matrix to be used in computations where nxn dimension needs to be fitted.

2017-07-05T05:21:42.504467Z

Also, Neanderthal supports several different data structure formats for special kinds of matrices. Each of those formats can also hold an identity matrix.

2017-07-05T05:25:56.541283Z

You can create an identity matrix with certain dimensions by creating a zero matrix and setting its diagonal to 1.0:

(let [a (some-matrix-that-you-provide)]
  (entry! (dia (zero a)) 1.0))

2017-07-05T05:28:12.561859Z

Or, if you need a triangular identity matrix, you can use a special case where :diag is :unit: (dtr n {:diag :unit})

2017-07-05T05:29:00.568541Z

But, again, most of the time, why would you create identity matrix instances? They do not change anything.

2017-07-05T05:29:20.571283Z

And I suppose you'd want to use your code to compute some data...