Retired
Matrix-vector product (retired)
19sam-home
Loading description...
Algorithms
Graphs
Data Structures
Dynamic Arrays
Arrays
Functional Programming
Data Types
Declarative Programming
Programming Paradigms
Vectors
Arithmetic
Mathematics
Logic
Numbers
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Sample tests expect a different return format than the ATTEMPT tests.
Solved.
[[x], [y], [z]]
instead of[x, y, z]
as stated by the description (the latter is wrong)to make a kata about matrix multiplication that is not 100% copy of the existing ones?looking at your completed katas list, I can see that you haven't done any of the existing matrix multiplication katas, so you've added this restriction just for the sake of it?)Solved.
Why? It works without errors.
Fixed tests for what? Why are they needed?
This is a similar problem, not the same. This kata is only a special case for multiplying matrices and it is easier for beginners than the other one.
Please read this article: https://docs.codewars.com/languages/python/authoring
Please read also this article: https://docs.codewars.com/authoring/guidelines/submission-tests#fixed-tests
Why has the second argument (of what?) has the form [[x], [y], [z]]?
I don't get the point. Why is it important, that you understand my intention? Why is my completed kata list important?
What did I miss here? Quote[Imports]: „This is a convention used in many Python kata, but it's not a requirement, and authors can choose to import the module in any way they find suitable for them.“
What did I miss here? The „Example Test Case“ has fixed test and the „Test Case“ has only random tests. I think its enough for solving the problem and this kata consists of fixed tests and random tests. Why is this not enough? And where did I break the guidelines?
Is this the same issue like "Sample tests expect a different return format than the ATTEMPT tests." and "^ The same issue is true for the function output"?
Because you made the random input generator create such arrays? Also, a different part of the description became wrong after you'd fixed the issue above.
Yes.
The fact that you have to import the test framework.
Final tests (almost) always must include fixed tests and random tests. The contents of the sample tests are irrelevant here.
Even if we assume that it's okay for this kata to exist because it's a special case simplifying the problem, it can be solved with exactly same code as those other matrix multiplication katas, so they'll inevitably spoil one another. And in that case I can just as well say that this is trivial map/filter/reduce task lacking any novelty (or considering you can solve it like this, it might be more appropriate to say that this kata is doing basic arithmetics).
So this is already solved.
Why is it a fact? In the guideline I found:
„For simplicity, through the rest of this article it's assumed that the codewars_test module is imported and aliased as test with the following statement.“ (your point)
But I also found:
„This is a convention used in many Python kata, but it's not a requirement, and authors can choose to import the module in any way they find suitable for them.„ (my point)
I think it's not clear.
Can you explain why it is a fact? And can you also answer my other question related to this: „Why? It works without errors.“
What does „almost“ mean in this context? Where in the guideline can I find that sample tests are irrelevant and fixed tests should always be in „Test Case“-Block and not in „Example Test Case“-Block? And what is the sense behind it?
I still don't get the point. The large part of all katas in codewars are trivial map, filter and reduce tasks. Yes, it can be solved with the same code, but only if you solve it for the general case. In this kata it is not necessary to solve the general case. The solution of this kata (special case) cannot be used for the other kata (general case). So it's not the same problem and therefore no duplicate.
My argument is that this kata is easier to solve for beginners, because they don't need to solve the general case.
Importing in any way you like does not include choosing to not import. It means you can choose to do
from solution import *
orimport solution as foo
orfrom solution import bar as x
if you wish, but you must still import.It works currently without errors, to support older katas which are not yet updated. But all katas should follow the guidelines regardless. It could be in the future that it will be changed to only work with imports, at which point your kata will be broken.
Almost means all katas, with a few unique exceptions, for which random or fixed tests simply do not make sense. For example.
The sample tests are just for user convenience. The solver does not have to run them in order to pass the kata, which is why they are not relevant here (they are important in a kata, but not the topic of the issue). If a sample test contains an edge case, for example, and the full tests do not contain that edge case, then the solver can simply ignore it and solve anyway. See the issue?
No, you haven't addressed that point at all. I don't understand based on what you've come to this conclusion after I literally said "a different part of the description became wrong".
codewars_test
astest
is a convention, importing the test framework is a requirement.General-case solutions spoil the other katas, and there're already quite a few general-case solutions submitted here. Even if a mod hides them all, you can't stop people from submitting those unless you forbid importing specific/any libraries.
@Kacarott
That makes sense.
This makes sense, too. This explains why the tests works without import.
No I don't. In my case all fixed tests are available for solver in sample test. They can see them, use them and extend them. And edge cases are testet in attempt part. The solver are not able to ignore the edge cases and solve the kata anyway.
??? But they aren't? The attempt part only contains 20 random tests. If a user solution for some reason failed a test like
A = [[0, 0, 0], [0, 0, 0], [0, 0, 0]], x = [0, 0, 0]
then they can just ignore it because the chance of that exact test appearing in the random tests is incredibly rare.@FArekkusu
Because you wrote that's the same problem as the one rowcased described and rowcased maked his problem as resolved.
I sill don't get the point. The are a lot of katas (not Beta) where katas spoil other katas. In my oppinion you try to find a reason why this kata is a bad idea. May be I am wrong, but it's not important anymore.
Please delete this kata. I tried it before, but I don't have permissions.
@Kacarott
My mistake, I used wrong words. The question was not about edge cases or not. It was about fixed tests in attempt part or not. In most cases I would say it's necessary to take fixed tests in attempt part and I understand your arguments. But in this concrete case I think it's not, because my tests do not check edge cases at all. I don't think that A = [[0, 0, 0], [0, 0, 0], [0, 0, 0]], x = [0, 0, 0] is an edge case, because if the algorithm works this case should also work. Yes, we can argue about it, but I think it's enough for this kata and it is also better than many other tests in codewars where I did mistakes and got nevertheless points for the katas.
Thank you that you gave me clear answers to my questions.
Can you delete this kata now, please.
Yes I was not trying to tell what is or isnt an edge case, I was just trying to explain the reason why most katas need fixed and random tests.
Unfortunately, no one can delete the kata. I know there is a 'delete' button, but as soon as anyone solves the kata it cannot be deleted anymore. (It is a bit strange, I know)
But it has already been automatically retired because of being too similar to other katas, so it won't show up in the kata list anymore.
You are right here, many older katas tests in Codewars are very bad. But this is why the beta process now is so strict now, to make sure that all the issues are already solved before approval so we don't get even more bad ones. And we are working on fixing the older ones, but it takes a long time :)