Identity Matrix

Question: Define a function 'im' that returns an n x n identity matrix

More Information:

https://en.wikipedia.org/wiki/Identity_matrix

Example

                                
                                q)im[3]
100b
010b
001b
                                
                            

Solution

Tags:
functions iterators math
Searchable Tags
algorithms api architecture asynchronous c csv data structures dictionaries disk feedhandler finance functions ingestion ipc iterators machine learning math multithreading optimizations realtime shared library sql statistics streaming strings tables temporal utility websockets