mratsim: try the code in the beginning and you will see the same error I'm
getting. Jama actually uses seq[seq[float]] for storage. But this
representation will be better right?
Well [here](https://gist.github.com/notTito/aaeb00ef41c3c56c0e3bf2e3c2a7bc29)
are some benchmarks I made to test
`UPDATE`, mostly more tweaking of `proc twins_sieve`. Tried different loop
structures|idioms to see what would be faster (`for` vs `while` loops mostly,
etc). Made some cosmetic, line order changes. Code `version 2108/04/05` more
compact, a little more cleaner, with little more clearer comments
This should works. if you have `a, b` Nim expects both to resolve to the same
AnyMatrix and the same T. An example is `a, b: SomeInteger` versus `a:
SomeInteger, b: SomeInteger`
proc op[T:SomeReal](a: AnyMatrix[T], b: AnyMatrix[T]): AnyMatrix[T] = ...
Alternatively you can
mratsim: the problem I'm having is:
Error: type mismatch: got
when using the same as your last snippet. On the other hand splitting the types
in the proc parameters would allow
Matrix[Complex] * Matrix[float]
which we don't want.
The libraries you posted are
Generics are enough:
type
Matrix[T: SomeReal] = object
rows, cols: int
data: seq[T]
Transposed[T: SomeReal] = distinct Matrix[T]
AnyMatrix[T: SomeReal] = Matrix[T] or Transposed[T]
proc op[T:SomeReal](a, b:
The manual mentions "By default, during overload resolution each named type
class will bind to exactly one concrete type. We call such type classes bind
once types." so what I am trying is not possible? Can someone confirm?
mratsim: thanks! I was already using that one, but it requires proc signatures
to look like:
proc op(a: AnyMatrix, b: AnyMatrix): Matrix
could concepts be usefull in this case so I can restrict to only i.e. `a:
AnyMatrix[float] and b: AnyMatrix[float]`?
thanks, indeed examples would help.
here's a start:
echo sug import_all.nim | nimsuggest --hints:off --stdin import_all.nim >
all.txt
followed by fast queries:
grep pattern all.txt
this is already very useful but to support queries like in the OP without
thanks, filed
[https://github.com/nim-lang/Nim/issues/7522](https://github.com/nim-lang/Nim/issues/7522)
Here you go
type
Matrix = object
rows, cols: int
data: seq[float]
Transposed = distinct Matrix
AnyMatrix = Matrix or Transposed
Note that instead of transposed you probably want to use column-major or
row-major (or
I had good experience with Cligen:
[https://github.com/c-blake/cligen](https://github.com/c-blake/cligen)
miran: thanks, but I 'm not reinventing anything I was porting a another lib
to nim.
If you're working with matrices (and don't want to re-invent everything by
yourself), I can recommend using Neo:
[https://github.com/unicredit/neo](https://github.com/unicredit/neo)
Hello, bellow is a zero copy transpose function for matrices. What I was trying
to do is have a concept which satisfies Matrix or Transpose but also checks for
the type, so later I can have a Matrix[T] type. Any help would be appreciated.
type
AnyMatrix = concept m, var
Nimsuggest is documented here:
[https://nim-lang.org/docs/nimsuggest.html](https://nim-lang.org/docs/nimsuggest.html)
Unfortuantely it still lacks examples, PRs are welcome.
`compiler/eval` needs to setup the VM environment properly. A regression.
> on a small project
Yes, and things change for big projects.
check this excellent module,
[https://github.com/yglukhov/android](https://github.com/yglukhov/android)
@amalek @cblake > if you want to speed up compile times you can use tcc
unfortunately tcc doesn't work on OSX, see
[https://github.com/wheineman/nrpl/issues/16](https://github.com/wheineman/nrpl/issues/16)
besides, this would come at a cost of runtime performance (but would still be
good for
[https://nim-lang.org/docs/nimc.html#additional-compilation-switches](https://nim-lang.org/docs/nimc.html#additional-compilation-switches)
I am thinking about bisecting it now that I have a simple test. Also now I have
a Dockerfile to bootstrap any commit
FROM alpine
RUN apk add --no-cache g++ curl tar git
RUN git clone https://github.com/nim-lang/Nim.git;
RUN cd Nim; \
git clone --depth 1
> Enum are mutually exclusive but you can create predefined sets from the enums.
using this?
[https://nim-lang.org/docs/manual.html#types-set-type](https://nim-lang.org/docs/manual.html#types-set-type)
is there any code using it for defined(...) ?
> Regarding compile-time defines, my main
22 matches
Mail list logo