Menu

#69 Allow setting of slices with let

open
None
5
2020-01-29
2019-12-17
Jim Monte
No

From the 31 User's Manual:
18.17.5.37 Let: Assign a value to a vector
General Form:
let name = expr
...
The command let creates a vector in the current plot. Use setplot (17.5.66) to create a new plot.
There is no straightforward way to initialize a new vector. In general, one might want to have
let initialize a slice (i.e. name[4:4,21:23] = [ 1 2 3 ]) ...

While initialization with a slice would be difficult since the extent needs to be defined when the vector is created, it should be possible to set a slice using a vector having the appropriate length, so things like
let v1[2:4,5:7] = a1 or let v1[2:4][5:7] = a1 should be permitted, assuming a1 has the right properties.

Discussion

  • Jim Monte

    Jim Monte - 2019-12-18

    This feature will be added as part of the fix for bug #443.

    The allowed forms are expressions like

    let name1 = value 
    let name2[1, a-5: a+10, 100, 20:40] = b
    let name3[a:b][c:d+e] = z
    

    That is, the indices can be an ngspice expression or a pair separated by a colon, in which case it defines a range. The index values must expand to real scalars, and the source data must have the correct number of elements, although dimension sizes for the source are not considered. That is, both a 2 X 2 vector and a 4-element vector of 1 dimension will provide 4 elements.

     
  • Jim Monte

    Jim Monte - 2020-01-29

    A minor fix to this feature is in commit e32991ae7aea4e3b63f2a72780c82c08f844b71d in branch beta_jdm

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.