blob: be51d8070be3545e5e0da38559c44c422b4fb3c3 (
plain) (
tree)
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_51) on Wed Sep 16 15:55:11 PDT 2015 -->
<title>Vector</title>
<meta name="date" content="2015-09-16">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Vector";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/spark/mllib/linalg/SparseVector.html" title="class in org.apache.spark.mllib.linalg"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../org/apache/spark/mllib/linalg/Vectors.html" title="class in org.apache.spark.mllib.linalg"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/spark/mllib/linalg/Vector.html" target="_top">Frames</a></li>
<li><a href="Vector.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.spark.mllib.linalg</div>
<h2 title="Interface Vector" class="title">Interface Vector</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Superinterfaces:</dt>
<dd>java.io.Serializable</dd>
</dl>
<dl>
<dt>All Known Implementing Classes:</dt>
<dd><a href="../../../../../org/apache/spark/mllib/linalg/DenseVector.html" title="class in org.apache.spark.mllib.linalg">DenseVector</a>, <a href="../../../../../org/apache/spark/mllib/linalg/SparseVector.html" title="class in org.apache.spark.mllib.linalg">SparseVector</a></dd>
</dl>
<hr>
<br>
<pre>public interface <span class="strong">Vector</span>
extends scala.Serializable</pre>
<div class="block">Represents a numeric vector, whose index type is Int and value type is Double.
<p>
Note: Users should not implement this interface.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/linalg/Vector.html#apply(int)">apply</a></strong>(int i)</code>
<div class="block">Gets the value of the ith element.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/linalg/Vector.html#argmax()">argmax</a></strong>()</code>
<div class="block">Find the index of a maximal element.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../org/apache/spark/mllib/linalg/Vector.html" title="interface in org.apache.spark.mllib.linalg">Vector</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/linalg/Vector.html#compressed()">compressed</a></strong>()</code>
<div class="block">Returns a vector in either dense or sparse format, whichever uses less storage.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../org/apache/spark/mllib/linalg/Vector.html" title="interface in org.apache.spark.mllib.linalg">Vector</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/linalg/Vector.html#copy()">copy</a></strong>()</code>
<div class="block">Makes a deep copy of this vector.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/linalg/Vector.html#equals(java.lang.Object)">equals</a></strong>(java.lang.Object other)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/linalg/Vector.html#foreachActive(scala.Function2)">foreachActive</a></strong>(scala.Function2<java.lang.Object,java.lang.Object,scala.runtime.BoxedUnit> f)</code>
<div class="block">Applies a function <code>f</code> to all the active elements of dense and sparse vector.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/linalg/Vector.html#hashCode()">hashCode</a></strong>()</code>
<div class="block">Returns a hash code value for the vector.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/linalg/Vector.html#numActives()">numActives</a></strong>()</code>
<div class="block">Number of active entries.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/linalg/Vector.html#numNonzeros()">numNonzeros</a></strong>()</code>
<div class="block">Number of nonzero elements.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/linalg/Vector.html#size()">size</a></strong>()</code>
<div class="block">Size of the vector.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>double[]</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/linalg/Vector.html#toArray()">toArray</a></strong>()</code>
<div class="block">Converts the instance to a double array.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>breeze.linalg.Vector<java.lang.Object></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/linalg/Vector.html#toBreeze()">toBreeze</a></strong>()</code>
<div class="block">Converts the instance to a breeze vector.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../org/apache/spark/mllib/linalg/DenseVector.html" title="class in org.apache.spark.mllib.linalg">DenseVector</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/linalg/Vector.html#toDense()">toDense</a></strong>()</code>
<div class="block">Converts this vector to a dense vector.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../org/apache/spark/mllib/linalg/SparseVector.html" title="class in org.apache.spark.mllib.linalg">SparseVector</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/spark/mllib/linalg/Vector.html#toSparse()">toSparse</a></strong>()</code>
<div class="block">Converts this vector to a sparse vector with all explicit zeros removed.</div>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="size()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>size</h4>
<pre>int size()</pre>
<div class="block">Size of the vector.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>(undocumented)</dd></dl>
</li>
</ul>
<a name="toArray()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toArray</h4>
<pre>double[] toArray()</pre>
<div class="block">Converts the instance to a double array.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>(undocumented)</dd></dl>
</li>
</ul>
<a name="equals(java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>equals</h4>
<pre>boolean equals(java.lang.Object other)</pre>
<dl>
<dt><strong>Overrides:</strong></dt>
<dd><code>equals</code> in class <code>java.lang.Object</code></dd>
</dl>
</li>
</ul>
<a name="hashCode()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>hashCode</h4>
<pre>int hashCode()</pre>
<div class="block">Returns a hash code value for the vector. The hash code is based on its size and its nonzeros
in the first 16 entries, using a hash algorithm similar to <code>java.util.Arrays.hashCode</code>.</div>
<dl>
<dt><strong>Overrides:</strong></dt>
<dd><code>hashCode</code> in class <code>java.lang.Object</code></dd>
<dt><span class="strong">Returns:</span></dt><dd>(undocumented)</dd></dl>
</li>
</ul>
<a name="toBreeze()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toBreeze</h4>
<pre>breeze.linalg.Vector<java.lang.Object> toBreeze()</pre>
<div class="block">Converts the instance to a breeze vector.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>(undocumented)</dd></dl>
</li>
</ul>
<a name="apply(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>apply</h4>
<pre>double apply(int i)</pre>
<div class="block">Gets the value of the ith element.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>i</code> - index</dd>
<dt><span class="strong">Returns:</span></dt><dd>(undocumented)</dd></dl>
</li>
</ul>
<a name="copy()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>copy</h4>
<pre><a href="../../../../../org/apache/spark/mllib/linalg/Vector.html" title="interface in org.apache.spark.mllib.linalg">Vector</a> copy()</pre>
<div class="block">Makes a deep copy of this vector.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>(undocumented)</dd></dl>
</li>
</ul>
<a name="foreachActive(scala.Function2)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>foreachActive</h4>
<pre>void foreachActive(scala.Function2<java.lang.Object,java.lang.Object,scala.runtime.BoxedUnit> f)</pre>
<div class="block">Applies a function <code>f</code> to all the active elements of dense and sparse vector.
<p></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>f</code> - the function takes two parameters where the first parameter is the index of
the vector with type <code>Int</code>, and the second parameter is the corresponding value
with type <code>Double</code>.</dd></dl>
</li>
</ul>
<a name="numActives()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>numActives</h4>
<pre>int numActives()</pre>
<div class="block">Number of active entries. An "active entry" is an element which is explicitly stored,
regardless of its value. Note that inactive entries have value 0.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>(undocumented)</dd></dl>
</li>
</ul>
<a name="numNonzeros()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>numNonzeros</h4>
<pre>int numNonzeros()</pre>
<div class="block">Number of nonzero elements. This scans all active values and count nonzeros.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>(undocumented)</dd></dl>
</li>
</ul>
<a name="toSparse()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toSparse</h4>
<pre><a href="../../../../../org/apache/spark/mllib/linalg/SparseVector.html" title="class in org.apache.spark.mllib.linalg">SparseVector</a> toSparse()</pre>
<div class="block">Converts this vector to a sparse vector with all explicit zeros removed.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>(undocumented)</dd></dl>
</li>
</ul>
<a name="toDense()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toDense</h4>
<pre><a href="../../../../../org/apache/spark/mllib/linalg/DenseVector.html" title="class in org.apache.spark.mllib.linalg">DenseVector</a> toDense()</pre>
<div class="block">Converts this vector to a dense vector.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>(undocumented)</dd></dl>
</li>
</ul>
<a name="compressed()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>compressed</h4>
<pre><a href="../../../../../org/apache/spark/mllib/linalg/Vector.html" title="interface in org.apache.spark.mllib.linalg">Vector</a> compressed()</pre>
<div class="block">Returns a vector in either dense or sparse format, whichever uses less storage.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>(undocumented)</dd></dl>
</li>
</ul>
<a name="argmax()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>argmax</h4>
<pre>int argmax()</pre>
<div class="block">Find the index of a maximal element. Returns the first maximal element in case of a tie.
Returns -1 if vector has length 0.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>(undocumented)</dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/spark/mllib/linalg/SparseVector.html" title="class in org.apache.spark.mllib.linalg"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../org/apache/spark/mllib/linalg/Vectors.html" title="class in org.apache.spark.mllib.linalg"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/spark/mllib/linalg/Vector.html" target="_top">Frames</a></li>
<li><a href="Vector.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<script defer="defer" type="text/javascript" src="../../../../../lib/jquery.js"></script><script defer="defer" type="text/javascript" src="../../../../../lib/api-javadocs.js"></script></body>
</html>
|