Skip to content

Commit

Permalink
refactor(sparse): update imports, use new Fn types
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Sep 5, 2020
1 parent 174de7a commit b4a5341
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/sparse/src/coo.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { partition } from "@thi.ng/transducers";
import { ASparseMatrix } from "./amatrix";
import type { NzEntry } from "./api";
import { CSC } from "./csc";
import { CSR } from "./csr";
import type { NzEntry } from "./api";

export class COO extends ASparseMatrix {
static fromDense(m: number, n: number, data: ArrayLike<number>) {
Expand Down
2 changes: 1 addition & 1 deletion packages/sparse/src/csc.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { assert } from "@thi.ng/api";
import { ASparseMatrix } from "./amatrix";
import { at, compress, diag, setAt } from "./compressed";
import type { NzEntry } from "./api";
import { at, compress, diag, setAt } from "./compressed";

export class CSC extends ASparseMatrix {
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/sparse/src/csr.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { assert } from "@thi.ng/api";
import { ASparseMatrix } from "./amatrix";
import { at, compress, diag, remove, setAt } from "./compressed";
import type { NzEntry } from "./api";
import { at, compress, diag, remove, setAt } from "./compressed";

export class CSR extends ASparseMatrix {
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/sparse/src/diag.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { assert } from "@thi.ng/api";
import { ASparseMatrix } from "./amatrix";
import type { NzEntry } from "./api";
import { CSC } from "./csc";
import { CSR } from "./csr";
import { SparseVec } from "./vec";
import type { NzEntry } from "./api";

export class Diag extends ASparseMatrix {
static identity(m: number) {
Expand Down
1 change: 1 addition & 0 deletions packages/sparse/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export * from "./api";

export * from "./amatrix";
export * from "./compressed";
export * from "./coo";
export * from "./csc";
export * from "./csr";
Expand Down
12 changes: 6 additions & 6 deletions packages/sparse/src/vec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { assert } from "@thi.ng/api";
import { assert, FnN2 } from "@thi.ng/api";
import type { NzEntry } from "./api";

export type BinOp = (a: number, b: number) => number;
export type BinOp = FnN2;

const ADD = (a: number, b: number) => a + b;
const SUB = (a: number, b: number) => a - b;
const MUL = (a: number, b: number) => a * b;
const DIV = (a: number, b: number) => a / b;
const ADD: BinOp = (a, b) => a + b;
const SUB: BinOp = (a, b) => a - b;
const MUL: BinOp = (a, b) => a * b;
const DIV: BinOp = (a, b) => a / b;

export class SparseVec {
static fromDense(dense: ArrayLike<number>) {
Expand Down

0 comments on commit b4a5341

Please sign in to comment.