~/bend-docscommunity

io.bend relies on unsafe/foreign

raw source on the hub · import bend-quant-risk@0.1.0.0/io.bend as Io

File IO helpers for risk. Kept apart from risk.bend so PROOF.bend imports no effects and zero @unsafe.

Public: Returns.load, LoadingsSeries.load.

3 imports
import Base
import bend-quant-linalg@0.1.0.0/linalg.bend as L
import bend-quant-linalg@0.1.0.0/io.bend as LI

Definitions

def Returns.load source · line 10 · raw

@path:String -> @+t:U32 -> @+n:U32 -> IO(Result<&1, &1, Pair(U32, String), 0xa0e1b674ac5289412017a9dd17825c31/linalg.Mat>)

Loads a T x N return panel from a row-major little-endian float32 file.

def drop_rows source · line 14 · raw

@rem:Nat -> @rows:List<&2, List<&2, F32>> -> List<&2, List<&2, F32>>

Non-mutual chunking: split rows into rem matrices of shape n x k.

def take_rows source · line 23 · raw

@rem:Nat -> @rows:List<&2, List<&2, F32>> -> List<&2, List<&2, F32>>

def chunk_mats source · line 32 · raw

@rem:Nat -> @+rows:List<&2, List<&2, F32>> -> @+n:U32 -> @+nn:Nat -> @+k:U32 -> List<&2, 0xa0e1b674ac5289412017a9dd17825c31/linalg.Mat>

def load_series.wrap source · line 39 · raw

@rm:Result<&1, &1, Pair(U32, String), 0xa0e1b674ac5289412017a9dd17825c31/linalg.Mat> -> @+t:U32 -> @+n:U32 -> @+k:U32 -> Result<&1, &1, Pair(U32, String), List<&2, 0xa0e1b674ac5289412017a9dd17825c31/linalg.Mat>>

def LoadingsSeries.load source · line 48 · raw

@path:String -> @+t:U32 -> @+n:U32 -> @+k:U32 -> IO(Result<&1, &1, Pair(U32, String), List<&2, 0xa0e1b674ac5289412017a9dd17825c31/linalg.Mat>>)

Loads T loadings matrices B_0..B_{T-1} (each N x K) from a contiguous row-major float32 file of shape (T, N, K) (T * N * K floats).