flower-1.0.2
[lilypond.git] / vector.cc
blobbe2423250d9a2bf9592f4d3b2951475b42682624
1 #include "debug.hh"
2 #include "vector.hh"
3 #include "string.hh"
5 Vector::Vector(const Vector&n)
6 :dat(n.dat)
7 // this makes GCC 272 barf
9 //dat = n.dat;
12 Vector::operator String() const
14 int i=0;
15 String s("vector [");
16 for (; i < dim(); i++) {
17 s += String(dat[i], "%6f") + ' ';
19 s+="]";
20 return s;
24 void
25 Vector::print() const
27 mtor << *this<<'\n';
30 Vector
31 Vector::operator-() const
33 Vector v(*this); v*=-1; return v;
36 void
37 Vector::set_unit(int j)
39 fill(0.0);
40 dat[j] = 1.0;