File: readvector.m

package info (click to toggle)
combblas 2.0.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 190,476 kB
  • sloc: cpp: 55,912; ansic: 25,134; sh: 3,691; makefile: 548; csh: 66; python: 49; perl: 21
file content (8 lines) | stat: -rw-r--r-- 249 bytes parent folder | download
1
2
3
4
5
6
7
8
function A = readvector(inputname)

[fid message] = fopen(inputname,'r');

% V is a 2-by-nnz(X) matrix of pairs (i.e. each column is a pair)
V = fscanf(fid,'%d\t\t%f\n',[2 inf]);
A = sparse(V(1,2:end),ones(V(2,1),1),V(2,2:end), V(1,1), 1, V(2,1));