![]() ![]() If your response to the rules about requiring ab cd instead of a*b c*d is: you should avoid cumbersome input/output formats, then I'd like note that the input and output formats are very flexible. When there are two output matrices then it's just to show other outputs that would be accepted. The two input matrices are shown with an empty line in between. Any standard input and output method is OK.You may of course use escape characters in the input if necessary ( \' instead of ').Built-in functions are accepted (but probably a bit cumbersome due to the formatting requirements).You may assume that the matrices are non-empty.Matrix multiplication will always be possible with the given dimensions. I'm aware that this allows a lot of formats that will look messy, but the challenge is about multiplying matrices, not formatting the output. "ab cd" <- This will look awful, but it's still accepted. All the examples below are valid ways of entering and outputting a matrix. Both matrices must be inputted on the same format. The order need not be consistent as long as it's mathematically correct.Ī matrix can be entered in whatever format you like, except a single string with no delimiters between rows (this is because the output would be completely messed up). ab cd, dc ab and cd ba are mathematically speaking the same, so you can choose the order here too. So, what you could normally write as a*b c*d will be ab cd. The rationale for those two rules is: All non white space characters are allowed as symbols in the matrices, thus using them as mathematical symbols would be messy. It's a b, not a b, plus(a,b) or something similar. The sum of terms should have a space (ASCII code point 32) in between. You must output the product of these matrices.Ī product of two entries shall not have any symbols in between. You shall take two matrices as input, where each element in the matrices are represented by an non-whitespace ASCII-character (code points 33-126). Implement symbolic matrix multiplication in you language. If you perform matrix multiplication on these to matrices, either AB, or BA you'll get the results below: Suppose you have two matrices, A and B, where A is 3-by-2, and B is 2-by-3. ![]() If you want more detailed information, I suggest you visit the Wikipedia-article, or the explanation on WolframMathWorld. I'll stick with a single figure since I believe most people here are familiar with it (and the figure is very descriptive). There are lots of different ways to explain matrix multiplication.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |