vlang / vtl

The V Tensor Library
https://vlang.github.io/vtl
MIT License
148 stars 21 forks source link

Fix VTL Stack #18

Closed ulises-jeremias closed 2 years ago

ulises-jeremias commented 2 years ago

There are some commented tests in this file. We need to fix the implementation of each related function

ulises-jeremias commented 2 years ago

@cmnemoi hey! I saw you are contributing on VTL! probably this one can be challenging! Let me know if you want to take a look and you need any help on it!

cmnemoi commented 2 years ago

Hey @ulises-jeremias, I will take a look.

cmnemoi commented 2 years ago

Given my first investigations, I think there is a bug in vtl.assignment.assign() (which is untested) :

module main

import vtl

fn main()
{

    test_tensor := vtl.from_array([1,2,3,4,5,6,7,8], [2, 4])
    zeros := vtl.zeros<int>([2,2])

    mut slice := test_tensor.slice_hilo([0,0], [2,2])

    println("slice to replace = \n$slice")
    /*
        slice_to_repalce =
        &[[1, 2], 
        [5, 6]]
    */
    println("replacement = \n$zeros")
    /*  
        zeros = 
        &[[0, 0], 
        [0, 0]]
    */

    slice.assign(zeros)

    println("new slice = \n$slice  \n(should be \n$zeros)")
    /*

        new slice = 
        &[[0, 0], 
        [5, 6]]  

        (should be 
        &[[0, 0], 
        [0, 0]])
    */

        assert zeros.equal(slice)

}

Weird given assert zeros.equal(slice) passes (?)

I will investigate further