📄 sparsevector.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_01) on Mon Jul 30 16:05:54 CEST 2007 -->
<TITLE>
SparseVector (Java Machine Learning Library 0.0.11)
</TITLE>
<META NAME="date" CONTENT="2007-07-30">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="SparseVector (Java Machine Learning Library 0.0.11)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/SparseVector.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../net/sf/javaml/clustering/mcl/SparseMatrix.html" title="class in net.sf.javaml.clustering.mcl"><B>PREV CLASS</B></A>
<A HREF="../../../../../net/sf/javaml/clustering/mcl/Vectors.html" title="class in net.sf.javaml.clustering.mcl"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?net/sf/javaml/clustering/mcl/SparseVector.html" target="_top"><B>FRAMES</B></A>
<A HREF="SparseVector.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: <A HREF="#nested_classes_inherited_from_class_java.util.AbstractMap">NESTED</A> | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
net.sf.javaml.clustering.mcl</FONT>
<BR>
Class SparseVector</H2>
<PRE>
java.lang.Object
<IMG SRC="../../../../../resources/inherit.gif" ALT="extended by ">java.util.AbstractMap<K,V>
<IMG SRC="../../../../../resources/inherit.gif" ALT="extended by ">java.util.HashMap<java.lang.Integer,java.lang.Double>
<IMG SRC="../../../../../resources/inherit.gif" ALT="extended by "><B>net.sf.javaml.clustering.mcl.SparseVector</B>
</PRE>
<DL>
<DT><B>All Implemented Interfaces:</B> <DD>java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Integer,java.lang.Double></DD>
</DL>
<HR>
<DL>
<DT><PRE>public class <B>SparseVector</B><DT>extends java.util.HashMap<java.lang.Integer,java.lang.Double></DL>
</PRE>
<P>
SparseVector represents a sparse vector. <p> Conventions: except for the inherited methods and normalise(double), operations leave <tt>this</tt> ummodified (immutable) if there is a return value. Within operations, no pruning of values close to zero is done. Pruning can be controlled via the prune() method.
<P>
<P>
<DL>
<DT><B>Author:</B></DT>
<DD>gregor :: arbylon . net</DD>
<DT><B>See Also:</B><DD><A HREF="../../../../../serialized-form.html#net.sf.javaml.clustering.mcl.SparseVector">Serialized Form</A></DL>
<HR>
<P>
<!-- ======== NESTED CLASS SUMMARY ======== -->
<A NAME="nested_class_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Nested Class Summary</B></FONT></TH>
</TR>
</TABLE>
<A NAME="nested_classes_inherited_from_class_java.util.AbstractMap"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Nested classes/interfaces inherited from class java.util.AbstractMap</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V></CODE></TD>
</TR>
</TABLE>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../net/sf/javaml/clustering/mcl/SparseVector.html#SparseVector()">SparseVector</A></B>()</CODE>
<BR>
create empty vector</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../net/sf/javaml/clustering/mcl/SparseVector.html#SparseVector(double[])">SparseVector</A></B>(double[] x)</CODE>
<BR>
create vector from dense vector</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../net/sf/javaml/clustering/mcl/SparseVector.html#SparseVector(int)">SparseVector</A></B>(int i)</CODE>
<BR>
create empty vector with length</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../net/sf/javaml/clustering/mcl/SparseVector.html#SparseVector(net.sf.javaml.clustering.mcl.SparseVector)">SparseVector</A></B>(<A HREF="../../../../../net/sf/javaml/clustering/mcl/SparseVector.html" title="class in net.sf.javaml.clustering.mcl">SparseVector</A> v)</CODE>
<BR>
copy constructor</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../net/sf/javaml/clustering/mcl/SparseVector.html#add(int, double)">add</A></B>(int i,
double a)</CODE>
<BR>
mutable add</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../net/sf/javaml/clustering/mcl/SparseVector.html#add(net.sf.javaml.clustering.mcl.SparseVector)">add</A></B>(<A HREF="../../../../../net/sf/javaml/clustering/mcl/SparseVector.html" title="class in net.sf.javaml.clustering.mcl">SparseVector</A> v)</CODE>
<BR>
mutable add</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../net/sf/javaml/clustering/mcl/SparseVector.html" title="class in net.sf.javaml.clustering.mcl">SparseVector</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../net/sf/javaml/clustering/mcl/SparseVector.html#copy()">copy</A></B>()</CODE>
<BR>
copy the contents of the sparse vector</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../net/sf/javaml/clustering/mcl/SparseVector.html#expSum(int)">expSum</A></B>(int p)</CODE>
<BR>
exponential sum, i.e., sum (elements^p)</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../net/sf/javaml/clustering/mcl/SparseVector.html#factor(double)">factor</A></B>(double a)</CODE>
<BR>
mutable factorisation</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.Double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../net/sf/javaml/clustering/mcl/SparseVector.html#get(java.lang.Object)">get</A></B>(java.lang.Object key)</CODE>
<BR>
get ensures it returns 0 for empty hash values or if index exceeds length.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> double[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../net/sf/javaml/clustering/mcl/SparseVector.html#getDense()">getDense</A></B>()</CODE>
<BR>
get dense represenation</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../net/sf/javaml/clustering/mcl/SparseVector.html#getLength()">getLength</A></B>()</CODE>
<BR>
get the length of the vector</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../net/sf/javaml/clustering/mcl/SparseVector.html#hadamardPower(double)">hadamardPower</A></B>(double s)</CODE>
<BR>
mutable Hadamard power</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../net/sf/javaml/clustering/mcl/SparseVector.html#hadamardProduct(net.sf.javaml.clustering.mcl.SparseVector)">hadamardProduct</A></B>(<A HREF="../../../../../net/sf/javaml/clustering/mcl/SparseVector.html" title="class in net.sf.javaml.clustering.mcl">SparseVector</A> v)</CODE>
<BR>
mutable Hadamard product (elementwise multiplication)</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../net/sf/javaml/clustering/mcl/SparseVector.html#max()">max</A></B>()</CODE>
<BR>
maximum element value</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../net/sf/javaml/clustering/mcl/SparseVector.html#mult(int, double)">mult</A></B>(int i,
double a)</CODE>
<BR>
mutable mult</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../net/sf/javaml/clustering/mcl/SparseVector.html#normalise()">normalise</A></B>()</CODE>
<BR>
normalises the vector to 1.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../net/sf/javaml/clustering/mcl/SparseVector.html#normalise(double)">normalise</A></B>(double newsum)</CODE>
<BR>
normalises the vector to newsum</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../net/sf/javaml/clustering/mcl/SparseVector.html#prune(double)">prune</A></B>(double threshold)</CODE>
<BR>
remove all elements whose magnitude is < threshold</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.Double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../net/sf/javaml/clustering/mcl/SparseVector.html#put(java.lang.Integer, java.lang.Double)">put</A></B>(java.lang.Integer key,
java.lang.Double value)</CODE>
<BR>
put increases the matrix size if the index exceeds the current size.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../net/sf/javaml/clustering/mcl/SparseVector.html#setLength(int)">setLength</A></B>(int length)</CODE>
<BR>
set the new length of the vector (regardless of the maximum index).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../net/sf/javaml/clustering/mcl/SparseVector.html#sum(double)">sum</A></B>(double s)</CODE>
<BR>
power sum of the elements</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../net/sf/javaml/clustering/mcl/SparseVector.html#times(net.sf.javaml.clustering.mcl.SparseVector)">times</A></B>(<A HREF="../../../../../net/sf/javaml/clustering/mcl/SparseVector.html" title="class in net.sf.javaml.clustering.mcl">SparseVector</A> v)</CODE>
<BR>
immutable scalar product</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../net/sf/javaml/clustering/mcl/SparseVector.html#toString()">toString</A></B>()</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../net/sf/javaml/clustering/mcl/SparseVector.html#toStringDense()">toStringDense</A></B>()</CODE>
<BR>
create string representation of dense equivalent.</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.util.HashMap"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.util.HashMap</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clear, clone, containsKey, containsValue, entrySet, isEmpty, keySet, putAll, remove, size, values</CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.util.AbstractMap"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.util.AbstractMap</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>equals, hashCode</CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>finalize, getClass, notify, notifyAll, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.util.Map"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from interface java.util.Map</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>equals, hashCode</CODE></TD>
</TR>
</TABLE>
<P>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="SparseVector()"><!-- --></A><H3>
SparseVector</H3>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -