Skip to content

Commit

Permalink
further renaming of core packages
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoreilly committed Apr 14, 2024
1 parent 93bde93 commit 675eb2b
Show file tree
Hide file tree
Showing 27 changed files with 259 additions and 259 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ The following all work together to provide a convenient layer of abstraction for

* [esg](esg) is the *emergent stochastic / sentence generator* -- parses simple grammars that generate random events (sentences) -- can be a good starting point for generating more complex environments.

* [evec](evec) has `Vec2i` which uses plain `int` X, Y fields, whereas the `math32` package uses `int32` which are needed for graphics but int is more convenient in models.
* [evec](evec) has `Vector2i` which uses plain `int` X, Y fields, whereas the `math32` package uses `int32` which are needed for graphics but int is more convenient in models.

* [popcode](popcode) supports the encoding and decoding of population codes -- distributed representations of numeric quantities across a population of neurons. This is the `ScalarVal` functionality from C++ emergent, but now completely independent of any specific algorithm so it can be used anywhere.

Expand Down
6 changes: 3 additions & 3 deletions econfig/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Docs: [GoDoc](https://pkg.go.dev/github.com/emer/emergent/econfig)
The [Cogent Core](https://cogentcore.org/core) GUI processes `default:"value"` struct tags to highlight values that are not at their defaults. econfig uses these same tags to auto-initialize fields as well, ensuring that the tag and the actual initial value are the same. The value for strings or numbers is just the string representation. For more complex types, here ar some examples:

* `struct`: specify using standard Go literal expression as a string, with single-quotes `'` used instead of double-quotes around strings, such as the name of the fields:
+ `evec.Vec2i`: `default:"{'X':10,'Y':10}"`
+ `evec.Vector2i`: `default:"{'X':10,'Y':10}"`

* `slice`: comma-separated list of values in square braces -- use `'` for internal string boundaries:
+ `[]float32`: `default:"[1, 2.14, 3.14]"`
Expand All @@ -80,10 +80,10 @@ type ParamConfig struct {
Network map[string]any

// size of hidden layer -- can use emer.LaySize for 4D layers
Hidden1Size evec.Vec2i `default:"{'X':10,'Y':10}" nest:"+"`
Hidden1Size evec.Vector2i `default:"{'X':10,'Y':10}" nest:"+"`

// size of hidden layer -- can use emer.LaySize for 4D layers
Hidden2Size evec.Vec2i `default:"{'X':10,'Y':10}" nest:"+"`
Hidden2Size evec.Vector2i `default:"{'X':10,'Y':10}" nest:"+"`

// Extra Param Sheet name(s) to use (space separated if multiple) -- must be valid name as listed in compiled-in params or loaded params
Sheet string
Expand Down
8 changes: 4 additions & 4 deletions econfig/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func ParseArg(s string, args []string, allArgs map[string]reflect.Value, errNotF
return
}

isbool := reflectx.NonPtrValue(fval).Kind() == reflect.Bool
isbool := reflectx.NonPointerValue(fval).Kind() == reflect.Bool

var value string
switch {
Expand Down Expand Up @@ -134,7 +134,7 @@ func ParseArg(s string, args []string, allArgs map[string]reflect.Value, errNotF

// SetArgValue sets given arg name to given value, into settable reflect.Value
func SetArgValue(name string, fval reflect.Value, value string) error {
nptyp := reflectx.NonPtrType(fval.Type())
nptyp := reflectx.NonPointerType(fval.Type())
vk := nptyp.Kind()
switch {
// todo: enum
Expand Down Expand Up @@ -209,12 +209,12 @@ func fieldArgNamesStruct(obj any, path string, nest bool, allArgs map[string]ref
if ov.Kind() == reflect.Pointer && ov.IsNil() {
return
}
val := reflectx.NonPtrValue(ov)
val := reflectx.NonPointerValue(ov)
typ := val.Type()
for i := 0; i < typ.NumField(); i++ {
f := typ.Field(i)
fv := val.Field(i)
if reflectx.NonPtrType(f.Type).Kind() == reflect.Struct {
if reflectx.NonPointerType(f.Type).Kind() == reflect.Struct {
nwPath := f.Name
if path != "" {
nwPath = path + "." + nwPath
Expand Down
4 changes: 2 additions & 2 deletions econfig/include.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type Includer interface {
// Returns an error if any of the include files cannot be found on IncludePath.
// Does not alter cfg.
func IncludesStack(cfg Includeser) ([]string, error) {
clone := reflect.New(reflectx.NonPtrType(reflect.TypeOf(cfg))).Interface().(Includeser)
clone := reflect.New(reflectx.NonPointerType(reflect.TypeOf(cfg))).Interface().(Includeser)
*clone.IncludesPtr() = *cfg.IncludesPtr()
return includesStackImpl(clone, nil)
}
Expand Down Expand Up @@ -73,7 +73,7 @@ func includesStackImpl(clone Includeser, includes []string) ([]string, error) {
// Returns an error if any of the include files cannot be found on IncludePath.
// Does not alter cfg.
func IncludeStack(cfg Includer) ([]string, error) {
clone := reflect.New(reflectx.NonPtrType(reflect.TypeOf(cfg))).Interface().(Includer)
clone := reflect.New(reflectx.NonPointerType(reflect.TypeOf(cfg))).Interface().(Includer)
*clone.IncludePtr() = *cfg.IncludePtr()
return includeStackImpl(clone, nil)
}
Expand Down
6 changes: 3 additions & 3 deletions econfig/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ func Usage(cfg any) string {

// usageStruct adds usage info to given strings.Builder
func usageStruct(obj any, path string, b *strings.Builder) {
typ := reflectx.NonPtrType(reflect.TypeOf(obj))
val := reflectx.NonPtrValue(reflect.ValueOf(obj))
typ := reflectx.NonPointerType(reflect.TypeOf(obj))
val := reflectx.NonPointerValue(reflect.ValueOf(obj))
for i := 0; i < typ.NumField(); i++ {
f := typ.Field(i)
fv := val.Field(i)
if reflectx.NonPtrType(f.Type).Kind() == reflect.Struct {
if reflectx.NonPointerType(f.Type).Kind() == reflect.Struct {
nwPath := f.Name
if path != "" {
nwPath = path + "." + nwPath
Expand Down
2 changes: 1 addition & 1 deletion efuns/gauss.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
// GaussVecDistNoNorm returns the gaussian of the distance between two 2D vectors
// using given sigma standard deviation, without normalizing area under gaussian
// (i.e., max value is 1 at dist = 0)
func GaussVecDistNoNorm(a, b math32.Vec2, sigma float32) float32 {
func GaussVecDistNoNorm(a, b math32.Vector2, sigma float32) float32 {
dsq := a.DistToSquared(b)
return math32.FastExp((-0.5 * dsq) / (sigma * sigma))
}
Expand Down
2 changes: 1 addition & 1 deletion egui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func (ss *Sim) ConfigGUI() *core.Window {

// optionally reconfigure the netview:
ss.GUI.NetView.Scene().Camera.Pose.Pos.Set(0, 1, 2.75)
ss.GUI.NetView.Scene().Camera.LookAt(math32.V3(0, 0, 0), math32.V3(0, 1, 0))
ss.GUI.NetView.Scene().Camera.LookAt(math32.Vec3(0, 0, 0), math32.Vec3(0, 1, 0))
ss.GUI.AddPlots(title, &ss.Logs) // automatically adds all configured plots
```
Expand Down
6 changes: 3 additions & 3 deletions emer/layer.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,16 @@ type Layer interface {
// where the vertical dimension is Y and Z is the depth dimension. However, in the
// more "layer-centric" way of thinking about it, it is natural for the width & height
// to map onto X and Y, and then Z is left over for stacking vertically.
Pos() math32.Vec3
Pos() math32.Vector3

// SetPos sets the 3D position of this layer -- will generally be overwritten by
// automatic RelPos setting, unless that doesn't specify a valid relative position.
SetPos(pos math32.Vec3)
SetPos(pos math32.Vector3)

// Size returns the display size of this layer for the 3D view -- see Pos() for general info.
// This is multiplied by the RelPos.Scale factor to rescale layer sizes, and takes
// into account 2D and 4D layer structures.
Size() math32.Vec2
Size() math32.Vector2

// Index returns a 0..n-1 index of the position of the layer within list of layers
// in the network. For backprop networks, index position has computational significance.
Expand Down
2 changes: 1 addition & 1 deletion emer/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ type Network interface {
OpenWtsJSON(filename core.Filename) error

// Bounds returns the minimum and maximum display coordinates of the network for 3D display
Bounds() (min, max math32.Vec3)
Bounds() (min, max math32.Vector3)

// VarRange returns the min / max values for given variable
VarRange(varNm string) (min, max float32, err error)
Expand Down
2 changes: 1 addition & 1 deletion evec/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Docs: [GoDoc](https://pkg.go.dev/github.com/emer/emergent/evec)

Package `evec` has vector types for emergent, including `Vec2i` which is a 2D vector with int values, using the API based on `math32.Vec2i`. This is distinct from math32.Vec2i because it uses int instead of int32, and the int is significantly easier to deal with for layer sizing params etc.
Package `evec` has vector types for emergent, including `Vector2i` which is a 2D vector with int values, using the API based on `math32.Vector2i`. This is distinct from math32.Vector2i because it uses int instead of int32, and the int is significantly easier to deal with for layer sizing params etc.


2 changes: 1 addition & 1 deletion evec/gtigen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 675eb2b

Please sign in to comment.