Skip to content

Error ordinal type when echo Matrix #13

@mratsim

Description

@mratsim

This might be related to nim-lang/Nim#5199

Setup: Nim v0.16, linalg 0.6.6 on OSX

import linalg

## Training
let data = matrix([
                [1.2, 0.7],
                [-0.3, -0.5],
                [3.0, 0.1],
                [-0.1, -1.0],
                [-1.0, 1.1],
                [2.1, -3]
                ])
#echo data

Without echo data the code compiles

$  nim c -d:release -o:bin/karpathy4 --nimcache:nimcache playground/karpathy_tuto4.nim
Hint: used config file '/usr/local/Cellar/nim/0.16.0/nim/config/nim.cfg' [Conf]
Hint: system [Processing]
Hint: karpathy_tuto4 [Processing]
Hint: linalg [Processing]
Hint: math [Processing]
Hint: sequtils [Processing]
Hint: nimblas [Processing]
--USING DEFAULT BLAS--
Hint: random [Processing]
Hint: times [Processing]
Hint: strutils [Processing]
Hint: parseutils [Processing]
Hint: algorithm [Processing]
Hint: nimlapack [Processing]
karpathy_tuto4.nim(4, 18) template/generic instantiation from here
/Users/user/.nimble/pkgs/linalg-0.6.6/linalg/private/initialize.nim(295, 13) template/generic instantiation from here
/Users/user/.nimble/pkgs/linalg-0.6.6/linalg/private/initialize.nim(166, 46) template/generic instantiation from here
/Users/user/.nimble/pkgs/linalg-0.6.6/linalg/private/initialize.nim(160, 38) Warning: Cannot prove that 'result' is initialized. This will bec
ome a compile time error in the future. [ProveInit]
karpathy_tuto4.nim(4, 5) Warning: Cannot prove that 'data' is initialized. This will become a compile time error in the future. [ProveInit]
karpathy_tuto4.nim(4, 5) Hint: 'data' is declared but not used [XDeclaredButNotUsed]
Hint:  [Link]
Hint: operation successful (19026 lines compiled; 0.742 sec total; 27.949MiB; Release Build) [SuccessX]

If I add echo I get Error: ordinal type expected

$  nim c -d:release -o:bin/karpathy4 --nimcache:nimcache playground/karpathy_tuto4.nim
Hint: used config file '/usr/local/Cellar/nim/0.16.0/nim/config/nim.cfg' [Conf]
Hint: system [Processing]
Hint: karpathy_tuto4 [Processing]
Hint: linalg [Processing]
Hint: math [Processing]
Hint: sequtils [Processing]
Hint: nimblas [Processing]
--USING DEFAULT BLAS--
Hint: random [Processing]
Hint: times [Processing]
Hint: strutils [Processing]
Hint: parseutils [Processing]
Hint: algorithm [Processing]
Hint: nimlapack [Processing]
karpathy_tuto4.nim(4, 18) template/generic instantiation from here
/Users/user/.nimble/pkgs/linalg-0.6.6/linalg/private/initialize.nim(295, 13) template/generic instantiation from here
/Users/user/.nimble/pkgs/linalg-0.6.6/linalg/private/initialize.nim(166, 46) template/generic instantiation from here
/Users/user/.nimble/pkgs/linalg-0.6.6/linalg/private/initialize.nim(160, 38) Warning: Cannot prove that 'result' is initialized. This will bec
ome a compile time error in the future. [ProveInit]
karpathy_tuto4.nim(4, 5) Warning: Cannot prove that 'data' is initialized. This will become a compile time error in the future. [ProveInit]
karpathy_tuto4.nim(14, 6) template/generic instantiation from here
/Users/user/.nimble/pkgs/linalg-0.6.6/linalg/private/display.nim(42, 35) template/generic instantiation from here
/Users/user/.nimble/pkgs/linalg-0.6.6/linalg/private/access.nim(136, 18) template/generic instantiation from here
/Users/user/.nimble/pkgs/linalg-0.6.6/linalg/private/access.nim(50, 96) Error: ordinal type expected

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions