View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.commons.math.linear;
18  
19  /**
20   * Interface defining a real-valued vector with basic algebraic operations.
21   * <p>
22   * vector element indexing is 0-based -- e.g., <code>getEntry(0)</code>
23   * returns the first element of the vector.
24   * </p>
25   * <p>
26   * The various <code>mapXxx</code> and <code>mapXxxToSelf</code> methods operate
27   * on vectors element-wise, i.e. they perform the same operation (adding a scalar,
28   * applying a function ...) on each element in turn. The <code>mapXxx</code>
29   * versions create a new vector to hold the result and do not change the instance.
30   * The <code>mapXxxToSelf</code> versions use the instance itself to store the
31   * results, so the instance is changed by these methods. In both cases, the result
32   * vector is returned by the methods, this allows to use the <i>fluent API</i>
33   * style, like this:
34   * </p>
35   * <pre>
36   *   RealVector result = v.mapAddToSelf(3.0).mapTanToSelf().mapSquareToSelf();
37   * </pre>
38   * 
39   * @version $Revision: 778058 $ $Date: 2009-05-23 18:57:26 -0400 (Sat, 23 May 2009) $
40   * @since 2.0
41   */
42  public interface RealVector {
43  
44      /**
45       * Returns a (deep) copy of this.
46       * @return vector copy
47       */
48      RealVector copy();
49  
50      /**
51       * Compute the sum of this and v.
52       * @param v vector to be added
53       * @return this + v
54       * @throws IllegalArgumentException if v is not the same size as this
55       */
56      RealVector add(RealVector v)
57          throws IllegalArgumentException;
58  
59      /**
60       * Compute the sum of this and v.
61       * @param v vector to be added
62       * @return this + v
63       * @throws IllegalArgumentException if v is not the same size as this
64       */
65      RealVector add(double[] v)
66          throws IllegalArgumentException;
67  
68      /**
69       * Compute this minus v.
70       * @param v vector to be subtracted
71       * @return this + v
72       * @throws IllegalArgumentException if v is not the same size as this
73       */
74      RealVector subtract(RealVector v)
75          throws IllegalArgumentException;
76  
77      /**
78       * Compute this minus v.
79       * @param v vector to be subtracted
80       * @return this + v
81       * @throws IllegalArgumentException if v is not the same size as this
82       */
83      RealVector subtract(double[] v)
84          throws IllegalArgumentException;
85  
86      /**
87       * Map an addition operation to each entry.
88       * @param d value to be added to each entry
89       * @return this + d
90       */
91      RealVector mapAdd(double d);
92  
93      /**
94       * Map an addition operation to each entry.
95       * <p>The instance <strong>is</strong> changed by this method.</p>
96       * @param d value to be added to each entry
97       * @return for convenience, return this
98       */
99      RealVector mapAddToSelf(double d);
100 
101     /**
102      * Map a subtraction operation to each entry.
103      * @param d value to be subtracted to each entry
104      * @return this - d
105      */
106     RealVector mapSubtract(double d);
107 
108     /**
109      * Map a subtraction operation to each entry.
110      * <p>The instance <strong>is</strong> changed by this method.</p>
111      * @param d value to be subtracted to each entry
112      * @return for convenience, return this
113      */
114     RealVector mapSubtractToSelf(double d);
115 
116     /**
117      * Map a multiplication operation to each entry.
118      * @param d value to multiply all entries by
119      * @return this * d
120      */
121     RealVector mapMultiply(double d);
122 
123     /**
124      * Map a multiplication operation to each entry.
125      * <p>The instance <strong>is</strong> changed by this method.</p>
126      * @param d value to multiply all entries by
127      * @return for convenience, return this
128      */
129     RealVector mapMultiplyToSelf(double d);
130 
131     /**
132      * Map a division operation to each entry.
133      * @param d value to divide all entries by
134      * @return this / d
135      */
136     RealVector mapDivide(double d);
137 
138     /**
139      * Map a division operation to each entry.
140      * <p>The instance <strong>is</strong> changed by this method.</p>
141      * @param d value to divide all entries by
142      * @return for convenience, return this
143      */
144     RealVector mapDivideToSelf(double d);
145 
146     /**
147      * Map a power operation to each entry.
148      * @param d value to raise all entries to
149      * @return this ^ d
150      */
151     RealVector mapPow(double d);
152 
153     /**
154      * Map a power operation to each entry.
155      * <p>The instance <strong>is</strong> changed by this method.</p>
156      * @param d value to raise all entries to
157      * @return for convenience, return this
158      */
159     RealVector mapPowToSelf(double d);
160 
161     /**
162      * Map the {@link Math#exp(double)} function to each entry.
163      * @return a vector containing the result of applying the function to each entry
164      */
165     RealVector mapExp();
166 
167     /**
168      * Map the {@link Math#exp(double)} function to each entry.
169      * <p>The instance <strong>is</strong> changed by this method.</p>
170      * @return for convenience, return this
171      */
172     RealVector mapExpToSelf();
173 
174     /**
175      * Map the {@link Math#expm1(double)} function to each entry.
176      * @return a vector containing the result of applying the function to each entry
177      */
178     RealVector mapExpm1();
179 
180     /**
181      * Map the {@link Math#expm1(double)} function to each entry.
182      * <p>The instance <strong>is</strong> changed by this method.</p>
183      * @return for convenience, return this
184      */
185     RealVector mapExpm1ToSelf();
186 
187     /**
188      * Map the {@link Math#log(double)} function to each entry.
189      * @return a vector containing the result of applying the function to each entry
190      */
191     RealVector mapLog();
192 
193     /**
194      * Map the {@link Math#log(double)} function to each entry.
195      * <p>The instance <strong>is</strong> changed by this method.</p>
196      * @return for convenience, return this
197      */
198     RealVector mapLogToSelf();
199 
200     /**
201      * Map the {@link Math#log10(double)} function to each entry.
202      * @return a vector containing the result of applying the function to each entry
203      */
204     RealVector mapLog10();
205 
206     /**
207      * Map the {@link Math#log10(double)} function to each entry.
208      * <p>The instance <strong>is</strong> changed by this method.</p>
209      * @return for convenience, return this
210      */
211     RealVector mapLog10ToSelf();
212 
213     /**
214      * Map the {@link Math#log1p(double)} function to each entry.
215      * @return a vector containing the result of applying the function to each entry
216      */
217     RealVector mapLog1p();
218 
219     /**
220      * Map the {@link Math#log1p(double)} function to each entry.
221      * <p>The instance <strong>is</strong> changed by this method.</p>
222      * @return for convenience, return this
223      */
224     RealVector mapLog1pToSelf();
225 
226     /**
227      * Map the {@link Math#cosh(double)} function to each entry.
228      * @return a vector containing the result of applying the function to each entry
229      */
230     RealVector mapCosh();
231 
232     /**
233      * Map the {@link Math#cosh(double)} function to each entry.
234      * <p>The instance <strong>is</strong> changed by this method.</p>
235      * @return for convenience, return this
236      */
237     RealVector mapCoshToSelf();
238 
239     /**
240      * Map the {@link Math#sinh(double)} function to each entry.
241      * @return a vector containing the result of applying the function to each entry
242      */
243     RealVector mapSinh();
244 
245     /**
246      * Map the {@link Math#sinh(double)} function to each entry.
247      * <p>The instance <strong>is</strong> changed by this method.</p>
248      * @return for convenience, return this
249      */
250     RealVector mapSinhToSelf();
251 
252     /**
253      * Map the {@link Math#tanh(double)} function to each entry.
254      * @return a vector containing the result of applying the function to each entry
255      */
256     RealVector mapTanh();
257 
258     /**
259      * Map the {@link Math#tanh(double)} function to each entry.
260      * <p>The instance <strong>is</strong> changed by this method.</p>
261      * @return for convenience, return this
262      */
263     RealVector mapTanhToSelf();
264 
265     /**
266      * Map the {@link Math#cos(double)} function to each entry.
267      * @return a vector containing the result of applying the function to each entry
268      */
269     RealVector mapCos();
270 
271     /**
272      * Map the {@link Math#cos(double)} function to each entry.
273      * <p>The instance <strong>is</strong> changed by this method.</p>
274      * @return for convenience, return this
275      */
276     RealVector mapCosToSelf();
277 
278     /**
279      * Map the {@link Math#sin(double)} function to each entry.
280      * @return a vector containing the result of applying the function to each entry
281      */
282     RealVector mapSin();
283 
284     /**
285      * Map the {@link Math#sin(double)} function to each entry.
286      * <p>The instance <strong>is</strong> changed by this method.</p>
287      * @return for convenience, return this
288      */
289     RealVector mapSinToSelf();
290 
291     /**
292      * Map the {@link Math#tan(double)} function to each entry.
293      * @return a vector containing the result of applying the function to each entry
294      */
295     RealVector mapTan();
296 
297     /**
298      * Map the {@link Math#tan(double)} function to each entry.
299      * <p>The instance <strong>is</strong> changed by this method.</p>
300      * @return for convenience, return this
301      */
302     RealVector mapTanToSelf();
303 
304     /**
305      * Map the {@link Math#acos(double)} function to each entry.
306      * @return a vector containing the result of applying the function to each entry
307      */
308     RealVector mapAcos();
309 
310     /**
311      * Map the {@link Math#acos(double)} function to each entry.
312      * <p>The instance <strong>is</strong> changed by this method.</p>
313      * @return for convenience, return this
314      */
315     RealVector mapAcosToSelf();
316 
317     /**
318      * Map the {@link Math#asin(double)} function to each entry.
319      * @return a vector containing the result of applying the function to each entry
320      */
321     RealVector mapAsin();
322 
323     /**
324      * Map the {@link Math#asin(double)} function to each entry.
325      * <p>The instance <strong>is</strong> changed by this method.</p>
326      * @return for convenience, return this
327      */
328     RealVector mapAsinToSelf();
329 
330     /**
331      * Map the {@link Math#atan(double)} function to each entry.
332      * @return a vector containing the result of applying the function to each entry
333      */
334     RealVector mapAtan();
335 
336     /**
337      * Map the {@link Math#atan(double)} function to each entry.
338      * <p>The instance <strong>is</strong> changed by this method.</p>
339      * @return for convenience, return this
340      */
341     RealVector mapAtanToSelf();
342 
343     /**
344      * Map the 1/x function to each entry.
345      * @return a vector containing the result of applying the function to each entry
346      */
347     RealVector mapInv();
348 
349     /**
350      * Map the 1/x function to each entry.
351      * <p>The instance <strong>is</strong> changed by this method.</p>
352      * @return for convenience, return this
353      */
354     RealVector mapInvToSelf();
355 
356     /**
357      * Map the {@link Math#abs(double)} function to each entry.
358      * @return a vector containing the result of applying the function to each entry
359      */
360     RealVector mapAbs();
361 
362     /**
363      * Map the {@link Math#abs(double)} function to each entry.
364      * <p>The instance <strong>is</strong> changed by this method.</p>
365      * @return for convenience, return this
366      */
367     RealVector mapAbsToSelf();
368 
369     /**
370      * Map the {@link Math#sqrt(double)} function to each entry.
371      * @return a vector containing the result of applying the function to each entry
372      */
373     RealVector mapSqrt();
374 
375     /**
376      * Map the {@link Math#sqrt(double)} function to each entry.
377      * <p>The instance <strong>is</strong> changed by this method.</p>
378      * @return for convenience, return this
379      */
380     RealVector mapSqrtToSelf();
381 
382     /**
383      * Map the {@link Math#cbrt(double)} function to each entry.
384      * @return a vector containing the result of applying the function to each entry
385      */
386     RealVector mapCbrt();
387 
388     /**
389      * Map the {@link Math#cbrt(double)} function to each entry.
390      * <p>The instance <strong>is</strong> changed by this method.</p>
391      * @return for convenience, return this
392      */
393     RealVector mapCbrtToSelf();
394 
395     /**
396      * Map the {@link Math#ceil(double)} function to each entry.
397      * @return a vector containing the result of applying the function to each entry
398      */
399     RealVector mapCeil();
400 
401     /**
402      * Map the {@link Math#ceil(double)} function to each entry.
403      * <p>The instance <strong>is</strong> changed by this method.</p>
404      * @return for convenience, return this
405      */
406     RealVector mapCeilToSelf();
407 
408     /**
409      * Map the {@link Math#floor(double)} function to each entry.
410      * @return a vector containing the result of applying the function to each entry
411      */
412     RealVector mapFloor();
413 
414     /**
415      * Map the {@link Math#floor(double)} function to each entry.
416      * <p>The instance <strong>is</strong> changed by this method.</p>
417      * @return for convenience, return this
418      */
419     RealVector mapFloorToSelf();
420 
421     /**
422      * Map the {@link Math#rint(double)} function to each entry.
423      * @return a vector containing the result of applying the function to each entry
424      */
425     RealVector mapRint();
426 
427     /**
428      * Map the {@link Math#rint(double)} function to each entry.
429      * <p>The instance <strong>is</strong> changed by this method.</p>
430      * @return for convenience, return this
431      */
432     RealVector mapRintToSelf();
433 
434     /**
435      * Map the {@link Math#signum(double)} function to each entry.
436      * @return a vector containing the result of applying the function to each entry
437      */
438     RealVector mapSignum();
439 
440     /**
441      * Map the {@link Math#signum(double)} function to each entry.
442      * <p>The instance <strong>is</strong> changed by this method.</p>
443      * @return for convenience, return this
444      */
445     RealVector mapSignumToSelf();
446 
447     /**
448      * Map the {@link Math#ulp(double)} function to each entry.
449      * @return a vector containing the result of applying the function to each entry
450      */
451     RealVector mapUlp();
452 
453     /**
454      * Map the {@link Math#ulp(double)} function to each entry.
455      * <p>The instance <strong>is</strong> changed by this method.</p>
456      * @return for convenience, return this
457      */
458     RealVector mapUlpToSelf();
459 
460     /**
461      * Element-by-element multiplication.
462      * @param v vector by which instance elements must be multiplied
463      * @return a vector containing this[i] * v[i] for all i
464      * @throws IllegalArgumentException if v is not the same size as this
465      */
466     public RealVector ebeMultiply(RealVector v)
467         throws IllegalArgumentException;
468 
469     /**
470      * Element-by-element multiplication.
471      * @param v vector by which instance elements must be multiplied
472      * @return a vector containing this[i] * v[i] for all i
473      * @throws IllegalArgumentException if v is not the same size as this
474      */
475     public RealVector ebeMultiply(double[] v)
476         throws IllegalArgumentException;
477 
478     /**
479      * Element-by-element division.
480      * @param v vector by which instance elements must be divided
481      * @return a vector containing this[i] / v[i] for all i
482      * @throws IllegalArgumentException if v is not the same size as this
483      */
484     public RealVector ebeDivide(RealVector v)
485         throws IllegalArgumentException;
486 
487     /**
488      * Element-by-element division.
489      * @param v vector by which instance elements must be divided
490      * @return a vector containing this[i] / v[i] for all i
491      * @throws IllegalArgumentException if v is not the same size as this
492      */
493     public RealVector ebeDivide(double[] v)
494         throws IllegalArgumentException;
495 
496     /**
497      * Returns vector entries as a double array.
498      * @return double array of entries
499      */
500      double[] getData();
501 
502     /**
503      * Compute the dot product.
504      * @param v vector with which dot product should be computed
505      * @return the scalar dot product between instance and v
506      * @exception IllegalArgumentException if v is not the same size as this
507      */
508     double dotProduct(RealVector v)
509         throws IllegalArgumentException;
510 
511     /**
512      * Compute the dot product.
513      * @param v vector with which dot product should be computed
514      * @return the scalar dot product between instance and v
515      * @exception IllegalArgumentException if v is not the same size as this
516      */
517     double dotProduct(double[] v)
518         throws IllegalArgumentException;
519 
520     /**
521      * Returns the L<sub>2</sub> norm of the vector.
522      * <p>The L<sub>2</sub> norm is the root of the sum of
523      * the squared elements.</p>
524      * @return norm
525      * @see #getL1Norm()
526      * @see #getLInfNorm()
527      * @see #getDistance(RealVector)
528      */
529     double getNorm();
530 
531     /**
532      * Returns the L<sub>1</sub> norm of the vector.
533      * <p>The L<sub>1</sub> norm is the sum of the absolute
534      * values of elements.</p>
535      * @return norm
536      * @see #getNorm()
537      * @see #getLInfNorm()
538      * @see #getL1Distance(RealVector)
539      */
540     double getL1Norm();
541 
542     /**
543      * Returns the L<sub>&infin;</sub> norm of the vector.
544      * <p>The L<sub>&infin;</sub> norm is the max of the absolute
545      * values of elements.</p>
546      * @return norm
547      * @see #getNorm()
548      * @see #getL1Norm()
549      * @see #getLInfDistance(RealVector)
550      */
551     double getLInfNorm();
552 
553     /**
554      * Distance between two vectors.
555      * <p>This method computes the distance consistent with the
556      * L<sub>2</sub> norm, i.e. the square root of the sum of
557      * elements differences, or euclidian distance.</p>
558      * @param v vector to which distance is requested
559      * @return distance between two vectors.
560      * @exception IllegalArgumentException if v is not the same size as this
561      * @see #getL1Distance(RealVector)
562      * @see #getLInfDistance(RealVector)
563      * @see #getNorm()
564      */
565     double getDistance(RealVector v)
566         throws IllegalArgumentException;
567 
568     /**
569      * Distance between two vectors.
570      * <p>This method computes the distance consistent with the
571      * L<sub>2</sub> norm, i.e. the square root of the sum of
572      * elements differences, or euclidian distance.</p>
573      * @param v vector to which distance is requested
574      * @return distance between two vectors.
575      * @exception IllegalArgumentException if v is not the same size as this
576      * @see #getL1Distance(double[])
577      * @see #getLInfDistance(double[])
578      * @see #getNorm()
579      */
580     double getDistance(double[] v)
581         throws IllegalArgumentException;
582 
583     /**
584      * Distance between two vectors.
585      * <p>This method computes the distance consistent with
586      * L<sub>1</sub> norm, i.e. the sum of the absolute values of
587      * elements differences.</p>
588      * @param v vector to which distance is requested
589      * @return distance between two vectors.
590      * @exception IllegalArgumentException if v is not the same size as this
591      * @see #getDistance(RealVector)
592      * @see #getLInfDistance(RealVector)
593      * @see #getL1Norm()
594      */
595     double getL1Distance(RealVector v)
596         throws IllegalArgumentException;
597 
598     /**
599      * Distance between two vectors.
600      * <p>This method computes the distance consistent with
601      * L<sub>1</sub> norm, i.e. the sum of the absolute values of
602      * elements differences.</p>
603      * @param v vector to which distance is requested
604      * @return distance between two vectors.
605      * @exception IllegalArgumentException if v is not the same size as this
606      * @see #getDistance(double[])
607      * @see #getLInfDistance(double[])
608      * @see #getL1Norm()
609      */
610     double getL1Distance(double[] v)
611         throws IllegalArgumentException;
612 
613     /**
614      * Distance between two vectors.
615      * <p>This method computes the distance consistent with
616      * L<sub>&infin;</sub> norm, i.e. the max of the absolute values of
617      * elements differences.</p>
618      * @param v vector to which distance is requested
619      * @return distance between two vectors.
620      * @exception IllegalArgumentException if v is not the same size as this
621      * @see #getDistance(RealVector)
622      * @see #getL1Distance(RealVector)
623      * @see #getLInfNorm()
624      */
625     double getLInfDistance(RealVector v)
626         throws IllegalArgumentException;
627 
628     /**
629      * Distance between two vectors.
630      * <p>This method computes the distance consistent with
631      * L<sub>&infin;</sub> norm, i.e. the max of the absolute values of
632      * elements differences.</p>
633      * @param v vector to which distance is requested
634      * @return distance between two vectors.
635      * @exception IllegalArgumentException if v is not the same size as this
636      * @see #getDistance(double[])
637      * @see #getL1Distance(double[])
638      * @see #getLInfNorm()
639      */
640     double getLInfDistance(double[] v)
641         throws IllegalArgumentException;
642 
643     /** Creates a unit vector pointing in the direction of this vector.
644      * <p>The instance is not changed by this method.</p>
645      * @return a unit vector pointing in direction of this vector
646      * @exception ArithmeticException if the norm is null
647      */
648     RealVector unitVector();
649 
650     /** Converts this vector into a unit vector.
651      * <p>The instance itself is changed by this method.</p>
652      * @exception ArithmeticException if the norm is null
653      */
654     void unitize();
655 
656     /** Find the orthogonal projection of this vector onto another vector.
657      * @param v vector onto which instance must be projected
658      * @return projection of the instance onto v
659      * @throws IllegalArgumentException if v is not the same size as this
660      */
661     RealVector projection(RealVector v)
662         throws IllegalArgumentException;
663 
664     /** Find the orthogonal projection of this vector onto another vector.
665      * @param v vector onto which instance must be projected
666      * @return projection of the instance onto v
667      * @throws IllegalArgumentException if v is not the same size as this
668      */
669     RealVector projection(double[] v)
670         throws IllegalArgumentException;
671 
672     /**
673      * Compute the outer product.
674      * @param v vector with which outer product should be computed
675      * @return the square matrix outer product between instance and v
676      * @exception IllegalArgumentException if v is not the same size as this
677      */
678     RealMatrix outerProduct(RealVector v)
679         throws IllegalArgumentException;
680 
681     /**
682      * Compute the outer product.
683      * @param v vector with which outer product should be computed
684      * @return the square matrix outer product between instance and v
685      * @exception IllegalArgumentException if v is not the same size as this
686      */
687     RealMatrix outerProduct(double[] v)
688         throws IllegalArgumentException;
689 
690     /**
691      * Returns the entry in the specified index.
692      * <p>
693      * The index start at 0 and must be lesser than the size,
694      * otherwise a {@link MatrixIndexException} is thrown.
695      * </p>
696      * @param index  index location of entry to be fetched
697      * @return vector entry at index
698      * @throws MatrixIndexException if the index is not valid
699      * @see #setEntry(int, double)
700      */
701     double getEntry(int index)
702         throws MatrixIndexException;
703 
704     /**
705      * Set a single element.
706      * @param index element index.
707      * @param value new value for the element.
708      * @exception MatrixIndexException if the index is
709      * inconsistent with vector size
710      * @see #getEntry(int)
711      */
712     void setEntry(int index, double value)
713         throws MatrixIndexException;
714 
715     /**
716      * Returns the size of the vector.
717      * @return size
718      */
719     int getDimension();
720 
721     /**
722      * Construct a vector by appending a vector to this vector.
723      * @param v vector to append to this one.
724      * @return a new vector
725      */
726     RealVector append(RealVector v);
727 
728     /**
729      * Construct a vector by appending a double to this vector.
730      * @param d double to append.
731      * @return a new vector
732      */
733     RealVector append(double d);
734 
735     /**
736      * Construct a vector by appending a double array to this vector.
737      * @param a double array to append.
738      * @return a new vector
739      */
740     RealVector append(double[] a);
741 
742     /**
743      * Get a subvector from consecutive elements.
744      * @param index index of first element.
745      * @param n number of elements to be retrieved.
746      * @return a vector containing n elements.
747      * @exception MatrixIndexException if the index is
748      * inconsistent with vector size
749      */
750     RealVector getSubVector(int index, int n)
751         throws MatrixIndexException;
752 
753     /**
754      * Set a set of consecutive elements.
755      * @param index index of first element to be set.
756      * @param v vector containing the values to set.
757      * @exception MatrixIndexException if the index is
758      * inconsistent with vector size
759      * @see #setSubVector(int, double[])
760      */
761     void setSubVector(int index, RealVector v)
762         throws MatrixIndexException;
763 
764     /**
765      * Set a set of consecutive elements.
766      * @param index index of first element to be set.
767      * @param v vector containing the values to set.
768      * @exception MatrixIndexException if the index is
769      * inconsistent with vector size
770      * @see #setSubVector(int, RealVector)
771      */
772     void setSubVector(int index, double[] v)
773         throws MatrixIndexException;
774 
775     /**
776      * Set all elements to a single value.
777      * @param value single value to set for all elements
778      */
779     void set(double value);
780 
781     /**
782      * Convert the vector to a double array.
783      * <p>The array is independent from vector data, it's elements
784      * are copied.</p>
785      * @return array containing a copy of vector elements
786      */
787     double[] toArray();
788 
789     /**
790      * Returns true if any coordinate of this vector is NaN; false otherwise
791      * @return  true if any coordinate of this vector is NaN; false otherwise
792      */
793     public boolean isNaN();
794     
795     /**
796      * Returns true if any coordinate of this vector is infinite and none are NaN;
797      * false otherwise
798      * @return  true if any coordinate of this vector is infinite and none are NaN;
799      * false otherwise
800      */
801     public boolean isInfinite();
802     
803 }