Skip to content

Commit 1053191

Browse files
committed
Scaffolding xan matrix adj
1 parent fa79b5c commit 1053191

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

src/cmd/matrix.rs

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,19 @@ static USAGE: &str = "
88
Convert CSV data to matrix data.
99
1010
Supported modes:
11-
corr: convert a selection of columns into a full
12-
correlation matrix.
11+
adj - convert a pair of columns into a full adjacency
12+
matrix.
13+
corr - convert a selection of columns into a full
14+
correlation matrix.
1315
1416
Usage:
17+
xan matrix adj [options] <source> <target> [<input>]
1518
xan matrix corr [options] [<input>]
1619
xan matrix --help
1720
21+
matrix adj options:
22+
-w, --weight <column> Optional column containing a weight for edges.
23+
1824
matrix corr options:
1925
-s, --select <columns> Columns to consider for the correlation
2026
matrix.
@@ -32,6 +38,11 @@ Common options:
3238
#[derive(Deserialize, Debug)]
3339
struct Args {
3440
arg_input: Option<String>,
41+
arg_source: Option<SelectedColumns>,
42+
arg_target: Option<SelectedColumns>,
43+
cmd_adj: bool,
44+
cmd_corr: bool,
45+
flag_weight: Option<SelectedColumns>,
3546
flag_select: SelectedColumns,
3647
flag_fill_diagonal: bool,
3748
flag_no_headers: bool,
@@ -40,7 +51,11 @@ struct Args {
4051
}
4152

4253
impl Args {
43-
fn correlation(&self) -> CliResult<()> {
54+
fn adjacency(self) -> CliResult<()> {
55+
todo!()
56+
}
57+
58+
fn correlation(self) -> CliResult<()> {
4459
let rconf = Config::new(&self.arg_input)
4560
.delimiter(self.flag_delimiter)
4661
.no_headers(self.flag_no_headers)
@@ -155,5 +170,11 @@ impl Args {
155170
pub fn run(argv: &[&str]) -> CliResult<()> {
156171
let args: Args = util::get_args(USAGE, argv)?;
157172

158-
args.correlation()
173+
if args.cmd_adj {
174+
args.adjacency()
175+
} else if args.cmd_corr {
176+
args.correlation()
177+
} else {
178+
unreachable!()
179+
}
159180
}

0 commit comments

Comments
 (0)