utils

package
v1.1.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DenseToMatrix

func DenseToMatrix(d *mat.Dense) types.Matrix

DenseToMatrix converts a gonum Dense matrix to types.Matrix

func FilterMatrix

func FilterMatrix(data [][]float64, excludedRows, excludedColumns []int) ([][]float64, error)

FilterMatrix removes specified rows and columns from a matrix

func FilterStringSlice

func FilterStringSlice(items []string, excludedIndices []int) ([]string, error)

FilterStringSlice removes elements at specified indices from a string slice

func MatrixToDense

func MatrixToDense(m types.Matrix) *mat.Dense

MatrixToDense converts a types.Matrix to a gonum Dense matrix

func MatrixToSlice added in v1.1.0

func MatrixToSlice(m *mat.Dense) [][]float64

MatrixToSlice converts a gonum Dense matrix to [][]float64

func MinInt added in v1.1.0

func MinInt(a, b int) int

MinInt returns the minimum of two integers

func ParseRanges

func ParseRanges(input string) ([]int, error)

ParseRanges parses a comma-separated string of indices and ranges into a slice of integers. Examples:

  • "1,3,5" returns [1, 3, 5]
  • "1-3,5" returns [1, 2, 3, 5]
  • "1,3-5,7" returns [1, 3, 4, 5, 7]

Note: Input indices are 1-based (human-friendly), output indices are 0-based

func SliceToMatrix added in v1.1.0

func SliceToMatrix(data [][]float64) *mat.Dense

SliceToMatrix converts a [][]float64 to a gonum Dense matrix

func ValidateFilePath

func ValidateFilePath(path string) error

ValidateFilePath checks if a file path is safe to use It prevents directory traversal attacks and ensures the path is clean This function now delegates to the enhanced security module

func ValidateOutputPath

func ValidateOutputPath(path string) error

ValidateOutputPath ensures an output path is safe to write to This function now delegates to the enhanced security module which includes comprehensive checks for system directories, path traversal, and write permissions

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL