Jake Brooks
Jake Brooks
MModular
Created by samufi on 9/21/2024 in #questions
How can I use a fixed-size integer type to index a list?
My bad, int is correct. It actually is a function call: https://github.com/modularml/mojo/blob/8c35a418eadf31c7343887e1e2088a18d2d9f403/stdlib/src/builtin/int.mojo#L213 I'll trust sora that it actually generates better assembly 🙂
7 replies
MModular
Created by samufi on 9/21/2024 in #questions
How can I use a fixed-size integer type to index a list?
IIRC list indexing takes an Int, so the only way is to wrap the index: l[int(ind)]
7 replies
MModular
Created by Firas on 9/9/2024 in #questions
vectorize functional VS SIMD regular ops
In Mojo, all values are SIMD values, so by loading data from the heap (via SIMD.load) you are already creating a SIMD value that can use SIMD operations. Under the hood, all vectorize is doing is picking an optimal value of simd_width to use. There are no special conversions going on.
7 replies
MModular
Created by Firas on 9/9/2024 in #questions
vectorize functional VS SIMD regular ops
If i understand your question correctly, the second process will be slower since you would be fetching data from the heap before performing the multiplication. Simply multiplying two SIMDs is faster than storing the data on the heap, reading it into two SIMD objects and then multiplying them. Also, a word of caution for the future, the current plan as I understand it is to remove DTypePointer in the future. You should use UnsafePointer instead.
7 replies
MModular
Created by Jake Brooks on 6/6/2024 in #community-showcase
A Complex Math Library for Mojo
Interesting package, I don't know about combination as I wanted to keep mine as just what one expects from a complex number standard library package. But it's interesting to see your implementation!
9 replies
MModular
Created by Jake Brooks on 6/6/2024 in #community-showcase
A Complex Math Library for Mojo
There are no under the hood conversions, as all the math functions apply the same floating-point constraint as in the normal Mojo math library. The only exception to that is csquare which can be performed on any DType.
9 replies
MModular
Created by Jake Brooks on 6/6/2024 in #community-showcase
A Complex Math Library for Mojo
Just pushed an update that adds docstrings for all functions, comments with formulas + derivations for the math functions, and tests for all math functions. This is v1.0, though I'm only like 80% sure that the math functions will behave correctly around the edge cases (particularly with +/- inf, NaNs, and zeros). If a user finds an issue here, definitely let me know.
9 replies
MModular
Created by seboll13 on 4/11/2024 in #questions
Easier way to sum a list of integers
Since the map function isn't part of the builtin module, you'll need to explicitly import it: from algorithm import map
13 replies
MModular
Created by Jake Brooks on 2/9/2024 in #questions
Determining Tensor datatype at runtime
ah of course, thank you!
3 replies
MModular
Created by Jake Brooks on 10/3/2023 in #questions
Possible to get a meaningful time value?
That's perfect, I'll have a look more into it now I know where to look. Thank you!
14 replies
MModular
Created by Jake Brooks on 10/3/2023 in #questions
Possible to get a meaningful time value?
I believe the repo belongs to @sa-code, perhaps you can explain?
14 replies
MModular
Created by Jake Brooks on 10/3/2023 in #questions
Possible to get a meaningful time value?
Ah that's bang on the money, thank you! If you don't mind me picking your brain a little more... I thought external_call might be what I was looking for, but I was unsure what exactly the docs meant by 'external function'. Is there a way of knowing what information to pass to external_call and what you'll receive from it? For example, the repo you linked calls clock_gettime. How does Mojo know where to find this function?
14 replies