📄 node.cs
字号:
//Copyright (C) 2007 Matthew Johnson
//This program is free software; you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation; either version 2 of the License, or
//(at your option) any later version.
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details.
//You should have received a copy of the GNU General Public License along
//with this program; if not, write to the Free Software Foundation, Inc.,
//51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
using System;
namespace SVM
{
/// <summary>
/// Encapsulates a node in a Problem vector, with an index and a value (for more efficient representation
/// of sparse data.
/// </summary>
[Serializable]
public class Node
{
private int _index;
private double _value;
/// <summary>
/// Default Constructor.
/// </summary>
public Node()
{
}
/// <summary>
/// Constructor.
/// </summary>
/// <param name="index">The index of the value.</param>
/// <param name="value">The value to store.</param>
public Node(int index, double value)
{
_index = index;
_value = value;
}
/// <summary>
/// Index of this Node.
/// </summary>
public int Index
{
get
{
return _index;
}
set
{
_index = value;
}
}
/// <summary>
/// Value at Index.
/// </summary>
public double Value
{
get
{
return _value;
}
set
{
_value = value;
}
}
/// <summary>
/// String representation of this Node as {index}:{value}.
/// </summary>
/// <returns>{index}:{value}</returns>
public override string ToString()
{
return string.Format("{0}:{1}", _index, _value);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -