repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/VoronoiDraw.java | VoronoiDraw.drawFakeVoronoi | public static SVGPath drawFakeVoronoi(Projection2D proj, List<double[]> means) {
CanvasSize viewport = proj.estimateViewport();
final SVGPath path = new SVGPath();
// Difference
final double[] dirv = VMath.minus(means.get(1), means.get(0));
VMath.rotate90Equals(dirv);
double[] dir = proj.fastPro... | java | public static SVGPath drawFakeVoronoi(Projection2D proj, List<double[]> means) {
CanvasSize viewport = proj.estimateViewport();
final SVGPath path = new SVGPath();
// Difference
final double[] dirv = VMath.minus(means.get(1), means.get(0));
VMath.rotate90Equals(dirv);
double[] dir = proj.fastPro... | [
"public",
"static",
"SVGPath",
"drawFakeVoronoi",
"(",
"Projection2D",
"proj",
",",
"List",
"<",
"double",
"[",
"]",
">",
"means",
")",
"{",
"CanvasSize",
"viewport",
"=",
"proj",
".",
"estimateViewport",
"(",
")",
";",
"final",
"SVGPath",
"path",
"=",
"ne... | Fake Voronoi diagram. For two means only
@param proj Projection
@param means Mean vectors
@return SVG path | [
"Fake",
"Voronoi",
"diagram",
".",
"For",
"two",
"means",
"only"
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/VoronoiDraw.java#L150-L170 | train |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/visualizers/pairsegments/SegmentsStylingPolicy.java | SegmentsStylingPolicy.select | public void select(Segment segment, boolean addToSelection) {
// abort if segment represents pairs inNone. Would select all segments...
if(segment.isNone()) {
return;
}
if(!addToSelection) {
deselectAllSegments();
}
// get selected segments
if(segment.isUnpaired()) {
// ch... | java | public void select(Segment segment, boolean addToSelection) {
// abort if segment represents pairs inNone. Would select all segments...
if(segment.isNone()) {
return;
}
if(!addToSelection) {
deselectAllSegments();
}
// get selected segments
if(segment.isUnpaired()) {
// ch... | [
"public",
"void",
"select",
"(",
"Segment",
"segment",
",",
"boolean",
"addToSelection",
")",
"{",
"// abort if segment represents pairs inNone. Would select all segments...",
"if",
"(",
"segment",
".",
"isNone",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
... | Adds or removes the given segment to the selection. Depending on the
clustering and cluster selected and the addToSelection option given, the
current selection will be modified. This method is called by clicking on a
segment and ring and the CTRL-button status.
Adding selections does only work on the same clustering a... | [
"Adds",
"or",
"removes",
"the",
"given",
"segment",
"to",
"the",
"selection",
".",
"Depending",
"on",
"the",
"clustering",
"and",
"cluster",
"selected",
"and",
"the",
"addToSelection",
"option",
"given",
"the",
"current",
"selection",
"will",
"be",
"modified",
... | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/visualizers/pairsegments/SegmentsStylingPolicy.java#L191-L234 | train |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/visualizers/pairsegments/SegmentsStylingPolicy.java | SegmentsStylingPolicy.deselectSegment | protected void deselectSegment(Segment segment) {
if(segment.isUnpaired()) {
ArrayList<Segment> remove = new ArrayList<>();
// remove all object segments associated with unpaired segment from
// selection list
for(Entry<Segment, Segment> entry : indirectSelections.entrySet()) {
if(en... | java | protected void deselectSegment(Segment segment) {
if(segment.isUnpaired()) {
ArrayList<Segment> remove = new ArrayList<>();
// remove all object segments associated with unpaired segment from
// selection list
for(Entry<Segment, Segment> entry : indirectSelections.entrySet()) {
if(en... | [
"protected",
"void",
"deselectSegment",
"(",
"Segment",
"segment",
")",
"{",
"if",
"(",
"segment",
".",
"isUnpaired",
"(",
")",
")",
"{",
"ArrayList",
"<",
"Segment",
">",
"remove",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"// remove all object segments... | Deselect a segment
@param segment Segment to deselect | [
"Deselect",
"a",
"segment"
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/visualizers/pairsegments/SegmentsStylingPolicy.java#L250-L277 | train |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/visualizers/pairsegments/SegmentsStylingPolicy.java | SegmentsStylingPolicy.selectSegment | protected void selectSegment(Segment segment) {
if(segment.isUnpaired()) {
// remember selected unpaired segment
for(Segment other : segments.getPairedSegments(segment)) {
indirectSelections.put(other, segment);
selectSegment(other);
}
}
else {
if(!selectedSegments.co... | java | protected void selectSegment(Segment segment) {
if(segment.isUnpaired()) {
// remember selected unpaired segment
for(Segment other : segments.getPairedSegments(segment)) {
indirectSelections.put(other, segment);
selectSegment(other);
}
}
else {
if(!selectedSegments.co... | [
"protected",
"void",
"selectSegment",
"(",
"Segment",
"segment",
")",
"{",
"if",
"(",
"segment",
".",
"isUnpaired",
"(",
")",
")",
"{",
"// remember selected unpaired segment",
"for",
"(",
"Segment",
"other",
":",
"segments",
".",
"getPairedSegments",
"(",
"segm... | Select a segment
@param segment Segment to select | [
"Select",
"a",
"segment"
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/visualizers/pairsegments/SegmentsStylingPolicy.java#L284-L300 | train |
elki-project/elki | elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/application/internal/CheckParameterizables.java | CheckParameterizables.checkSupertypes | private boolean checkSupertypes(Class<?> cls) {
for(Class<?> c : knownParameterizables) {
if(c.isAssignableFrom(cls)) {
return true;
}
}
return false;
} | java | private boolean checkSupertypes(Class<?> cls) {
for(Class<?> c : knownParameterizables) {
if(c.isAssignableFrom(cls)) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"checkSupertypes",
"(",
"Class",
"<",
"?",
">",
"cls",
")",
"{",
"for",
"(",
"Class",
"<",
"?",
">",
"c",
":",
"knownParameterizables",
")",
"{",
"if",
"(",
"c",
".",
"isAssignableFrom",
"(",
"cls",
")",
")",
"{",
"return",
"tru... | Check all supertypes of a class.
@param cls Class to check.
@return {@code true} when at least one supertype is a known parameterizable
type. | [
"Check",
"all",
"supertypes",
"of",
"a",
"class",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/application/internal/CheckParameterizables.java#L158-L165 | train |
elki-project/elki | elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/application/internal/CheckParameterizables.java | CheckParameterizables.checkV3Parameterization | private State checkV3Parameterization(Class<?> cls, State state) throws NoClassDefFoundError {
// check for a V3 Parameterizer class
for(Class<?> inner : cls.getDeclaredClasses()) {
if(AbstractParameterizer.class.isAssignableFrom(inner)) {
try {
Class<? extends AbstractParameterizer> pcl... | java | private State checkV3Parameterization(Class<?> cls, State state) throws NoClassDefFoundError {
// check for a V3 Parameterizer class
for(Class<?> inner : cls.getDeclaredClasses()) {
if(AbstractParameterizer.class.isAssignableFrom(inner)) {
try {
Class<? extends AbstractParameterizer> pcl... | [
"private",
"State",
"checkV3Parameterization",
"(",
"Class",
"<",
"?",
">",
"cls",
",",
"State",
"state",
")",
"throws",
"NoClassDefFoundError",
"{",
"// check for a V3 Parameterizer class",
"for",
"(",
"Class",
"<",
"?",
">",
"inner",
":",
"cls",
".",
"getDecla... | Check for a V3 constructor. | [
"Check",
"for",
"a",
"V3",
"constructor",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/application/internal/CheckParameterizables.java#L180-L201 | train |
elki-project/elki | elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/application/internal/CheckParameterizables.java | CheckParameterizables.checkDefaultConstructor | private State checkDefaultConstructor(Class<?> cls, State state) throws NoClassDefFoundError {
try {
cls.getConstructor();
return State.DEFAULT_INSTANTIABLE;
}
catch(Exception e) {
// do nothing.
}
return state;
} | java | private State checkDefaultConstructor(Class<?> cls, State state) throws NoClassDefFoundError {
try {
cls.getConstructor();
return State.DEFAULT_INSTANTIABLE;
}
catch(Exception e) {
// do nothing.
}
return state;
} | [
"private",
"State",
"checkDefaultConstructor",
"(",
"Class",
"<",
"?",
">",
"cls",
",",
"State",
"state",
")",
"throws",
"NoClassDefFoundError",
"{",
"try",
"{",
"cls",
".",
"getConstructor",
"(",
")",
";",
"return",
"State",
".",
"DEFAULT_INSTANTIABLE",
";",
... | Check for a default constructor. | [
"Check",
"for",
"a",
"default",
"constructor",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/application/internal/CheckParameterizables.java#L204-L213 | train |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/LogGammaDistribution.java | LogGammaDistribution.logpdf | public static double logpdf(double x, double k, double theta, double shift) {
x = (x - shift);
if(x <= 0.) {
return Double.NEGATIVE_INFINITY;
}
final double log1px = FastMath.log1p(x);
return k * FastMath.log(theta) - GammaDistribution.logGamma(k) - (theta + 1.) * log1px + (k - 1) * FastMath.l... | java | public static double logpdf(double x, double k, double theta, double shift) {
x = (x - shift);
if(x <= 0.) {
return Double.NEGATIVE_INFINITY;
}
final double log1px = FastMath.log1p(x);
return k * FastMath.log(theta) - GammaDistribution.logGamma(k) - (theta + 1.) * log1px + (k - 1) * FastMath.l... | [
"public",
"static",
"double",
"logpdf",
"(",
"double",
"x",
",",
"double",
"k",
",",
"double",
"theta",
",",
"double",
"shift",
")",
"{",
"x",
"=",
"(",
"x",
"-",
"shift",
")",
";",
"if",
"(",
"x",
"<=",
"0.",
")",
"{",
"return",
"Double",
".",
... | LogGamma distribution logPDF
@param x query value
@param k Alpha
@param theta Theta = 1 / Beta
@return log probability density | [
"LogGamma",
"distribution",
"logPDF"
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/LogGammaDistribution.java#L205-L212 | train |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/style/marker/PrettyMarkers.java | PrettyMarkers.plotGray | protected void plotGray(SVGPlot plot, Element parent, double x, double y, double size) {
Element marker = plot.svgCircle(x, y, size * .5);
SVGUtil.setStyle(marker, SVGConstants.CSS_FILL_PROPERTY + ":" + greycolor);
parent.appendChild(marker);
} | java | protected void plotGray(SVGPlot plot, Element parent, double x, double y, double size) {
Element marker = plot.svgCircle(x, y, size * .5);
SVGUtil.setStyle(marker, SVGConstants.CSS_FILL_PROPERTY + ":" + greycolor);
parent.appendChild(marker);
} | [
"protected",
"void",
"plotGray",
"(",
"SVGPlot",
"plot",
",",
"Element",
"parent",
",",
"double",
"x",
",",
"double",
"y",
",",
"double",
"size",
")",
"{",
"Element",
"marker",
"=",
"plot",
".",
"svgCircle",
"(",
"x",
",",
"y",
",",
"size",
"*",
".5"... | Plot a replacement marker when an object is to be plotted as "disabled",
usually gray.
@param plot Plot to draw to
@param parent Parent element
@param x X position
@param y Y position
@param size Size | [
"Plot",
"a",
"replacement",
"marker",
"when",
"an",
"object",
"is",
"to",
"be",
"plotted",
"as",
"disabled",
"usually",
"gray",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/style/marker/PrettyMarkers.java#L251-L255 | train |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/style/marker/PrettyMarkers.java | PrettyMarkers.plotUncolored | protected void plotUncolored(SVGPlot plot, Element parent, double x, double y, double size) {
Element marker = plot.svgCircle(x, y, size * .5);
SVGUtil.setStyle(marker, SVGConstants.CSS_FILL_PROPERTY + ":" + dotcolor);
parent.appendChild(marker);
} | java | protected void plotUncolored(SVGPlot plot, Element parent, double x, double y, double size) {
Element marker = plot.svgCircle(x, y, size * .5);
SVGUtil.setStyle(marker, SVGConstants.CSS_FILL_PROPERTY + ":" + dotcolor);
parent.appendChild(marker);
} | [
"protected",
"void",
"plotUncolored",
"(",
"SVGPlot",
"plot",
",",
"Element",
"parent",
",",
"double",
"x",
",",
"double",
"y",
",",
"double",
"size",
")",
"{",
"Element",
"marker",
"=",
"plot",
".",
"svgCircle",
"(",
"x",
",",
"y",
",",
"size",
"*",
... | Plot a replacement marker when no color is set; usually black
@param plot Plot to draw to
@param parent Parent element
@param x X position
@param y Y position
@param size Size | [
"Plot",
"a",
"replacement",
"marker",
"when",
"no",
"color",
"is",
"set",
";",
"usually",
"black"
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/style/marker/PrettyMarkers.java#L266-L270 | train |
elki-project/elki | elki-classification/src/main/java/de/lmu/ifi/dbs/elki/evaluation/classification/ConfusionMatrix.java | ConfusionMatrix.truePositives | public int truePositives() {
int tp = 0;
for(int i = 0; i < confusion.length; i++) {
tp += truePositives(i);
}
return tp;
} | java | public int truePositives() {
int tp = 0;
for(int i = 0; i < confusion.length; i++) {
tp += truePositives(i);
}
return tp;
} | [
"public",
"int",
"truePositives",
"(",
")",
"{",
"int",
"tp",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"confusion",
".",
"length",
";",
"i",
"++",
")",
"{",
"tp",
"+=",
"truePositives",
"(",
"i",
")",
";",
"}",
"return",
... | The number of correctly classified instances.
@return the number of correctly classified instances | [
"The",
"number",
"of",
"correctly",
"classified",
"instances",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-classification/src/main/java/de/lmu/ifi/dbs/elki/evaluation/classification/ConfusionMatrix.java#L151-L157 | train |
elki-project/elki | elki-classification/src/main/java/de/lmu/ifi/dbs/elki/evaluation/classification/ConfusionMatrix.java | ConfusionMatrix.trueNegatives | public int trueNegatives(int classindex) {
int tn = 0;
for(int i = 0; i < confusion.length; i++) {
for(int j = 0; j < confusion[i].length; j++) {
if(i != classindex && j != classindex) {
tn += confusion[i][j];
}
}
}
return tn;
} | java | public int trueNegatives(int classindex) {
int tn = 0;
for(int i = 0; i < confusion.length; i++) {
for(int j = 0; j < confusion[i].length; j++) {
if(i != classindex && j != classindex) {
tn += confusion[i][j];
}
}
}
return tn;
} | [
"public",
"int",
"trueNegatives",
"(",
"int",
"classindex",
")",
"{",
"int",
"tn",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"confusion",
".",
"length",
";",
"i",
"++",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j... | The number of true negatives of the specified class.
@param classindex the index of the class to retrieve the true negatives for
@return the number of true negatives of the specified class | [
"The",
"number",
"of",
"true",
"negatives",
"of",
"the",
"specified",
"class",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-classification/src/main/java/de/lmu/ifi/dbs/elki/evaluation/classification/ConfusionMatrix.java#L192-L202 | train |
elki-project/elki | elki-classification/src/main/java/de/lmu/ifi/dbs/elki/evaluation/classification/ConfusionMatrix.java | ConfusionMatrix.falsePositives | public int falsePositives(int classindex) {
int fp = 0;
for(int i = 0; i < confusion[classindex].length; i++) {
if(i != classindex) {
fp += confusion[classindex][i];
}
}
return fp;
} | java | public int falsePositives(int classindex) {
int fp = 0;
for(int i = 0; i < confusion[classindex].length; i++) {
if(i != classindex) {
fp += confusion[classindex][i];
}
}
return fp;
} | [
"public",
"int",
"falsePositives",
"(",
"int",
"classindex",
")",
"{",
"int",
"fp",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"confusion",
"[",
"classindex",
"]",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
"!... | The false positives for the specified class.
@param classindex the index of the class to retrieve the false positives
for
@return the false positives for the specified class | [
"The",
"false",
"positives",
"for",
"the",
"specified",
"class",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-classification/src/main/java/de/lmu/ifi/dbs/elki/evaluation/classification/ConfusionMatrix.java#L212-L220 | train |
elki-project/elki | elki-classification/src/main/java/de/lmu/ifi/dbs/elki/evaluation/classification/ConfusionMatrix.java | ConfusionMatrix.falseNegatives | public int falseNegatives(int classindex) {
int fn = 0;
for(int i = 0; i < confusion.length; i++) {
if(i != classindex) {
fn += confusion[i][classindex];
}
}
return fn;
} | java | public int falseNegatives(int classindex) {
int fn = 0;
for(int i = 0; i < confusion.length; i++) {
if(i != classindex) {
fn += confusion[i][classindex];
}
}
return fn;
} | [
"public",
"int",
"falseNegatives",
"(",
"int",
"classindex",
")",
"{",
"int",
"fn",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"confusion",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
"!=",
"classindex",
")",
"... | The false negatives for the specified class.
@param classindex the index of the class to retrieve the false negatives
for
@return the false negatives for the specified class | [
"The",
"false",
"negatives",
"for",
"the",
"specified",
"class",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-classification/src/main/java/de/lmu/ifi/dbs/elki/evaluation/classification/ConfusionMatrix.java#L230-L238 | train |
elki-project/elki | elki-classification/src/main/java/de/lmu/ifi/dbs/elki/evaluation/classification/ConfusionMatrix.java | ConfusionMatrix.totalInstances | public int totalInstances() {
int total = 0;
for(int i = 0; i < confusion.length; i++) {
for(int j = 0; j < confusion[i].length; j++) {
total += confusion[i][j];
}
}
return total;
} | java | public int totalInstances() {
int total = 0;
for(int i = 0; i < confusion.length; i++) {
for(int j = 0; j < confusion[i].length; j++) {
total += confusion[i][j];
}
}
return total;
} | [
"public",
"int",
"totalInstances",
"(",
")",
"{",
"int",
"total",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"confusion",
".",
"length",
";",
"i",
"++",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"confusio... | The total number of instances covered by this confusion matrix.
@return the total number of instances covered by this confusion matrix | [
"The",
"total",
"number",
"of",
"instances",
"covered",
"by",
"this",
"confusion",
"matrix",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-classification/src/main/java/de/lmu/ifi/dbs/elki/evaluation/classification/ConfusionMatrix.java#L246-L254 | train |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/dependence/DistanceCorrelationDependenceMeasure.java | DistanceCorrelationDependenceMeasure.computeDistances | protected static <A> double[] computeDistances(NumberArrayAdapter<?, A> adapter, A data) {
final int size = adapter.size(data);
double[] dMatrix = new double[(size * (size + 1)) >> 1];
for(int i = 0, c = 0; i < size; i++) {
for(int j = 0; j < i; j++) {
double dx = adapter.getDouble(data, i) - ... | java | protected static <A> double[] computeDistances(NumberArrayAdapter<?, A> adapter, A data) {
final int size = adapter.size(data);
double[] dMatrix = new double[(size * (size + 1)) >> 1];
for(int i = 0, c = 0; i < size; i++) {
for(int j = 0; j < i; j++) {
double dx = adapter.getDouble(data, i) - ... | [
"protected",
"static",
"<",
"A",
">",
"double",
"[",
"]",
"computeDistances",
"(",
"NumberArrayAdapter",
"<",
"?",
",",
"A",
">",
"adapter",
",",
"A",
"data",
")",
"{",
"final",
"int",
"size",
"=",
"adapter",
".",
"size",
"(",
"data",
")",
";",
"doub... | Compute the double-centered delta matrix.
@param adapter Data adapter
@param data Input data
@return Double-centered delta matrix. | [
"Compute",
"the",
"double",
"-",
"centered",
"delta",
"matrix",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/dependence/DistanceCorrelationDependenceMeasure.java#L121-L133 | train |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/dependence/DistanceCorrelationDependenceMeasure.java | DistanceCorrelationDependenceMeasure.doubleCenterMatrix | public static void doubleCenterMatrix(double[] dMatrix, int size) {
double[] rowMean = new double[size];
// row sum
for(int i = 0, c = 0; i < size; i++) {
for(int j = 0; j < i; j++) {
double v = dMatrix[c++];
rowMean[i] += v;
rowMean[j] += v;
}
assert (dMatrix[c] ==... | java | public static void doubleCenterMatrix(double[] dMatrix, int size) {
double[] rowMean = new double[size];
// row sum
for(int i = 0, c = 0; i < size; i++) {
for(int j = 0; j < i; j++) {
double v = dMatrix[c++];
rowMean[i] += v;
rowMean[j] += v;
}
assert (dMatrix[c] ==... | [
"public",
"static",
"void",
"doubleCenterMatrix",
"(",
"double",
"[",
"]",
"dMatrix",
",",
"int",
"size",
")",
"{",
"double",
"[",
"]",
"rowMean",
"=",
"new",
"double",
"[",
"size",
"]",
";",
"// row sum",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"c",
... | Computes the distance variance matrix of one axis.
@param dMatrix distance matrix of the axis
@param size Dimensionality | [
"Computes",
"the",
"distance",
"variance",
"matrix",
"of",
"one",
"axis",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/dependence/DistanceCorrelationDependenceMeasure.java#L141-L167 | train |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/cash/ParameterizationFunction.java | ParameterizationFunction.determineAlphaMinMax | public HyperBoundingBox determineAlphaMinMax(HyperBoundingBox interval) {
final int dim = vec.getDimensionality();
if(interval.getDimensionality() != dim - 1) {
throw new IllegalArgumentException("Interval needs to have dimensionality d=" + (dim - 1) + ", read: " + interval.getDimensionality());
}
... | java | public HyperBoundingBox determineAlphaMinMax(HyperBoundingBox interval) {
final int dim = vec.getDimensionality();
if(interval.getDimensionality() != dim - 1) {
throw new IllegalArgumentException("Interval needs to have dimensionality d=" + (dim - 1) + ", read: " + interval.getDimensionality());
}
... | [
"public",
"HyperBoundingBox",
"determineAlphaMinMax",
"(",
"HyperBoundingBox",
"interval",
")",
"{",
"final",
"int",
"dim",
"=",
"vec",
".",
"getDimensionality",
"(",
")",
";",
"if",
"(",
"interval",
".",
"getDimensionality",
"(",
")",
"!=",
"dim",
"-",
"1",
... | Determines the alpha values where this function has a minumum and maximum
value in the given interval.
@param interval the hyper bounding box defining the interval
@return he alpha values where this function has a minumum and maximum value
in the given interval | [
"Determines",
"the",
"alpha",
"values",
"where",
"this",
"function",
"has",
"a",
"minumum",
"and",
"maximum",
"value",
"in",
"the",
"given",
"interval",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/cash/ParameterizationFunction.java#L118-L154 | train |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/cash/ParameterizationFunction.java | ParameterizationFunction.extremumType | private ExtremumType extremumType(int n, double[] alpha_extreme, HyperBoundingBox interval) {
// return the type of the global extremum
if(n == alpha_extreme.length - 1) {
return extremumType;
}
// create random alpha values
double[] alpha_extreme_l = new double[alpha_extreme.length];
dou... | java | private ExtremumType extremumType(int n, double[] alpha_extreme, HyperBoundingBox interval) {
// return the type of the global extremum
if(n == alpha_extreme.length - 1) {
return extremumType;
}
// create random alpha values
double[] alpha_extreme_l = new double[alpha_extreme.length];
dou... | [
"private",
"ExtremumType",
"extremumType",
"(",
"int",
"n",
",",
"double",
"[",
"]",
"alpha_extreme",
",",
"HyperBoundingBox",
"interval",
")",
"{",
"// return the type of the global extremum",
"if",
"(",
"n",
"==",
"alpha_extreme",
".",
"length",
"-",
"1",
")",
... | Returns the type of the extremum at the specified alpha values.
@param n the index until the alpha values are computed
@param alpha_extreme the already computed alpha values
@param interval the hyper bounding box defining the interval in which the
extremum occurs
@return the type of the extremum at the specified alpha... | [
"Returns",
"the",
"type",
"of",
"the",
"extremum",
"at",
"the",
"specified",
"alpha",
"values",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/cash/ParameterizationFunction.java#L165-L228 | train |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/cash/ParameterizationFunction.java | ParameterizationFunction.determineAlphaMin | private double determineAlphaMin(int n, double[] alpha_min, HyperBoundingBox interval) {
double alpha_n = extremum_alpha_n(n, alpha_min);
double lower = interval.getMin(n);
double upper = interval.getMax(n);
double[] alpha_extreme = new double[alpha_min.length];
System.arraycopy(alpha_min, n, alpha... | java | private double determineAlphaMin(int n, double[] alpha_min, HyperBoundingBox interval) {
double alpha_n = extremum_alpha_n(n, alpha_min);
double lower = interval.getMin(n);
double upper = interval.getMax(n);
double[] alpha_extreme = new double[alpha_min.length];
System.arraycopy(alpha_min, n, alpha... | [
"private",
"double",
"determineAlphaMin",
"(",
"int",
"n",
",",
"double",
"[",
"]",
"alpha_min",
",",
"HyperBoundingBox",
"interval",
")",
"{",
"double",
"alpha_n",
"=",
"extremum_alpha_n",
"(",
"n",
",",
"alpha_min",
")",
";",
"double",
"lower",
"=",
"inter... | Determines the n-th alpha value where this function has a minimum in the
specified interval.
@param n the index of the alpha value to be determined
@param alpha_min the already computed alpha values
@param interval the hyper bounding box defining the interval
@return the n-th alpha value where this function has a mini... | [
"Determines",
"the",
"n",
"-",
"th",
"alpha",
"value",
"where",
"this",
"function",
"has",
"a",
"minimum",
"in",
"the",
"specified",
"interval",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/cash/ParameterizationFunction.java#L240-L291 | train |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/cash/ParameterizationFunction.java | ParameterizationFunction.sinusProduct | public static double sinusProduct(int start, int end, double[] alpha) {
double result = 1;
for(int j = start; j < end; j++) {
result *= FastMath.sin(alpha[j]);
}
return result;
} | java | public static double sinusProduct(int start, int end, double[] alpha) {
double result = 1;
for(int j = start; j < end; j++) {
result *= FastMath.sin(alpha[j]);
}
return result;
} | [
"public",
"static",
"double",
"sinusProduct",
"(",
"int",
"start",
",",
"int",
"end",
",",
"double",
"[",
"]",
"alpha",
")",
"{",
"double",
"result",
"=",
"1",
";",
"for",
"(",
"int",
"j",
"=",
"start",
";",
"j",
"<",
"end",
";",
"j",
"++",
")",
... | Computes the product of all sinus values of the specified angles from start
to end index.
@param start the index to start
@param end the index to end
@param alpha the array of angles
@return the product of all sinus values of the specified angles from start
to end index | [
"Computes",
"the",
"product",
"of",
"all",
"sinus",
"values",
"of",
"the",
"specified",
"angles",
"from",
"start",
"to",
"end",
"index",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/cash/ParameterizationFunction.java#L428-L434 | train |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/cash/ParameterizationFunction.java | ParameterizationFunction.determineGlobalExtremum | private void determineGlobalExtremum() {
alphaExtremum = new double[vec.getDimensionality() - 1];
for(int n = alphaExtremum.length - 1; n >= 0; n--) {
alphaExtremum[n] = extremum_alpha_n(n, alphaExtremum);
if(Double.isNaN(alphaExtremum[n])) {
throw new IllegalStateException("Houston, we have... | java | private void determineGlobalExtremum() {
alphaExtremum = new double[vec.getDimensionality() - 1];
for(int n = alphaExtremum.length - 1; n >= 0; n--) {
alphaExtremum[n] = extremum_alpha_n(n, alphaExtremum);
if(Double.isNaN(alphaExtremum[n])) {
throw new IllegalStateException("Houston, we have... | [
"private",
"void",
"determineGlobalExtremum",
"(",
")",
"{",
"alphaExtremum",
"=",
"new",
"double",
"[",
"vec",
".",
"getDimensionality",
"(",
")",
"-",
"1",
"]",
";",
"for",
"(",
"int",
"n",
"=",
"alphaExtremum",
".",
"length",
"-",
"1",
";",
"n",
">=... | Determines the global extremum of this parameterization function. | [
"Determines",
"the",
"global",
"extremum",
"of",
"this",
"parameterization",
"function",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/cash/ParameterizationFunction.java#L439-L449 | train |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/cash/ParameterizationFunction.java | ParameterizationFunction.determineGlobalExtremumType | private void determineGlobalExtremumType() {
final double f = function(alphaExtremum);
// create random alpha values
double[] alpha_1 = new double[alphaExtremum.length];
double[] alpha_2 = new double[alphaExtremum.length];
for(int i = 0; i < alphaExtremum.length; i++) {
alpha_1[i] = Math.rand... | java | private void determineGlobalExtremumType() {
final double f = function(alphaExtremum);
// create random alpha values
double[] alpha_1 = new double[alphaExtremum.length];
double[] alpha_2 = new double[alphaExtremum.length];
for(int i = 0; i < alphaExtremum.length; i++) {
alpha_1[i] = Math.rand... | [
"private",
"void",
"determineGlobalExtremumType",
"(",
")",
"{",
"final",
"double",
"f",
"=",
"function",
"(",
"alphaExtremum",
")",
";",
"// create random alpha values",
"double",
"[",
"]",
"alpha_1",
"=",
"new",
"double",
"[",
"alphaExtremum",
".",
"length",
"... | Determines the type of the global extremum. | [
"Determines",
"the",
"type",
"of",
"the",
"global",
"extremum",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/cash/ParameterizationFunction.java#L454-L481 | train |
elki-project/elki | elki-gui-minigui/src/main/java/de/lmu/ifi/dbs/elki/gui/multistep/panels/ParameterTabPanel.java | ParameterTabPanel.setParameters | public void setParameters(Parameterization config) {
TrackParameters track = new TrackParameters(config);
configureStep(track);
// update parameter table
{
parameterTable.setEnabled(false);
parameterTable.clear();
for(TrackedParameter pair : track.getAllParameters()) {
parame... | java | public void setParameters(Parameterization config) {
TrackParameters track = new TrackParameters(config);
configureStep(track);
// update parameter table
{
parameterTable.setEnabled(false);
parameterTable.clear();
for(TrackedParameter pair : track.getAllParameters()) {
parame... | [
"public",
"void",
"setParameters",
"(",
"Parameterization",
"config",
")",
"{",
"TrackParameters",
"track",
"=",
"new",
"TrackParameters",
"(",
"config",
")",
";",
"configureStep",
"(",
"track",
")",
";",
"// update parameter table",
"{",
"parameterTable",
".",
"s... | Do the actual setParameters invocation.
@param config Parameterization | [
"Do",
"the",
"actual",
"setParameters",
"invocation",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-gui-minigui/src/main/java/de/lmu/ifi/dbs/elki/gui/multistep/panels/ParameterTabPanel.java#L191-L212 | train |
elki-project/elki | elki-gui-minigui/src/main/java/de/lmu/ifi/dbs/elki/gui/multistep/panels/ParameterTabPanel.java | ParameterTabPanel.reportErrors | protected void reportErrors(Parameterization config) {
StringBuilder buf = new StringBuilder();
for(ParameterException e : config.getErrors()) {
if(e instanceof UnspecifiedParameterException) {
continue;
}
buf.append(e.getMessage()).append(FormatUtil.NEWLINE);
}
if(buf.length()... | java | protected void reportErrors(Parameterization config) {
StringBuilder buf = new StringBuilder();
for(ParameterException e : config.getErrors()) {
if(e instanceof UnspecifiedParameterException) {
continue;
}
buf.append(e.getMessage()).append(FormatUtil.NEWLINE);
}
if(buf.length()... | [
"protected",
"void",
"reportErrors",
"(",
"Parameterization",
"config",
")",
"{",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"ParameterException",
"e",
":",
"config",
".",
"getErrors",
"(",
")",
")",
"{",
"if",
"(",
"e"... | Report errors in a single error log record.
@param config Parameterization | [
"Report",
"errors",
"in",
"a",
"single",
"error",
"log",
"record",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-gui-minigui/src/main/java/de/lmu/ifi/dbs/elki/gui/multistep/panels/ParameterTabPanel.java#L228-L240 | train |
elki-project/elki | elki-gui-minigui/src/main/java/de/lmu/ifi/dbs/elki/gui/multistep/panels/ParameterTabPanel.java | ParameterTabPanel.canRun | public boolean canRun() {
Status status = getStatus();
return Status.STATUS_READY.equals(status) || Status.STATUS_COMPLETE.equals(status);
} | java | public boolean canRun() {
Status status = getStatus();
return Status.STATUS_READY.equals(status) || Status.STATUS_COMPLETE.equals(status);
} | [
"public",
"boolean",
"canRun",
"(",
")",
"{",
"Status",
"status",
"=",
"getStatus",
"(",
")",
";",
"return",
"Status",
".",
"STATUS_READY",
".",
"equals",
"(",
"status",
")",
"||",
"Status",
".",
"STATUS_COMPLETE",
".",
"equals",
"(",
"status",
")",
";",... | Test if this tab is ready-to-run
@return can-run status | [
"Test",
"if",
"this",
"tab",
"is",
"ready",
"-",
"to",
"-",
"run"
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-gui-minigui/src/main/java/de/lmu/ifi/dbs/elki/gui/multistep/panels/ParameterTabPanel.java#L294-L297 | train |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java | SVGPath.lineTo | public SVGPath lineTo(double x, double y) {
return append(PATH_LINE_TO).append(x).append(y);
} | java | public SVGPath lineTo(double x, double y) {
return append(PATH_LINE_TO).append(x).append(y);
} | [
"public",
"SVGPath",
"lineTo",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"return",
"append",
"(",
"PATH_LINE_TO",
")",
".",
"append",
"(",
"x",
")",
".",
"append",
"(",
"y",
")",
";",
"}"
] | Draw a line to the given coordinates.
@param x new coordinates
@param y new coordinates
@return path object, for compact syntax. | [
"Draw",
"a",
"line",
"to",
"the",
"given",
"coordinates",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java#L229-L231 | train |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java | SVGPath.relativeLineTo | public SVGPath relativeLineTo(double x, double y) {
return append(PATH_LINE_TO_RELATIVE).append(x).append(y);
} | java | public SVGPath relativeLineTo(double x, double y) {
return append(PATH_LINE_TO_RELATIVE).append(x).append(y);
} | [
"public",
"SVGPath",
"relativeLineTo",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"return",
"append",
"(",
"PATH_LINE_TO_RELATIVE",
")",
".",
"append",
"(",
"x",
")",
".",
"append",
"(",
"y",
")",
";",
"}"
] | Draw a line to the given relative coordinates.
@param x relative coordinates
@param y relative coordinates
@return path object, for compact syntax. | [
"Draw",
"a",
"line",
"to",
"the",
"given",
"relative",
"coordinates",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java#L250-L252 | train |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java | SVGPath.moveTo | public SVGPath moveTo(double x, double y) {
return append(PATH_MOVE).append(x).append(y);
} | java | public SVGPath moveTo(double x, double y) {
return append(PATH_MOVE).append(x).append(y);
} | [
"public",
"SVGPath",
"moveTo",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"return",
"append",
"(",
"PATH_MOVE",
")",
".",
"append",
"(",
"x",
")",
".",
"append",
"(",
"y",
")",
";",
"}"
] | Move to the given coordinates.
@param x new coordinates
@param y new coordinates
@return path object, for compact syntax. | [
"Move",
"to",
"the",
"given",
"coordinates",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java#L311-L313 | train |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java | SVGPath.relativeMoveTo | public SVGPath relativeMoveTo(double x, double y) {
return append(PATH_MOVE_RELATIVE).append(x).append(y);
} | java | public SVGPath relativeMoveTo(double x, double y) {
return append(PATH_MOVE_RELATIVE).append(x).append(y);
} | [
"public",
"SVGPath",
"relativeMoveTo",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"return",
"append",
"(",
"PATH_MOVE_RELATIVE",
")",
".",
"append",
"(",
"x",
")",
".",
"append",
"(",
"y",
")",
";",
"}"
] | Move to the given relative coordinates.
@param x new coordinates
@param y new coordinates
@return path object, for compact syntax. | [
"Move",
"to",
"the",
"given",
"relative",
"coordinates",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java#L332-L334 | train |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java | SVGPath.smoothQuadTo | public SVGPath smoothQuadTo(double x, double y) {
return append(PATH_SMOOTH_QUAD_TO).append(x).append(y);
} | java | public SVGPath smoothQuadTo(double x, double y) {
return append(PATH_SMOOTH_QUAD_TO).append(x).append(y);
} | [
"public",
"SVGPath",
"smoothQuadTo",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"return",
"append",
"(",
"PATH_SMOOTH_QUAD_TO",
")",
".",
"append",
"(",
"x",
")",
".",
"append",
"(",
"y",
")",
";",
"}"
] | Smooth quadratic Bezier line to the given coordinates.
@param x new coordinates
@param y new coordinates
@return path object, for compact syntax. | [
"Smooth",
"quadratic",
"Bezier",
"line",
"to",
"the",
"given",
"coordinates",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java#L503-L505 | train |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java | SVGPath.relativeSmoothQuadTo | public SVGPath relativeSmoothQuadTo(double x, double y) {
return append(PATH_SMOOTH_QUAD_TO_RELATIVE).append(x).append(y);
} | java | public SVGPath relativeSmoothQuadTo(double x, double y) {
return append(PATH_SMOOTH_QUAD_TO_RELATIVE).append(x).append(y);
} | [
"public",
"SVGPath",
"relativeSmoothQuadTo",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"return",
"append",
"(",
"PATH_SMOOTH_QUAD_TO_RELATIVE",
")",
".",
"append",
"(",
"x",
")",
".",
"append",
"(",
"y",
")",
";",
"}"
] | Smooth quadratic Bezier line to the given relative coordinates.
@param x new coordinates
@param y new coordinates
@return path object, for compact syntax. | [
"Smooth",
"quadratic",
"Bezier",
"line",
"to",
"the",
"given",
"relative",
"coordinates",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java#L524-L526 | train |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java | SVGPath.append | private SVGPath append(char action) {
assert lastaction != 0 || action == PATH_MOVE : "Paths must begin with a move to the initial position!";
if(lastaction != action) {
buf.append(action);
lastaction = action;
}
return this;
} | java | private SVGPath append(char action) {
assert lastaction != 0 || action == PATH_MOVE : "Paths must begin with a move to the initial position!";
if(lastaction != action) {
buf.append(action);
lastaction = action;
}
return this;
} | [
"private",
"SVGPath",
"append",
"(",
"char",
"action",
")",
"{",
"assert",
"lastaction",
"!=",
"0",
"||",
"action",
"==",
"PATH_MOVE",
":",
"\"Paths must begin with a move to the initial position!\"",
";",
"if",
"(",
"lastaction",
"!=",
"action",
")",
"{",
"buf",
... | Append an action to the current path.
@param action Current action | [
"Append",
"an",
"action",
"to",
"the",
"current",
"path",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java#L627-L634 | train |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java | SVGPath.append | private SVGPath append(double x) {
if(!Double.isFinite(x)) {
throw new IllegalArgumentException("Cannot draw an infinite/NaN position.");
}
if(x >= 0) {
final int l = buf.length();
if(l > 0) {
char c = buf.charAt(l - 1);
assert c != 'e' && c != 'E' : "Invalid exponential in... | java | private SVGPath append(double x) {
if(!Double.isFinite(x)) {
throw new IllegalArgumentException("Cannot draw an infinite/NaN position.");
}
if(x >= 0) {
final int l = buf.length();
if(l > 0) {
char c = buf.charAt(l - 1);
assert c != 'e' && c != 'E' : "Invalid exponential in... | [
"private",
"SVGPath",
"append",
"(",
"double",
"x",
")",
"{",
"if",
"(",
"!",
"Double",
".",
"isFinite",
"(",
"x",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Cannot draw an infinite/NaN position.\"",
")",
";",
"}",
"if",
"(",
"x",
"... | Append a value to the current path.
@param x coordinate. | [
"Append",
"a",
"value",
"to",
"the",
"current",
"path",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java#L641-L656 | train |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java | SVGPath.close | public SVGPath close() {
assert lastaction != 0 : "Paths must begin with a move to the initial position!";
if(lastaction != PATH_CLOSE) {
buf.append(' ').append(PATH_CLOSE);
lastaction = PATH_CLOSE;
}
return this;
} | java | public SVGPath close() {
assert lastaction != 0 : "Paths must begin with a move to the initial position!";
if(lastaction != PATH_CLOSE) {
buf.append(' ').append(PATH_CLOSE);
lastaction = PATH_CLOSE;
}
return this;
} | [
"public",
"SVGPath",
"close",
"(",
")",
"{",
"assert",
"lastaction",
"!=",
"0",
":",
"\"Paths must begin with a move to the initial position!\"",
";",
"if",
"(",
"lastaction",
"!=",
"PATH_CLOSE",
")",
"{",
"buf",
".",
"append",
"(",
"'",
"'",
")",
".",
"append... | Close the path.
@return path object, for compact syntax. | [
"Close",
"the",
"path",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java#L663-L670 | train |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java | SVGPath.makeElement | public Element makeElement(SVGPlot plot) {
Element elem = plot.svgElement(SVGConstants.SVG_PATH_TAG);
elem.setAttribute(SVGConstants.SVG_D_ATTRIBUTE, buf.toString());
return elem;
} | java | public Element makeElement(SVGPlot plot) {
Element elem = plot.svgElement(SVGConstants.SVG_PATH_TAG);
elem.setAttribute(SVGConstants.SVG_D_ATTRIBUTE, buf.toString());
return elem;
} | [
"public",
"Element",
"makeElement",
"(",
"SVGPlot",
"plot",
")",
"{",
"Element",
"elem",
"=",
"plot",
".",
"svgElement",
"(",
"SVGConstants",
".",
"SVG_PATH_TAG",
")",
";",
"elem",
".",
"setAttribute",
"(",
"SVGConstants",
".",
"SVG_D_ATTRIBUTE",
",",
"buf",
... | Turn the path buffer into an SVG element.
@param plot Plot context (= element factory)
@return SVG Element | [
"Turn",
"the",
"path",
"buffer",
"into",
"an",
"SVG",
"element",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java#L678-L682 | train |
elki-project/elki | elki-gui-minigui/src/main/java/de/lmu/ifi/dbs/elki/gui/multistep/MultiStepGUI.java | MultiStepGUI.setParameters | public void setParameters(Parameterization config) {
// Clear errors after each step, so they don't consider themselves failed
// because of earlier errors.
logTab.setParameters(config);
// config.clearErrors();
inputTab.setParameters(config);
// config.clearErrors();
algTab.setParameters(co... | java | public void setParameters(Parameterization config) {
// Clear errors after each step, so they don't consider themselves failed
// because of earlier errors.
logTab.setParameters(config);
// config.clearErrors();
inputTab.setParameters(config);
// config.clearErrors();
algTab.setParameters(co... | [
"public",
"void",
"setParameters",
"(",
"Parameterization",
"config",
")",
"{",
"// Clear errors after each step, so they don't consider themselves failed",
"// because of earlier errors.",
"logTab",
".",
"setParameters",
"(",
"config",
")",
";",
"// config.clearErrors();",
"inpu... | Set the parameters.
@param config Parameterization | [
"Set",
"the",
"parameters",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-gui-minigui/src/main/java/de/lmu/ifi/dbs/elki/gui/multistep/MultiStepGUI.java#L203-L216 | train |
elki-project/elki | elki-gui-minigui/src/main/java/de/lmu/ifi/dbs/elki/gui/multistep/MultiStepGUI.java | MultiStepGUI.serializeParameters | public ArrayList<String> serializeParameters() {
ListParameterization params = new ListParameterization();
logTab.appendParameters(params);
inputTab.appendParameters(params);
algTab.appendParameters(params);
evalTab.appendParameters(params);
outTab.appendParameters(params);
return params.ser... | java | public ArrayList<String> serializeParameters() {
ListParameterization params = new ListParameterization();
logTab.appendParameters(params);
inputTab.appendParameters(params);
algTab.appendParameters(params);
evalTab.appendParameters(params);
outTab.appendParameters(params);
return params.ser... | [
"public",
"ArrayList",
"<",
"String",
">",
"serializeParameters",
"(",
")",
"{",
"ListParameterization",
"params",
"=",
"new",
"ListParameterization",
"(",
")",
";",
"logTab",
".",
"appendParameters",
"(",
"params",
")",
";",
"inputTab",
".",
"appendParameters",
... | Get the serialized parameters
@return Serialized parameters | [
"Get",
"the",
"serialized",
"parameters"
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-gui-minigui/src/main/java/de/lmu/ifi/dbs/elki/gui/multistep/MultiStepGUI.java#L223-L231 | train |
elki-project/elki | elki-gui-minigui/src/main/java/de/lmu/ifi/dbs/elki/gui/multistep/MultiStepGUI.java | MultiStepGUI.main | public static void main(final String[] args) {
GUIUtil.logUncaughtExceptions(LOG);
GUIUtil.setLookAndFeel();
OutputStep.setDefaultHandlerVisualizer();
javax.swing.SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
try {
final MultiStepGUI gui = new M... | java | public static void main(final String[] args) {
GUIUtil.logUncaughtExceptions(LOG);
GUIUtil.setLookAndFeel();
OutputStep.setDefaultHandlerVisualizer();
javax.swing.SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
try {
final MultiStepGUI gui = new M... | [
"public",
"static",
"void",
"main",
"(",
"final",
"String",
"[",
"]",
"args",
")",
"{",
"GUIUtil",
".",
"logUncaughtExceptions",
"(",
"LOG",
")",
";",
"GUIUtil",
".",
"setLookAndFeel",
"(",
")",
";",
"OutputStep",
".",
"setDefaultHandlerVisualizer",
"(",
")"... | Main method that just spawns the UI.
@param args command line parameters | [
"Main",
"method",
"that",
"just",
"spawns",
"the",
"UI",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-gui-minigui/src/main/java/de/lmu/ifi/dbs/elki/gui/multistep/MultiStepGUI.java#L244-L269 | train |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/statistics/EvaluateRetrievalPerformance.java | EvaluateRetrievalPerformance.match | protected static boolean match(Object ref, Object test) {
if(ref == null) {
return false;
}
// Cheap and fast, may hold for class labels!
if(ref == test) {
return true;
}
if(ref instanceof LabelList && test instanceof LabelList) {
final LabelList lref = (LabelList) ref;
f... | java | protected static boolean match(Object ref, Object test) {
if(ref == null) {
return false;
}
// Cheap and fast, may hold for class labels!
if(ref == test) {
return true;
}
if(ref instanceof LabelList && test instanceof LabelList) {
final LabelList lref = (LabelList) ref;
f... | [
"protected",
"static",
"boolean",
"match",
"(",
"Object",
"ref",
",",
"Object",
"test",
")",
"{",
"if",
"(",
"ref",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"// Cheap and fast, may hold for class labels!",
"if",
"(",
"ref",
"==",
"test",
")",
"... | Test whether two relation agree.
@param ref Reference object
@param test Test object
@return {@code true} if the objects match | [
"Test",
"whether",
"two",
"relation",
"agree",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/statistics/EvaluateRetrievalPerformance.java#L189-L218 | train |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/statistics/EvaluateRetrievalPerformance.java | EvaluateRetrievalPerformance.findMatches | private void findMatches(ModifiableDBIDs posn, Relation<?> lrelation, Object label) {
posn.clear();
for(DBIDIter ri = lrelation.iterDBIDs(); ri.valid(); ri.advance()) {
if(match(label, lrelation.get(ri))) {
posn.add(ri);
}
}
} | java | private void findMatches(ModifiableDBIDs posn, Relation<?> lrelation, Object label) {
posn.clear();
for(DBIDIter ri = lrelation.iterDBIDs(); ri.valid(); ri.advance()) {
if(match(label, lrelation.get(ri))) {
posn.add(ri);
}
}
} | [
"private",
"void",
"findMatches",
"(",
"ModifiableDBIDs",
"posn",
",",
"Relation",
"<",
"?",
">",
"lrelation",
",",
"Object",
"label",
")",
"{",
"posn",
".",
"clear",
"(",
")",
";",
"for",
"(",
"DBIDIter",
"ri",
"=",
"lrelation",
".",
"iterDBIDs",
"(",
... | Find all matching objects.
@param posn Output set.
@param lrelation Label relation
@param label Query object label | [
"Find",
"all",
"matching",
"objects",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/statistics/EvaluateRetrievalPerformance.java#L227-L234 | train |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/statistics/EvaluateRetrievalPerformance.java | EvaluateRetrievalPerformance.computeDistances | private void computeDistances(ModifiableDoubleDBIDList nlist, DBIDIter query, final DistanceQuery<O> distQuery, Relation<O> relation) {
nlist.clear();
O qo = relation.get(query);
for(DBIDIter ri = relation.iterDBIDs(); ri.valid(); ri.advance()) {
if(!includeSelf && DBIDUtil.equal(ri, query)) {
... | java | private void computeDistances(ModifiableDoubleDBIDList nlist, DBIDIter query, final DistanceQuery<O> distQuery, Relation<O> relation) {
nlist.clear();
O qo = relation.get(query);
for(DBIDIter ri = relation.iterDBIDs(); ri.valid(); ri.advance()) {
if(!includeSelf && DBIDUtil.equal(ri, query)) {
... | [
"private",
"void",
"computeDistances",
"(",
"ModifiableDoubleDBIDList",
"nlist",
",",
"DBIDIter",
"query",
",",
"final",
"DistanceQuery",
"<",
"O",
">",
"distQuery",
",",
"Relation",
"<",
"O",
">",
"relation",
")",
"{",
"nlist",
".",
"clear",
"(",
")",
";",
... | Compute the distances to the neighbor objects.
@param nlist Neighbor list (output)
@param query Query object
@param distQuery Distance function
@param relation Data relation | [
"Compute",
"the",
"distances",
"to",
"the",
"neighbor",
"objects",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/statistics/EvaluateRetrievalPerformance.java#L244-L258 | train |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/result/textwriter/MultipleFilesOutput.java | MultipleFilesOutput.newStream | private PrintStream newStream(String name) throws IOException {
if(LOG.isDebuggingFiner()) {
LOG.debugFiner("Requested stream: " + name);
}
// Ensure the directory exists:
if(!basename.exists()) {
basename.mkdirs();
}
String fn = basename.getAbsolutePath() + File.separator + name + E... | java | private PrintStream newStream(String name) throws IOException {
if(LOG.isDebuggingFiner()) {
LOG.debugFiner("Requested stream: " + name);
}
// Ensure the directory exists:
if(!basename.exists()) {
basename.mkdirs();
}
String fn = basename.getAbsolutePath() + File.separator + name + E... | [
"private",
"PrintStream",
"newStream",
"(",
"String",
"name",
")",
"throws",
"IOException",
"{",
"if",
"(",
"LOG",
".",
"isDebuggingFiner",
"(",
")",
")",
"{",
"LOG",
".",
"debugFiner",
"(",
"\"Requested stream: \"",
"+",
"name",
")",
";",
"}",
"// Ensure th... | Open a new stream of the given name
@param name file name (which will be appended to the base name)
@return stream object for the given name
@throws IOException | [
"Open",
"a",
"new",
"stream",
"of",
"the",
"given",
"name"
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/result/textwriter/MultipleFilesOutput.java#L91-L112 | train |
elki-project/elki | elki-index/src/main/java/de/lmu/ifi/dbs/elki/index/PagedIndexFactory.java | PagedIndexFactory.makePageFile | protected <N extends Page & Externalizable> PageFile<N> makePageFile(Class<N> cls) {
@SuppressWarnings("unchecked")
final PageFileFactory<N> castFactory = (PageFileFactory<N>) pageFileFactory;
return castFactory.newPageFile(cls);
} | java | protected <N extends Page & Externalizable> PageFile<N> makePageFile(Class<N> cls) {
@SuppressWarnings("unchecked")
final PageFileFactory<N> castFactory = (PageFileFactory<N>) pageFileFactory;
return castFactory.newPageFile(cls);
} | [
"protected",
"<",
"N",
"extends",
"Page",
"&",
"Externalizable",
">",
"PageFile",
"<",
"N",
">",
"makePageFile",
"(",
"Class",
"<",
"N",
">",
"cls",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"final",
"PageFileFactory",
"<",
"N",
">",
... | Make the page file for this index.
@param <N>
page type
@param cls
Class information
@return Page file | [
"Make",
"the",
"page",
"file",
"for",
"this",
"index",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index/src/main/java/de/lmu/ifi/dbs/elki/index/PagedIndexFactory.java#L71-L75 | train |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/visualizers/scatterplot/selection/DistanceFunctionVisualization.java | DistanceFunctionVisualization.isAngularDistance | public static boolean isAngularDistance(AbstractMaterializeKNNPreprocessor<?> kNN) {
DistanceFunction<?> distanceFunction = kNN.getDistanceQuery().getDistanceFunction();
return CosineDistanceFunction.class.isInstance(distanceFunction) //
|| ArcCosineDistanceFunction.class.isInstance(distanceFunction);
... | java | public static boolean isAngularDistance(AbstractMaterializeKNNPreprocessor<?> kNN) {
DistanceFunction<?> distanceFunction = kNN.getDistanceQuery().getDistanceFunction();
return CosineDistanceFunction.class.isInstance(distanceFunction) //
|| ArcCosineDistanceFunction.class.isInstance(distanceFunction);
... | [
"public",
"static",
"boolean",
"isAngularDistance",
"(",
"AbstractMaterializeKNNPreprocessor",
"<",
"?",
">",
"kNN",
")",
"{",
"DistanceFunction",
"<",
"?",
">",
"distanceFunction",
"=",
"kNN",
".",
"getDistanceQuery",
"(",
")",
".",
"getDistanceFunction",
"(",
")... | Test whether the given preprocessor used an angular distance function
@param kNN kNN preprocessor
@return true when angular | [
"Test",
"whether",
"the",
"given",
"preprocessor",
"used",
"an",
"angular",
"distance",
"function"
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/visualizers/scatterplot/selection/DistanceFunctionVisualization.java#L131-L135 | train |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/visualizers/scatterplot/selection/DistanceFunctionVisualization.java | DistanceFunctionVisualization.drawCosine | public static Element drawCosine(SVGPlot svgp, Projection2D proj, NumberVector mid, double angle) {
// Project origin
double[] pointOfOrigin = proj.fastProjectDataToRenderSpace(new double[proj.getInputDimensionality()]);
// direction of the selected Point
double[] selPoint = proj.fastProjectDataToRende... | java | public static Element drawCosine(SVGPlot svgp, Projection2D proj, NumberVector mid, double angle) {
// Project origin
double[] pointOfOrigin = proj.fastProjectDataToRenderSpace(new double[proj.getInputDimensionality()]);
// direction of the selected Point
double[] selPoint = proj.fastProjectDataToRende... | [
"public",
"static",
"Element",
"drawCosine",
"(",
"SVGPlot",
"svgp",
",",
"Projection2D",
"proj",
",",
"NumberVector",
"mid",
",",
"double",
"angle",
")",
"{",
"// Project origin",
"double",
"[",
"]",
"pointOfOrigin",
"=",
"proj",
".",
"fastProjectDataToRenderSpac... | Visualizes Cosine and ArcCosine distance functions
@param svgp SVG Plot
@param proj Visualization projection
@param mid mean vector
@param angle Opening angle in radians
@return path element | [
"Visualizes",
"Cosine",
"and",
"ArcCosine",
"distance",
"functions"
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/visualizers/scatterplot/selection/DistanceFunctionVisualization.java#L146-L200 | train |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/index/preprocessed/fastoptics/RandomProjectedNeighborsAndDensities.java | RandomProjectedNeighborsAndDensities.splitupNoSort | public void splitupNoSort(ArrayModifiableDBIDs ind, int begin, int end, int dim, Random rand) {
final int nele = end - begin;
dim = dim % projectedPoints.length;// choose a projection of points
DoubleDataStore tpro = projectedPoints[dim];
// save set such that used for density or neighborhood computati... | java | public void splitupNoSort(ArrayModifiableDBIDs ind, int begin, int end, int dim, Random rand) {
final int nele = end - begin;
dim = dim % projectedPoints.length;// choose a projection of points
DoubleDataStore tpro = projectedPoints[dim];
// save set such that used for density or neighborhood computati... | [
"public",
"void",
"splitupNoSort",
"(",
"ArrayModifiableDBIDs",
"ind",
",",
"int",
"begin",
",",
"int",
"end",
",",
"int",
"dim",
",",
"Random",
"rand",
")",
"{",
"final",
"int",
"nele",
"=",
"end",
"-",
"begin",
";",
"dim",
"=",
"dim",
"%",
"projected... | Recursively splits entire point set until the set is below a threshold
@param ind points that are in the current set
@param begin Interval begin in the ind array
@param end Interval end in the ind array
@param dim depth of projection (how many times point set has been split
already)
@param rand Random generator | [
"Recursively",
"splits",
"entire",
"point",
"set",
"until",
"the",
"set",
"is",
"below",
"a",
"threshold"
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/index/preprocessed/fastoptics/RandomProjectedNeighborsAndDensities.java#L246-L276 | train |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/index/preprocessed/fastoptics/RandomProjectedNeighborsAndDensities.java | RandomProjectedNeighborsAndDensities.splitRandomly | public int splitRandomly(ArrayModifiableDBIDs ind, int begin, int end, DoubleDataStore tpro, Random rand) {
final int nele = end - begin;
DBIDArrayIter it = ind.iter();
// pick random splitting element based on position
double rs = tpro.doubleValue(it.seek(begin + rand.nextInt(nele)));
int minInd = ... | java | public int splitRandomly(ArrayModifiableDBIDs ind, int begin, int end, DoubleDataStore tpro, Random rand) {
final int nele = end - begin;
DBIDArrayIter it = ind.iter();
// pick random splitting element based on position
double rs = tpro.doubleValue(it.seek(begin + rand.nextInt(nele)));
int minInd = ... | [
"public",
"int",
"splitRandomly",
"(",
"ArrayModifiableDBIDs",
"ind",
",",
"int",
"begin",
",",
"int",
"end",
",",
"DoubleDataStore",
"tpro",
",",
"Random",
"rand",
")",
"{",
"final",
"int",
"nele",
"=",
"end",
"-",
"begin",
";",
"DBIDArrayIter",
"it",
"="... | Split the data set randomly.
@param ind Object index
@param begin Interval begin
@param end Interval end
@param tpro Projection
@param rand Random generator
@return Splitting point | [
"Split",
"the",
"data",
"set",
"randomly",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/index/preprocessed/fastoptics/RandomProjectedNeighborsAndDensities.java#L288-L315 | train |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/index/preprocessed/fastoptics/RandomProjectedNeighborsAndDensities.java | RandomProjectedNeighborsAndDensities.splitByDistance | public int splitByDistance(ArrayModifiableDBIDs ind, int begin, int end, DoubleDataStore tpro, Random rand) {
DBIDArrayIter it = ind.iter();
// pick random splitting point based on distance
double rmin = Double.MAX_VALUE * .5, rmax = -Double.MAX_VALUE * .5;
int minInd = begin, maxInd = end - 1;
for(... | java | public int splitByDistance(ArrayModifiableDBIDs ind, int begin, int end, DoubleDataStore tpro, Random rand) {
DBIDArrayIter it = ind.iter();
// pick random splitting point based on distance
double rmin = Double.MAX_VALUE * .5, rmax = -Double.MAX_VALUE * .5;
int minInd = begin, maxInd = end - 1;
for(... | [
"public",
"int",
"splitByDistance",
"(",
"ArrayModifiableDBIDs",
"ind",
",",
"int",
"begin",
",",
"int",
"end",
",",
"DoubleDataStore",
"tpro",
",",
"Random",
"rand",
")",
"{",
"DBIDArrayIter",
"it",
"=",
"ind",
".",
"iter",
"(",
")",
";",
"// pick random sp... | Split the data set by distances.
@param ind Object index
@param begin Interval begin
@param end Interval end
@param tpro Projection
@param rand Random generator
@return Splitting point | [
"Split",
"the",
"data",
"set",
"by",
"distances",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/index/preprocessed/fastoptics/RandomProjectedNeighborsAndDensities.java#L327-L363 | train |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/index/preprocessed/fastoptics/RandomProjectedNeighborsAndDensities.java | RandomProjectedNeighborsAndDensities.getNeighs | public DataStore<? extends DBIDs> getNeighs() {
final DBIDs ids = points.getDBIDs();
// init lists
WritableDataStore<ModifiableDBIDs> neighs = DataStoreUtil.makeStorage(ids, DataStoreFactory.HINT_HOT, ModifiableDBIDs.class);
for(DBIDIter it = ids.iter(); it.valid(); it.advance()) {
neighs.put(it, ... | java | public DataStore<? extends DBIDs> getNeighs() {
final DBIDs ids = points.getDBIDs();
// init lists
WritableDataStore<ModifiableDBIDs> neighs = DataStoreUtil.makeStorage(ids, DataStoreFactory.HINT_HOT, ModifiableDBIDs.class);
for(DBIDIter it = ids.iter(); it.valid(); it.advance()) {
neighs.put(it, ... | [
"public",
"DataStore",
"<",
"?",
"extends",
"DBIDs",
">",
"getNeighs",
"(",
")",
"{",
"final",
"DBIDs",
"ids",
"=",
"points",
".",
"getDBIDs",
"(",
")",
";",
"// init lists",
"WritableDataStore",
"<",
"ModifiableDBIDs",
">",
"neighs",
"=",
"DataStoreUtil",
"... | Compute list of neighbors for each point from sets resulting from
projection
@return list of neighbors for each point | [
"Compute",
"list",
"of",
"neighbors",
"for",
"each",
"point",
"from",
"sets",
"resulting",
"from",
"projection"
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/index/preprocessed/fastoptics/RandomProjectedNeighborsAndDensities.java#L371-L399 | train |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/index/preprocessed/fastoptics/RandomProjectedNeighborsAndDensities.java | RandomProjectedNeighborsAndDensities.computeAverageDistInSet | public DoubleDataStore computeAverageDistInSet() {
WritableDoubleDataStore davg = DataStoreUtil.makeDoubleStorage(points.getDBIDs(), DataStoreFactory.HINT_HOT);
WritableIntegerDataStore nDists = DataStoreUtil.makeIntegerStorage(points.getDBIDs(), DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_TEMP);
Fini... | java | public DoubleDataStore computeAverageDistInSet() {
WritableDoubleDataStore davg = DataStoreUtil.makeDoubleStorage(points.getDBIDs(), DataStoreFactory.HINT_HOT);
WritableIntegerDataStore nDists = DataStoreUtil.makeIntegerStorage(points.getDBIDs(), DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_TEMP);
Fini... | [
"public",
"DoubleDataStore",
"computeAverageDistInSet",
"(",
")",
"{",
"WritableDoubleDataStore",
"davg",
"=",
"DataStoreUtil",
".",
"makeDoubleStorage",
"(",
"points",
".",
"getDBIDs",
"(",
")",
",",
"DataStoreFactory",
".",
"HINT_HOT",
")",
";",
"WritableIntegerData... | Compute for each point a density estimate as inverse of average distance to
a point in a projected set
@return for each point average distance to point in a set | [
"Compute",
"for",
"each",
"point",
"a",
"density",
"estimate",
"as",
"inverse",
"of",
"average",
"distance",
"to",
"a",
"point",
"in",
"a",
"projected",
"set"
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/index/preprocessed/fastoptics/RandomProjectedNeighborsAndDensities.java#L407-L442 | train |
elki-project/elki | elki-itemsets/src/main/java/de/lmu/ifi/dbs/elki/algorithm/itemsetmining/Itemset.java | Itemset.containedIn | public boolean containedIn(SparseNumberVector bv) {
int i1 = this.iter(), i2 = bv.iter();
while(this.iterValid(i1)) {
if(!bv.iterValid(i2)) {
return false;
}
int d1 = this.iterDim(i1), d2 = bv.iterDim(i2);
if(d1 < d2) {
return false; // Missing
}
if(d1 == d2) ... | java | public boolean containedIn(SparseNumberVector bv) {
int i1 = this.iter(), i2 = bv.iter();
while(this.iterValid(i1)) {
if(!bv.iterValid(i2)) {
return false;
}
int d1 = this.iterDim(i1), d2 = bv.iterDim(i2);
if(d1 < d2) {
return false; // Missing
}
if(d1 == d2) ... | [
"public",
"boolean",
"containedIn",
"(",
"SparseNumberVector",
"bv",
")",
"{",
"int",
"i1",
"=",
"this",
".",
"iter",
"(",
")",
",",
"i2",
"=",
"bv",
".",
"iter",
"(",
")",
";",
"while",
"(",
"this",
".",
"iterValid",
"(",
"i1",
")",
")",
"{",
"i... | Test whether the itemset is contained in a bit vector.
@param bv Bit vector
@return {@code true} when the itemset is contained in this vector. | [
"Test",
"whether",
"the",
"itemset",
"is",
"contained",
"in",
"a",
"bit",
"vector",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-itemsets/src/main/java/de/lmu/ifi/dbs/elki/algorithm/itemsetmining/Itemset.java#L65-L84 | train |
elki-project/elki | elki-itemsets/src/main/java/de/lmu/ifi/dbs/elki/algorithm/itemsetmining/Itemset.java | Itemset.toBitset | public static long[] toBitset(Itemset i, long[] bits) {
for(int it = i.iter(); i.iterValid(it); it = i.iterAdvance(it)) {
BitsUtil.setI(bits, i.iterDim(it));
}
return bits;
} | java | public static long[] toBitset(Itemset i, long[] bits) {
for(int it = i.iter(); i.iterValid(it); it = i.iterAdvance(it)) {
BitsUtil.setI(bits, i.iterDim(it));
}
return bits;
} | [
"public",
"static",
"long",
"[",
"]",
"toBitset",
"(",
"Itemset",
"i",
",",
"long",
"[",
"]",
"bits",
")",
"{",
"for",
"(",
"int",
"it",
"=",
"i",
".",
"iter",
"(",
")",
";",
"i",
".",
"iterValid",
"(",
"it",
")",
";",
"it",
"=",
"i",
".",
... | Get the items.
@param i Itemset
@param bits Output bitset (must be zeros)
@return Output bitset | [
"Get",
"the",
"items",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-itemsets/src/main/java/de/lmu/ifi/dbs/elki/algorithm/itemsetmining/Itemset.java#L100-L105 | train |
elki-project/elki | elki-itemsets/src/main/java/de/lmu/ifi/dbs/elki/algorithm/itemsetmining/Itemset.java | Itemset.compareLexicographical | protected static int compareLexicographical(Itemset a, Itemset o) {
int i1 = a.iter(), i2 = o.iter();
while(a.iterValid(i1) && o.iterValid(i2)) {
int v1 = a.iterDim(i1), v2 = o.iterDim(i2);
if(v1 < v2) {
return -1;
}
if(v2 < v1) {
return +1;
}
i1 = a.iterAdvan... | java | protected static int compareLexicographical(Itemset a, Itemset o) {
int i1 = a.iter(), i2 = o.iter();
while(a.iterValid(i1) && o.iterValid(i2)) {
int v1 = a.iterDim(i1), v2 = o.iterDim(i2);
if(v1 < v2) {
return -1;
}
if(v2 < v1) {
return +1;
}
i1 = a.iterAdvan... | [
"protected",
"static",
"int",
"compareLexicographical",
"(",
"Itemset",
"a",
",",
"Itemset",
"o",
")",
"{",
"int",
"i1",
"=",
"a",
".",
"iter",
"(",
")",
",",
"i2",
"=",
"o",
".",
"iter",
"(",
")",
";",
"while",
"(",
"a",
".",
"iterValid",
"(",
"... | Robust compare using the iterators, lexicographical only!
Note: This does NOT take length into account.
@param o Other itemset.
@return Comparison result. | [
"Robust",
"compare",
"using",
"the",
"iterators",
"lexicographical",
"only!"
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-itemsets/src/main/java/de/lmu/ifi/dbs/elki/algorithm/itemsetmining/Itemset.java#L195-L209 | train |
elki-project/elki | elki-itemsets/src/main/java/de/lmu/ifi/dbs/elki/algorithm/itemsetmining/Itemset.java | Itemset.appendTo | public final StringBuilder appendTo(StringBuilder buf, VectorFieldTypeInformation<BitVector> meta) {
appendItemsTo(buf, meta);
return buf.append(": ").append(support);
} | java | public final StringBuilder appendTo(StringBuilder buf, VectorFieldTypeInformation<BitVector> meta) {
appendItemsTo(buf, meta);
return buf.append(": ").append(support);
} | [
"public",
"final",
"StringBuilder",
"appendTo",
"(",
"StringBuilder",
"buf",
",",
"VectorFieldTypeInformation",
"<",
"BitVector",
">",
"meta",
")",
"{",
"appendItemsTo",
"(",
"buf",
",",
"meta",
")",
";",
"return",
"buf",
".",
"append",
"(",
"\": \"",
")",
"... | Append items and support to a string buffer.
@param buf Buffer
@param meta Relation metadata (for labels)
@return String buffer for chaining. | [
"Append",
"items",
"and",
"support",
"to",
"a",
"string",
"buffer",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-itemsets/src/main/java/de/lmu/ifi/dbs/elki/algorithm/itemsetmining/Itemset.java#L223-L226 | train |
elki-project/elki | elki-itemsets/src/main/java/de/lmu/ifi/dbs/elki/algorithm/itemsetmining/Itemset.java | Itemset.appendItemsTo | public StringBuilder appendItemsTo(StringBuilder buf, VectorFieldTypeInformation<BitVector> meta) {
int it = this.iter();
if(this.iterValid(it)) {
while(true) {
int v = this.iterDim(it);
String lbl = (meta != null) ? meta.getLabel(v) : null;
if(lbl == null) {
buf.append(v... | java | public StringBuilder appendItemsTo(StringBuilder buf, VectorFieldTypeInformation<BitVector> meta) {
int it = this.iter();
if(this.iterValid(it)) {
while(true) {
int v = this.iterDim(it);
String lbl = (meta != null) ? meta.getLabel(v) : null;
if(lbl == null) {
buf.append(v... | [
"public",
"StringBuilder",
"appendItemsTo",
"(",
"StringBuilder",
"buf",
",",
"VectorFieldTypeInformation",
"<",
"BitVector",
">",
"meta",
")",
"{",
"int",
"it",
"=",
"this",
".",
"iter",
"(",
")",
";",
"if",
"(",
"this",
".",
"iterValid",
"(",
"it",
")",
... | Only append the items to a string buffer.
@param buf Buffer
@param meta Relation metadata (for labels)
@return String buffer for chaining. | [
"Only",
"append",
"the",
"items",
"to",
"a",
"string",
"buffer",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-itemsets/src/main/java/de/lmu/ifi/dbs/elki/algorithm/itemsetmining/Itemset.java#L235-L255 | train |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/pca/weightfunctions/GaussWeight.java | GaussWeight.getWeight | @Override
public double getWeight(double distance, double max, double stddev) {
if(max <= 0) {
return 1.0;
}
double relativedistance = distance / max;
// -2.303 is log(.1) to suit the intended range of 1.0-0.1
return FastMath.exp(-2.3025850929940455 * relativedistance * relativedistance);
... | java | @Override
public double getWeight(double distance, double max, double stddev) {
if(max <= 0) {
return 1.0;
}
double relativedistance = distance / max;
// -2.303 is log(.1) to suit the intended range of 1.0-0.1
return FastMath.exp(-2.3025850929940455 * relativedistance * relativedistance);
... | [
"@",
"Override",
"public",
"double",
"getWeight",
"(",
"double",
"distance",
",",
"double",
"max",
",",
"double",
"stddev",
")",
"{",
"if",
"(",
"max",
"<=",
"0",
")",
"{",
"return",
"1.0",
";",
"}",
"double",
"relativedistance",
"=",
"distance",
"/",
... | Get Gaussian weight. stddev is not used, scaled using max. | [
"Get",
"Gaussian",
"weight",
".",
"stddev",
"is",
"not",
"used",
"scaled",
"using",
"max",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/pca/weightfunctions/GaussWeight.java#L36-L44 | train |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/persistent/OnDiskArrayPageFile.java | OnDiskArrayPageFile.writePage | @Override
public void writePage(int pageID, P page) {
if (page.isDirty()) {
try {
countWrite();
byte[] array = pageToByteArray(page);
file.getRecordBuffer(pageID).put(array);
page.setDirty(false);
} catch (IOException e) {
throw new RuntimeException(e);
}
... | java | @Override
public void writePage(int pageID, P page) {
if (page.isDirty()) {
try {
countWrite();
byte[] array = pageToByteArray(page);
file.getRecordBuffer(pageID).put(array);
page.setDirty(false);
} catch (IOException e) {
throw new RuntimeException(e);
}
... | [
"@",
"Override",
"public",
"void",
"writePage",
"(",
"int",
"pageID",
",",
"P",
"page",
")",
"{",
"if",
"(",
"page",
".",
"isDirty",
"(",
")",
")",
"{",
"try",
"{",
"countWrite",
"(",
")",
";",
"byte",
"[",
"]",
"array",
"=",
"pageToByteArray",
"("... | Write page to disk.
@param pageID page id
@param page the page which has to be written to disk | [
"Write",
"page",
"to",
"disk",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/persistent/OnDiskArrayPageFile.java#L144-L156 | train |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/persistent/OnDiskArrayPageFile.java | OnDiskArrayPageFile.pageToByteArray | private byte[] pageToByteArray(P page) {
try {
if (page == null) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeInt(EMPTY_PAGE);
oos.close();
baos.close();
byte[] array = baos.toByteArr... | java | private byte[] pageToByteArray(P page) {
try {
if (page == null) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeInt(EMPTY_PAGE);
oos.close();
baos.close();
byte[] array = baos.toByteArr... | [
"private",
"byte",
"[",
"]",
"pageToByteArray",
"(",
"P",
"page",
")",
"{",
"try",
"{",
"if",
"(",
"page",
"==",
"null",
")",
"{",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"ObjectOutputStream",
"oos",
"=",
"new",... | Serializes an object into a byte array.
@param page the object to be serialized
@return the byte array | [
"Serializes",
"an",
"object",
"into",
"a",
"byte",
"array",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/persistent/OnDiskArrayPageFile.java#L213-L248 | train |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/SinCosTable.java | SinCosTable.make | public static SinCosTable make(int steps) {
if ((steps & 0x3) == 0) {
return new QuarterTable(steps);
}
if ((steps & 0x1) == 0) {
return new HalfTable(steps);
}
return new FullTable(steps);
} | java | public static SinCosTable make(int steps) {
if ((steps & 0x3) == 0) {
return new QuarterTable(steps);
}
if ((steps & 0x1) == 0) {
return new HalfTable(steps);
}
return new FullTable(steps);
} | [
"public",
"static",
"SinCosTable",
"make",
"(",
"int",
"steps",
")",
"{",
"if",
"(",
"(",
"steps",
"&",
"0x3",
")",
"==",
"0",
")",
"{",
"return",
"new",
"QuarterTable",
"(",
"steps",
")",
";",
"}",
"if",
"(",
"(",
"steps",
"&",
"0x1",
")",
"==",... | Make a table for the given number of steps.
For step numbers divisible by 4, an optimized implementation will be used.
@param steps Number of steps
@return Table | [
"Make",
"a",
"table",
"for",
"the",
"given",
"number",
"of",
"steps",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/SinCosTable.java#L295-L303 | train |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/CLINK.java | CLINK.process | @Override
protected void process(DBIDRef id, ArrayDBIDs ids, DBIDArrayIter it, int n, WritableDBIDDataStore pi, WritableDoubleDataStore lambda, WritableDoubleDataStore m) {
clinkstep3(id, it, n, pi, lambda, m);
clinkstep4567(id, ids, it, n, pi, lambda, m);
clinkstep8(id, it, n, pi, lambda, m);
} | java | @Override
protected void process(DBIDRef id, ArrayDBIDs ids, DBIDArrayIter it, int n, WritableDBIDDataStore pi, WritableDoubleDataStore lambda, WritableDoubleDataStore m) {
clinkstep3(id, it, n, pi, lambda, m);
clinkstep4567(id, ids, it, n, pi, lambda, m);
clinkstep8(id, it, n, pi, lambda, m);
} | [
"@",
"Override",
"protected",
"void",
"process",
"(",
"DBIDRef",
"id",
",",
"ArrayDBIDs",
"ids",
",",
"DBIDArrayIter",
"it",
",",
"int",
"n",
",",
"WritableDBIDDataStore",
"pi",
",",
"WritableDoubleDataStore",
"lambda",
",",
"WritableDoubleDataStore",
"m",
")",
... | CLINK main loop, based on the SLINK main loop.
@param id Current object
@param ids All objects
@param it Array iterator
@param n Last object to process at this run
@param pi Parent
@param lambda Height
@param m Distance | [
"CLINK",
"main",
"loop",
"based",
"on",
"the",
"SLINK",
"main",
"loop",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/CLINK.java#L89-L94 | train |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/CLINK.java | CLINK.clinkstep8 | private void clinkstep8(DBIDRef id, DBIDArrayIter it, int n, WritableDBIDDataStore pi, WritableDoubleDataStore lambda, WritableDoubleDataStore m) {
DBIDVar p_i = DBIDUtil.newVar(), pp_i = DBIDUtil.newVar();
for(it.seek(0); it.getOffset() < n; it.advance()) {
p_i.from(pi, it); // p_i = pi[i]
pp_i.fro... | java | private void clinkstep8(DBIDRef id, DBIDArrayIter it, int n, WritableDBIDDataStore pi, WritableDoubleDataStore lambda, WritableDoubleDataStore m) {
DBIDVar p_i = DBIDUtil.newVar(), pp_i = DBIDUtil.newVar();
for(it.seek(0); it.getOffset() < n; it.advance()) {
p_i.from(pi, it); // p_i = pi[i]
pp_i.fro... | [
"private",
"void",
"clinkstep8",
"(",
"DBIDRef",
"id",
",",
"DBIDArrayIter",
"it",
",",
"int",
"n",
",",
"WritableDBIDDataStore",
"pi",
",",
"WritableDoubleDataStore",
"lambda",
",",
"WritableDoubleDataStore",
"m",
")",
"{",
"DBIDVar",
"p_i",
"=",
"DBIDUtil",
".... | Update hierarchy.
@param id Current object
@param it Iterator
@param n Last object to process
@param pi Parent data store
@param lambda Height data store
@param m Distance data store | [
"Update",
"hierarchy",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/CLINK.java#L195-L204 | train |
elki-project/elki | elki-core-distance/src/main/java/de/lmu/ifi/dbs/elki/distance/distancefunction/strings/LevenshteinDistanceFunction.java | LevenshteinDistanceFunction.levenshteinDistance | public static int levenshteinDistance(String o1, String o2) {
// Let o1 be the shorter one:
if(o1.length() > o2.length()) {
return levenshteinDistance(o2, o1);
}
final int l1 = o1.length(), l2 = o2.length();
// Exploit that Java caches the hash code of strings:
if(l1 == l2 && o1.hashCode()... | java | public static int levenshteinDistance(String o1, String o2) {
// Let o1 be the shorter one:
if(o1.length() > o2.length()) {
return levenshteinDistance(o2, o1);
}
final int l1 = o1.length(), l2 = o2.length();
// Exploit that Java caches the hash code of strings:
if(l1 == l2 && o1.hashCode()... | [
"public",
"static",
"int",
"levenshteinDistance",
"(",
"String",
"o1",
",",
"String",
"o2",
")",
"{",
"// Let o1 be the shorter one:",
"if",
"(",
"o1",
".",
"length",
"(",
")",
">",
"o2",
".",
"length",
"(",
")",
")",
"{",
"return",
"levenshteinDistance",
... | Levenshtein distance for two strings.
@param o1 First string
@param o2 Second string
@return Levenshtein distance | [
"Levenshtein",
"distance",
"for",
"two",
"strings",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-distance/src/main/java/de/lmu/ifi/dbs/elki/distance/distancefunction/strings/LevenshteinDistanceFunction.java#L84-L106 | train |
elki-project/elki | elki-core-distance/src/main/java/de/lmu/ifi/dbs/elki/distance/distancefunction/strings/LevenshteinDistanceFunction.java | LevenshteinDistanceFunction.prefixLen | private static int prefixLen(String o1, String o2) {
final int l1 = o1.length(), l2 = o2.length(), l = l1 < l2 ? l1 : l2;
int prefix = 0;
while(prefix < l && (o1.charAt(prefix) == o2.charAt(prefix))) {
prefix++;
}
return prefix;
} | java | private static int prefixLen(String o1, String o2) {
final int l1 = o1.length(), l2 = o2.length(), l = l1 < l2 ? l1 : l2;
int prefix = 0;
while(prefix < l && (o1.charAt(prefix) == o2.charAt(prefix))) {
prefix++;
}
return prefix;
} | [
"private",
"static",
"int",
"prefixLen",
"(",
"String",
"o1",
",",
"String",
"o2",
")",
"{",
"final",
"int",
"l1",
"=",
"o1",
".",
"length",
"(",
")",
",",
"l2",
"=",
"o2",
".",
"length",
"(",
")",
",",
"l",
"=",
"l1",
"<",
"l2",
"?",
"l1",
"... | Compute the length of the prefix.
@param o1 First string
@param o2 Second string
@return Prefix length | [
"Compute",
"the",
"length",
"of",
"the",
"prefix",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-distance/src/main/java/de/lmu/ifi/dbs/elki/distance/distancefunction/strings/LevenshteinDistanceFunction.java#L115-L122 | train |
elki-project/elki | elki-core-distance/src/main/java/de/lmu/ifi/dbs/elki/distance/distancefunction/strings/LevenshteinDistanceFunction.java | LevenshteinDistanceFunction.postfixLen | private static int postfixLen(String o1, String o2, int prefix) {
int postfix = 0;
int p1 = o1.length(), p2 = o2.length();
while(p1 > prefix && p2 > prefix && (o1.charAt(--p1) == o2.charAt(--p2))) {
++postfix;
}
return postfix;
} | java | private static int postfixLen(String o1, String o2, int prefix) {
int postfix = 0;
int p1 = o1.length(), p2 = o2.length();
while(p1 > prefix && p2 > prefix && (o1.charAt(--p1) == o2.charAt(--p2))) {
++postfix;
}
return postfix;
} | [
"private",
"static",
"int",
"postfixLen",
"(",
"String",
"o1",
",",
"String",
"o2",
",",
"int",
"prefix",
")",
"{",
"int",
"postfix",
"=",
"0",
";",
"int",
"p1",
"=",
"o1",
".",
"length",
"(",
")",
",",
"p2",
"=",
"o2",
".",
"length",
"(",
")",
... | Compute the postfix length.
@param o1 First object
@param o2 Second object
@param prefix Known prefix length
@return Postfix length | [
"Compute",
"the",
"postfix",
"length",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-distance/src/main/java/de/lmu/ifi/dbs/elki/distance/distancefunction/strings/LevenshteinDistanceFunction.java#L132-L139 | train |
elki-project/elki | elki-core-distance/src/main/java/de/lmu/ifi/dbs/elki/distance/distancefunction/strings/LevenshteinDistanceFunction.java | LevenshteinDistanceFunction.levenshteinDistance | public static int levenshteinDistance(String o1, String o2, int prefix, int postfix) {
final int l1 = o1.length(), l2 = o2.length();
// Buffer, interleaved. Even and odd values are our rows.
int[] buf = new int[(l2 + 1 - (prefix + postfix)) << 1];
// Initial "row", on even positions
for(int j = 0; j... | java | public static int levenshteinDistance(String o1, String o2, int prefix, int postfix) {
final int l1 = o1.length(), l2 = o2.length();
// Buffer, interleaved. Even and odd values are our rows.
int[] buf = new int[(l2 + 1 - (prefix + postfix)) << 1];
// Initial "row", on even positions
for(int j = 0; j... | [
"public",
"static",
"int",
"levenshteinDistance",
"(",
"String",
"o1",
",",
"String",
"o2",
",",
"int",
"prefix",
",",
"int",
"postfix",
")",
"{",
"final",
"int",
"l1",
"=",
"o1",
".",
"length",
"(",
")",
",",
"l2",
"=",
"o2",
".",
"length",
"(",
"... | Compute the Levenshtein distance, except for prefix and postfix.
@param o1 First object
@param o2 Second object
@param prefix Prefix length
@param postfix Postfix length
@return Levenshtein distance | [
"Compute",
"the",
"Levenshtein",
"distance",
"except",
"for",
"prefix",
"and",
"postfix",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-distance/src/main/java/de/lmu/ifi/dbs/elki/distance/distancefunction/strings/LevenshteinDistanceFunction.java#L150-L167 | train |
elki-project/elki | elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/range/ParseIntRanges.java | ParseIntRanges.nextSep | private static int nextSep(String str, int start) {
int next = str.indexOf(',', start);
return next == -1 ? str.length() : next;
} | java | private static int nextSep(String str, int start) {
int next = str.indexOf(',', start);
return next == -1 ? str.length() : next;
} | [
"private",
"static",
"int",
"nextSep",
"(",
"String",
"str",
",",
"int",
"start",
")",
"{",
"int",
"next",
"=",
"str",
".",
"indexOf",
"(",
"'",
"'",
",",
"start",
")",
";",
"return",
"next",
"==",
"-",
"1",
"?",
"str",
".",
"length",
"(",
")",
... | Find the next separator.
TODO: allow other separators, too?
@param str String
@param start Starting position
@return Next separator position, or end of string. | [
"Find",
"the",
"next",
"separator",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/range/ParseIntRanges.java#L168-L171 | train |
elki-project/elki | elki-core-distance/src/main/java/de/lmu/ifi/dbs/elki/distance/distancefunction/colorhistogram/HSBHistogramQuadraticDistanceFunction.java | HSBHistogramQuadraticDistanceFunction.computeWeightMatrix | public static double[][] computeWeightMatrix(final int quanth, final int quants, final int quantb) {
final int dim = quanth * quants * quantb;
final DoubleWrapper tmp = new DoubleWrapper(); // To return cosine
assert (dim > 0);
final double[][] m = new double[dim][dim];
for(int x = 0; x < dim; x++) ... | java | public static double[][] computeWeightMatrix(final int quanth, final int quants, final int quantb) {
final int dim = quanth * quants * quantb;
final DoubleWrapper tmp = new DoubleWrapper(); // To return cosine
assert (dim > 0);
final double[][] m = new double[dim][dim];
for(int x = 0; x < dim; x++) ... | [
"public",
"static",
"double",
"[",
"]",
"[",
"]",
"computeWeightMatrix",
"(",
"final",
"int",
"quanth",
",",
"final",
"int",
"quants",
",",
"final",
"int",
"quantb",
")",
"{",
"final",
"int",
"dim",
"=",
"quanth",
"*",
"quants",
"*",
"quantb",
";",
"fi... | Compute the weight matrix for HSB similarity.
@param quanth H bins
@param quants S bins
@param quantb B bins
@return Weight matrix | [
"Compute",
"the",
"weight",
"matrix",
"for",
"HSB",
"similarity",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-distance/src/main/java/de/lmu/ifi/dbs/elki/distance/distancefunction/colorhistogram/HSBHistogramQuadraticDistanceFunction.java#L74-L100 | train |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java | VMath.plus | public static double[] plus(final double[] v1, final double[] v2) {
assert v1.length == v2.length : ERR_VEC_DIMENSIONS;
final double[] result = new double[v1.length];
for(int i = 0; i < result.length; i++) {
result[i] = v1[i] + v2[i];
}
return result;
} | java | public static double[] plus(final double[] v1, final double[] v2) {
assert v1.length == v2.length : ERR_VEC_DIMENSIONS;
final double[] result = new double[v1.length];
for(int i = 0; i < result.length; i++) {
result[i] = v1[i] + v2[i];
}
return result;
} | [
"public",
"static",
"double",
"[",
"]",
"plus",
"(",
"final",
"double",
"[",
"]",
"v1",
",",
"final",
"double",
"[",
"]",
"v2",
")",
"{",
"assert",
"v1",
".",
"length",
"==",
"v2",
".",
"length",
":",
"ERR_VEC_DIMENSIONS",
";",
"final",
"double",
"["... | Computes component-wise v1 + v2 for vectors.
@param v1 first vector
@param v2 second vector
@return the sum v1 + v2 | [
"Computes",
"component",
"-",
"wise",
"v1",
"+",
"v2",
"for",
"vectors",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java#L138-L145 | train |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java | VMath.plusEquals | public static double[] plusEquals(final double[] v1, final double[] v2) {
assert v1.length == v2.length : ERR_VEC_DIMENSIONS;
for(int i = 0; i < v1.length; i++) {
v1[i] += v2[i];
}
return v1;
} | java | public static double[] plusEquals(final double[] v1, final double[] v2) {
assert v1.length == v2.length : ERR_VEC_DIMENSIONS;
for(int i = 0; i < v1.length; i++) {
v1[i] += v2[i];
}
return v1;
} | [
"public",
"static",
"double",
"[",
"]",
"plusEquals",
"(",
"final",
"double",
"[",
"]",
"v1",
",",
"final",
"double",
"[",
"]",
"v2",
")",
"{",
"assert",
"v1",
".",
"length",
"==",
"v2",
".",
"length",
":",
"ERR_VEC_DIMENSIONS",
";",
"for",
"(",
"int... | Computes component-wise v1 = v1 + v2,
overwriting the vector v1.
@param v1 first vector (overwritten)
@param v2 second vector
@return v1 = v1 + v2 | [
"Computes",
"component",
"-",
"wise",
"v1",
"=",
"v1",
"+",
"v2",
"overwriting",
"the",
"vector",
"v1",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java#L207-L213 | train |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java | VMath.plus | public static double[] plus(final double[] v1, final double s1) {
final double[] result = new double[v1.length];
for(int i = 0; i < result.length; i++) {
result[i] = v1[i] + s1;
}
return result;
} | java | public static double[] plus(final double[] v1, final double s1) {
final double[] result = new double[v1.length];
for(int i = 0; i < result.length; i++) {
result[i] = v1[i] + s1;
}
return result;
} | [
"public",
"static",
"double",
"[",
"]",
"plus",
"(",
"final",
"double",
"[",
"]",
"v1",
",",
"final",
"double",
"s1",
")",
"{",
"final",
"double",
"[",
"]",
"result",
"=",
"new",
"double",
"[",
"v1",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i... | Computes component-wise v1 + s1.
@param v1 vector to add to
@param s1 constant value to add
@return v1 + s1 | [
"Computes",
"component",
"-",
"wise",
"v1",
"+",
"s1",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java#L274-L280 | train |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java | VMath.plusEquals | public static double[] plusEquals(final double[] v1, final double s1) {
for(int i = 0; i < v1.length; i++) {
v1[i] += s1;
}
return v1;
} | java | public static double[] plusEquals(final double[] v1, final double s1) {
for(int i = 0; i < v1.length; i++) {
v1[i] += s1;
}
return v1;
} | [
"public",
"static",
"double",
"[",
"]",
"plusEquals",
"(",
"final",
"double",
"[",
"]",
"v1",
",",
"final",
"double",
"s1",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"v1",
".",
"length",
";",
"i",
"++",
")",
"{",
"v1",
"[",
"... | Computes component-wise v1 = v1 + s1,
overwriting the vector v1.
@param v1 vector to add to (overwritten)
@param s1 constant value to add
@return Modified vector | [
"Computes",
"component",
"-",
"wise",
"v1",
"=",
"v1",
"+",
"s1",
"overwriting",
"the",
"vector",
"v1",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java#L290-L295 | train |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java | VMath.minus | public static double[] minus(final double[] v1, final double[] v2) {
assert v1.length == v2.length : ERR_VEC_DIMENSIONS;
final double[] sub = new double[v1.length];
for(int i = 0; i < v1.length; i++) {
sub[i] = v1[i] - v2[i];
}
return sub;
} | java | public static double[] minus(final double[] v1, final double[] v2) {
assert v1.length == v2.length : ERR_VEC_DIMENSIONS;
final double[] sub = new double[v1.length];
for(int i = 0; i < v1.length; i++) {
sub[i] = v1[i] - v2[i];
}
return sub;
} | [
"public",
"static",
"double",
"[",
"]",
"minus",
"(",
"final",
"double",
"[",
"]",
"v1",
",",
"final",
"double",
"[",
"]",
"v2",
")",
"{",
"assert",
"v1",
".",
"length",
"==",
"v2",
".",
"length",
":",
"ERR_VEC_DIMENSIONS",
";",
"final",
"double",
"[... | Computes component-wise v1 - v2.
@param v1 first vector
@param v2 the vector to be subtracted from this vector
@return v1 - v2 | [
"Computes",
"component",
"-",
"wise",
"v1",
"-",
"v2",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java#L304-L311 | train |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java | VMath.minusEquals | public static double[] minusEquals(final double[] v1, final double[] v2) {
assert v1.length == v2.length : ERR_VEC_DIMENSIONS;
for(int i = 0; i < v1.length; i++) {
v1[i] -= v2[i];
}
return v1;
} | java | public static double[] minusEquals(final double[] v1, final double[] v2) {
assert v1.length == v2.length : ERR_VEC_DIMENSIONS;
for(int i = 0; i < v1.length; i++) {
v1[i] -= v2[i];
}
return v1;
} | [
"public",
"static",
"double",
"[",
"]",
"minusEquals",
"(",
"final",
"double",
"[",
"]",
"v1",
",",
"final",
"double",
"[",
"]",
"v2",
")",
"{",
"assert",
"v1",
".",
"length",
"==",
"v2",
".",
"length",
":",
"ERR_VEC_DIMENSIONS",
";",
"for",
"(",
"in... | Computes component-wise v1 = v1 - v2,
overwriting the vector v1.
@param v1 vector
@param v2 another vector
@return v1 = v1 - v2 | [
"Computes",
"component",
"-",
"wise",
"v1",
"=",
"v1",
"-",
"v2",
"overwriting",
"the",
"vector",
"v1",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java#L373-L379 | train |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java | VMath.minus | public static double[] minus(final double[] v1, final double s1) {
final double[] result = new double[v1.length];
for(int i = 0; i < v1.length; i++) {
result[i] = v1[i] - s1;
}
return result;
} | java | public static double[] minus(final double[] v1, final double s1) {
final double[] result = new double[v1.length];
for(int i = 0; i < v1.length; i++) {
result[i] = v1[i] - s1;
}
return result;
} | [
"public",
"static",
"double",
"[",
"]",
"minus",
"(",
"final",
"double",
"[",
"]",
"v1",
",",
"final",
"double",
"s1",
")",
"{",
"final",
"double",
"[",
"]",
"result",
"=",
"new",
"double",
"[",
"v1",
".",
"length",
"]",
";",
"for",
"(",
"int",
"... | Subtract component-wise v1 - s1.
@param v1 original vector
@param s1 Value to subtract
@return v1 - s1 | [
"Subtract",
"component",
"-",
"wise",
"v1",
"-",
"s1",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java#L440-L446 | train |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java | VMath.minusEquals | public static double[] minusEquals(final double[] v1, final double s1) {
for(int i = 0; i < v1.length; i++) {
v1[i] -= s1;
}
return v1;
} | java | public static double[] minusEquals(final double[] v1, final double s1) {
for(int i = 0; i < v1.length; i++) {
v1[i] -= s1;
}
return v1;
} | [
"public",
"static",
"double",
"[",
"]",
"minusEquals",
"(",
"final",
"double",
"[",
"]",
"v1",
",",
"final",
"double",
"s1",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"v1",
".",
"length",
";",
"i",
"++",
")",
"{",
"v1",
"[",
... | Subtract component-wise in-place v1 = v1 - s1,
overwriting the vector v1.
@param v1 original vector
@param s1 Value to subtract
@return v1 = v1 - s1 | [
"Subtract",
"component",
"-",
"wise",
"in",
"-",
"place",
"v1",
"=",
"v1",
"-",
"s1",
"overwriting",
"the",
"vector",
"v1",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java#L456-L461 | train |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java | VMath.sum | public static double sum(final double[] v1) {
double acc = 0.;
for(int row = 0; row < v1.length; row++) {
acc += v1[row];
}
return acc;
} | java | public static double sum(final double[] v1) {
double acc = 0.;
for(int row = 0; row < v1.length; row++) {
acc += v1[row];
}
return acc;
} | [
"public",
"static",
"double",
"sum",
"(",
"final",
"double",
"[",
"]",
"v1",
")",
"{",
"double",
"acc",
"=",
"0.",
";",
"for",
"(",
"int",
"row",
"=",
"0",
";",
"row",
"<",
"v1",
".",
"length",
";",
"row",
"++",
")",
"{",
"acc",
"+=",
"v1",
"... | Sum of the vector components.
@param v1 vector
@return sum of this vector | [
"Sum",
"of",
"the",
"vector",
"components",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java#L653-L659 | train |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java | VMath.argmax | public static int argmax(double[] v) {
assert (v.length > 0);
int maxIndex = 0;
double currentMax = v[0];
for(int i = 1; i < v.length; i++) {
final double x = v[i];
if(x > currentMax) {
maxIndex = i;
currentMax = x;
}
}
return maxIndex;
} | java | public static int argmax(double[] v) {
assert (v.length > 0);
int maxIndex = 0;
double currentMax = v[0];
for(int i = 1; i < v.length; i++) {
final double x = v[i];
if(x > currentMax) {
maxIndex = i;
currentMax = x;
}
}
return maxIndex;
} | [
"public",
"static",
"int",
"argmax",
"(",
"double",
"[",
"]",
"v",
")",
"{",
"assert",
"(",
"v",
".",
"length",
">",
"0",
")",
";",
"int",
"maxIndex",
"=",
"0",
";",
"double",
"currentMax",
"=",
"v",
"[",
"0",
"]",
";",
"for",
"(",
"int",
"i",
... | Find the maximum value.
@param v Vector
@return Position of maximum | [
"Find",
"the",
"maximum",
"value",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java#L692-L704 | train |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java | VMath.normalize | public static double[] normalize(final double[] v1) {
final double norm = 1. / euclideanLength(v1);
double[] re = new double[v1.length];
if(norm < Double.POSITIVE_INFINITY) {
for(int row = 0; row < v1.length; row++) {
re[row] = v1[row] * norm;
}
}
return re;
} | java | public static double[] normalize(final double[] v1) {
final double norm = 1. / euclideanLength(v1);
double[] re = new double[v1.length];
if(norm < Double.POSITIVE_INFINITY) {
for(int row = 0; row < v1.length; row++) {
re[row] = v1[row] * norm;
}
}
return re;
} | [
"public",
"static",
"double",
"[",
"]",
"normalize",
"(",
"final",
"double",
"[",
"]",
"v1",
")",
"{",
"final",
"double",
"norm",
"=",
"1.",
"/",
"euclideanLength",
"(",
"v1",
")",
";",
"double",
"[",
"]",
"re",
"=",
"new",
"double",
"[",
"v1",
"."... | Normalizes v1 to the length of 1.0.
@param v1 vector
@return normalized copy of v1 | [
"Normalizes",
"v1",
"to",
"the",
"length",
"of",
"1",
".",
"0",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java#L712-L721 | train |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java | VMath.normalizeEquals | public static double[] normalizeEquals(final double[] v1) {
final double norm = 1. / euclideanLength(v1);
if(norm < Double.POSITIVE_INFINITY) {
for(int row = 0; row < v1.length; row++) {
v1[row] *= norm;
}
}
return v1;
} | java | public static double[] normalizeEquals(final double[] v1) {
final double norm = 1. / euclideanLength(v1);
if(norm < Double.POSITIVE_INFINITY) {
for(int row = 0; row < v1.length; row++) {
v1[row] *= norm;
}
}
return v1;
} | [
"public",
"static",
"double",
"[",
"]",
"normalizeEquals",
"(",
"final",
"double",
"[",
"]",
"v1",
")",
"{",
"final",
"double",
"norm",
"=",
"1.",
"/",
"euclideanLength",
"(",
"v1",
")",
";",
"if",
"(",
"norm",
"<",
"Double",
".",
"POSITIVE_INFINITY",
... | Normalizes v1 to the length of 1.0 in place.
@param v1 vector (overwritten)
@return normalized v1 | [
"Normalizes",
"v1",
"to",
"the",
"length",
"of",
"1",
".",
"0",
"in",
"place",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java#L729-L737 | train |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java | VMath.clear | public static void clear(final double[][] m) {
for(int i = 0; i < m.length; i++) {
Arrays.fill(m[i], 0.0);
}
} | java | public static void clear(final double[][] m) {
for(int i = 0; i < m.length; i++) {
Arrays.fill(m[i], 0.0);
}
} | [
"public",
"static",
"void",
"clear",
"(",
"final",
"double",
"[",
"]",
"[",
"]",
"m",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"m",
".",
"length",
";",
"i",
"++",
")",
"{",
"Arrays",
".",
"fill",
"(",
"m",
"[",
"i",
"]",
... | Reset the matrix to 0.
@param m Matrix | [
"Reset",
"the",
"matrix",
"to",
"0",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java#L774-L778 | train |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java | VMath.rotate90Equals | public static double[] rotate90Equals(final double[] v1) {
assert v1.length == 2 : "rotate90Equals is only valid for 2d vectors.";
final double temp = v1[0];
v1[0] = v1[1];
v1[1] = -temp;
return v1;
} | java | public static double[] rotate90Equals(final double[] v1) {
assert v1.length == 2 : "rotate90Equals is only valid for 2d vectors.";
final double temp = v1[0];
v1[0] = v1[1];
v1[1] = -temp;
return v1;
} | [
"public",
"static",
"double",
"[",
"]",
"rotate90Equals",
"(",
"final",
"double",
"[",
"]",
"v1",
")",
"{",
"assert",
"v1",
".",
"length",
"==",
"2",
":",
"\"rotate90Equals is only valid for 2d vectors.\"",
";",
"final",
"double",
"temp",
"=",
"v1",
"[",
"0"... | Rotate the two-dimensional vector by 90 degrees.
@param v1 first vector
@return modified v1, rotated by 90 degrees | [
"Rotate",
"the",
"two",
"-",
"dimensional",
"vector",
"by",
"90",
"degrees",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java#L786-L792 | train |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java | VMath.diagonal | public static double[][] diagonal(final double[] v1) {
final int dim = v1.length;
final double[][] result = new double[dim][dim];
for(int i = 0; i < dim; i++) {
result[i][i] = v1[i];
}
return result;
} | java | public static double[][] diagonal(final double[] v1) {
final int dim = v1.length;
final double[][] result = new double[dim][dim];
for(int i = 0; i < dim; i++) {
result[i][i] = v1[i];
}
return result;
} | [
"public",
"static",
"double",
"[",
"]",
"[",
"]",
"diagonal",
"(",
"final",
"double",
"[",
"]",
"v1",
")",
"{",
"final",
"int",
"dim",
"=",
"v1",
".",
"length",
";",
"final",
"double",
"[",
"]",
"[",
"]",
"result",
"=",
"new",
"double",
"[",
"dim... | Returns a quadratic matrix consisting of zeros and of the given values on
the diagonal.
@param v1 the values on the diagonal
@return the resulting matrix | [
"Returns",
"a",
"quadratic",
"matrix",
"consisting",
"of",
"zeros",
"and",
"of",
"the",
"given",
"values",
"on",
"the",
"diagonal",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java#L843-L850 | train |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java | VMath.copy | public static double[][] copy(final double[][] m1) {
final int rowdim = m1.length, coldim = getColumnDimensionality(m1);
final double[][] X = new double[rowdim][coldim];
for(int i = 0; i < rowdim; i++) {
System.arraycopy(m1[i], 0, X[i], 0, coldim);
}
return X;
} | java | public static double[][] copy(final double[][] m1) {
final int rowdim = m1.length, coldim = getColumnDimensionality(m1);
final double[][] X = new double[rowdim][coldim];
for(int i = 0; i < rowdim; i++) {
System.arraycopy(m1[i], 0, X[i], 0, coldim);
}
return X;
} | [
"public",
"static",
"double",
"[",
"]",
"[",
"]",
"copy",
"(",
"final",
"double",
"[",
"]",
"[",
"]",
"m1",
")",
"{",
"final",
"int",
"rowdim",
"=",
"m1",
".",
"length",
",",
"coldim",
"=",
"getColumnDimensionality",
"(",
"m1",
")",
";",
"final",
"... | Make a deep copy of a matrix.
@param m1 Input matrix
@return a new matrix containing the same values as this matrix | [
"Make",
"a",
"deep",
"copy",
"of",
"a",
"matrix",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java#L858-L865 | train |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java | VMath.getCol | public static double[] getCol(double[][] m1, int col) {
double[] ret = new double[m1.length];
for(int i = 0; i < ret.length; i++) {
ret[i] = m1[i][col];
}
return ret;
} | java | public static double[] getCol(double[][] m1, int col) {
double[] ret = new double[m1.length];
for(int i = 0; i < ret.length; i++) {
ret[i] = m1[i][col];
}
return ret;
} | [
"public",
"static",
"double",
"[",
"]",
"getCol",
"(",
"double",
"[",
"]",
"[",
"]",
"m1",
",",
"int",
"col",
")",
"{",
"double",
"[",
"]",
"ret",
"=",
"new",
"double",
"[",
"m1",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";"... | Get a column from a matrix as vector.
@param m1 Matrix to extract the column from
@param col Column number
@return Column | [
"Get",
"a",
"column",
"from",
"a",
"matrix",
"as",
"vector",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java#L1091-L1097 | train |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java | VMath.getDiagonal | public static double[] getDiagonal(final double[][] m1) {
final int dim = Math.min(getColumnDimensionality(m1), m1.length);
final double[] diagonal = new double[dim];
for(int i = 0; i < dim; i++) {
diagonal[i] = m1[i][i];
}
return diagonal;
} | java | public static double[] getDiagonal(final double[][] m1) {
final int dim = Math.min(getColumnDimensionality(m1), m1.length);
final double[] diagonal = new double[dim];
for(int i = 0; i < dim; i++) {
diagonal[i] = m1[i][i];
}
return diagonal;
} | [
"public",
"static",
"double",
"[",
"]",
"getDiagonal",
"(",
"final",
"double",
"[",
"]",
"[",
"]",
"m1",
")",
"{",
"final",
"int",
"dim",
"=",
"Math",
".",
"min",
"(",
"getColumnDimensionality",
"(",
"m1",
")",
",",
"m1",
".",
"length",
")",
";",
"... | getDiagonal returns array of diagonal-elements.
@param m1 Input matrix
@return values on the diagonal of the Matrix | [
"getDiagonal",
"returns",
"array",
"of",
"diagonal",
"-",
"elements",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java#L1555-L1562 | train |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java | VMath.normalizeColumns | public static void normalizeColumns(final double[][] m1) {
final int columndimension = getColumnDimensionality(m1);
for(int col = 0; col < columndimension; col++) {
double norm = 0.0;
for(int row = 0; row < m1.length; row++) {
final double v = m1[row][col];
norm += v * v;
}
... | java | public static void normalizeColumns(final double[][] m1) {
final int columndimension = getColumnDimensionality(m1);
for(int col = 0; col < columndimension; col++) {
double norm = 0.0;
for(int row = 0; row < m1.length; row++) {
final double v = m1[row][col];
norm += v * v;
}
... | [
"public",
"static",
"void",
"normalizeColumns",
"(",
"final",
"double",
"[",
"]",
"[",
"]",
"m1",
")",
"{",
"final",
"int",
"columndimension",
"=",
"getColumnDimensionality",
"(",
"m1",
")",
";",
"for",
"(",
"int",
"col",
"=",
"0",
";",
"col",
"<",
"co... | Normalizes the columns of this matrix to length of 1.0.
Note: if a column has length 0, it will remain unmodified.
@param m1 Input matrix | [
"Normalizes",
"the",
"columns",
"of",
"this",
"matrix",
"to",
"length",
"of",
"1",
".",
"0",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java#L1571-L1586 | train |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java | VMath.appendColumns | public static double[][] appendColumns(final double[][] m1, final double[][] m2) {
final int columndimension = getColumnDimensionality(m1);
final int ccolumndimension = getColumnDimensionality(m2);
assert m1.length == m2.length : "m.getRowDimension() != column.getRowDimension()";
final int rcolumndimen... | java | public static double[][] appendColumns(final double[][] m1, final double[][] m2) {
final int columndimension = getColumnDimensionality(m1);
final int ccolumndimension = getColumnDimensionality(m2);
assert m1.length == m2.length : "m.getRowDimension() != column.getRowDimension()";
final int rcolumndimen... | [
"public",
"static",
"double",
"[",
"]",
"[",
"]",
"appendColumns",
"(",
"final",
"double",
"[",
"]",
"[",
"]",
"m1",
",",
"final",
"double",
"[",
"]",
"[",
"]",
"m2",
")",
"{",
"final",
"int",
"columndimension",
"=",
"getColumnDimensionality",
"(",
"m1... | Returns a matrix which consists of this matrix and the specified columns.
@param m1 Input matrix
@param m2 the columns to be appended
@return the new matrix with the appended columns | [
"Returns",
"a",
"matrix",
"which",
"consists",
"of",
"this",
"matrix",
"and",
"the",
"specified",
"columns",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java#L1595-L1612 | train |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java | VMath.orthonormalize | public static double[][] orthonormalize(final double[][] m1) {
final int columndimension = getColumnDimensionality(m1);
final double[][] v = copy(m1);
// FIXME: optimize - excess copying!
for(int i = 1; i < columndimension; i++) {
final double[] u_i = getCol(m1, i);
final double[] sum = new... | java | public static double[][] orthonormalize(final double[][] m1) {
final int columndimension = getColumnDimensionality(m1);
final double[][] v = copy(m1);
// FIXME: optimize - excess copying!
for(int i = 1; i < columndimension; i++) {
final double[] u_i = getCol(m1, i);
final double[] sum = new... | [
"public",
"static",
"double",
"[",
"]",
"[",
"]",
"orthonormalize",
"(",
"final",
"double",
"[",
"]",
"[",
"]",
"m1",
")",
"{",
"final",
"int",
"columndimension",
"=",
"getColumnDimensionality",
"(",
"m1",
")",
";",
"final",
"double",
"[",
"]",
"[",
"]... | Returns an orthonormalization of this matrix.
@param m1 Input matrix
@return the orthonormalized matrix | [
"Returns",
"an",
"orthonormalization",
"of",
"this",
"matrix",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java#L1620-L1639 | train |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java | VMath.inverse | public static double[][] inverse(double[][] A) {
final int rows = A.length, cols = A[0].length;
return rows == cols //
? (new LUDecomposition(A, rows, cols)).inverse() //
: (new QRDecomposition(A, rows, cols)).inverse();
} | java | public static double[][] inverse(double[][] A) {
final int rows = A.length, cols = A[0].length;
return rows == cols //
? (new LUDecomposition(A, rows, cols)).inverse() //
: (new QRDecomposition(A, rows, cols)).inverse();
} | [
"public",
"static",
"double",
"[",
"]",
"[",
"]",
"inverse",
"(",
"double",
"[",
"]",
"[",
"]",
"A",
")",
"{",
"final",
"int",
"rows",
"=",
"A",
".",
"length",
",",
"cols",
"=",
"A",
"[",
"0",
"]",
".",
"length",
";",
"return",
"rows",
"==",
... | Matrix inverse or pseudoinverse
@param A matrix to invert
@return inverse(A) if A is square, pseudoinverse otherwise. | [
"Matrix",
"inverse",
"or",
"pseudoinverse"
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java#L1673-L1678 | train |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java | VMath.almostEquals | public static boolean almostEquals(final double[] m1, final double[] m2, final double maxdelta) {
if(m1 == m2) {
return true;
}
if(m1 == null || m2 == null) {
return false;
}
final int rowdim = m1.length;
if(rowdim != m2.length) {
return false;
}
for(int i = 0; i < rowd... | java | public static boolean almostEquals(final double[] m1, final double[] m2, final double maxdelta) {
if(m1 == m2) {
return true;
}
if(m1 == null || m2 == null) {
return false;
}
final int rowdim = m1.length;
if(rowdim != m2.length) {
return false;
}
for(int i = 0; i < rowd... | [
"public",
"static",
"boolean",
"almostEquals",
"(",
"final",
"double",
"[",
"]",
"m1",
",",
"final",
"double",
"[",
"]",
"m2",
",",
"final",
"double",
"maxdelta",
")",
"{",
"if",
"(",
"m1",
"==",
"m2",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(... | Compare two matrices with a delta parameter to take numerical errors into
account.
@param m1 Input matrix
@param m2 other matrix to compare with
@param maxdelta maximum delta allowed
@return true if delta smaller than maximum | [
"Compare",
"two",
"matrices",
"with",
"a",
"delta",
"parameter",
"to",
"take",
"numerical",
"errors",
"into",
"account",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java#L1771-L1788 | train |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java | VMath.angle | public static double angle(double[] v1, double[] v2) {
final int mindim = (v1.length <= v2.length) ? v1.length : v2.length;
// Essentially, we want to compute this:
// v1.transposeTimes(v2) / (v1.euclideanLength() * v2.euclideanLength());
// We can just compute all three in parallel.
double s = 0, e... | java | public static double angle(double[] v1, double[] v2) {
final int mindim = (v1.length <= v2.length) ? v1.length : v2.length;
// Essentially, we want to compute this:
// v1.transposeTimes(v2) / (v1.euclideanLength() * v2.euclideanLength());
// We can just compute all three in parallel.
double s = 0, e... | [
"public",
"static",
"double",
"angle",
"(",
"double",
"[",
"]",
"v1",
",",
"double",
"[",
"]",
"v2",
")",
"{",
"final",
"int",
"mindim",
"=",
"(",
"v1",
".",
"length",
"<=",
"v2",
".",
"length",
")",
"?",
"v1",
".",
"length",
":",
"v2",
".",
"l... | Compute the cosine of the angle between two vectors,
where the smaller angle between those vectors is viewed.
@param v1 first vector
@param v2 second vector
@return cosine of the smaller angle | [
"Compute",
"the",
"cosine",
"of",
"the",
"angle",
"between",
"two",
"vectors",
"where",
"the",
"smaller",
"angle",
"between",
"those",
"vectors",
"is",
"viewed",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java#L1830-L1852 | train |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/gui/SelectionTableWindow.java | SelectionTableWindow.updateFromSelection | protected void updateFromSelection() {
DBIDSelection sel = context.getSelection();
if(sel != null) {
this.dbids = DBIDUtil.newArray(sel.getSelectedIds());
this.dbids.sort();
}
else {
this.dbids = DBIDUtil.newArray();
}
} | java | protected void updateFromSelection() {
DBIDSelection sel = context.getSelection();
if(sel != null) {
this.dbids = DBIDUtil.newArray(sel.getSelectedIds());
this.dbids.sort();
}
else {
this.dbids = DBIDUtil.newArray();
}
} | [
"protected",
"void",
"updateFromSelection",
"(",
")",
"{",
"DBIDSelection",
"sel",
"=",
"context",
".",
"getSelection",
"(",
")",
";",
"if",
"(",
"sel",
"!=",
"null",
")",
"{",
"this",
".",
"dbids",
"=",
"DBIDUtil",
".",
"newArray",
"(",
"sel",
".",
"g... | Update our selection | [
"Update",
"our",
"selection"
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/gui/SelectionTableWindow.java#L188-L197 | train |
elki-project/elki | elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/datastore/DataStoreEvent.java | DataStoreEvent.insertionEvent | public static DataStoreEvent insertionEvent(DBIDs inserts) {
return new DataStoreEvent(inserts, DBIDUtil.EMPTYDBIDS, DBIDUtil.EMPTYDBIDS);
} | java | public static DataStoreEvent insertionEvent(DBIDs inserts) {
return new DataStoreEvent(inserts, DBIDUtil.EMPTYDBIDS, DBIDUtil.EMPTYDBIDS);
} | [
"public",
"static",
"DataStoreEvent",
"insertionEvent",
"(",
"DBIDs",
"inserts",
")",
"{",
"return",
"new",
"DataStoreEvent",
"(",
"inserts",
",",
"DBIDUtil",
".",
"EMPTYDBIDS",
",",
"DBIDUtil",
".",
"EMPTYDBIDS",
")",
";",
"}"
] | Insertion event.
@param inserts Insertions
@return Event | [
"Insertion",
"event",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/datastore/DataStoreEvent.java#L73-L75 | train |
elki-project/elki | elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/datastore/DataStoreEvent.java | DataStoreEvent.removalEvent | public static DataStoreEvent removalEvent(DBIDs removals) {
return new DataStoreEvent(DBIDUtil.EMPTYDBIDS, removals, DBIDUtil.EMPTYDBIDS);
} | java | public static DataStoreEvent removalEvent(DBIDs removals) {
return new DataStoreEvent(DBIDUtil.EMPTYDBIDS, removals, DBIDUtil.EMPTYDBIDS);
} | [
"public",
"static",
"DataStoreEvent",
"removalEvent",
"(",
"DBIDs",
"removals",
")",
"{",
"return",
"new",
"DataStoreEvent",
"(",
"DBIDUtil",
".",
"EMPTYDBIDS",
",",
"removals",
",",
"DBIDUtil",
".",
"EMPTYDBIDS",
")",
";",
"}"
] | Removal event.
@param removals Removal
@return Event | [
"Removal",
"event",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/datastore/DataStoreEvent.java#L83-L85 | train |
elki-project/elki | elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/datastore/DataStoreEvent.java | DataStoreEvent.updateEvent | public static DataStoreEvent updateEvent(DBIDs updates) {
return new DataStoreEvent(DBIDUtil.EMPTYDBIDS, DBIDUtil.EMPTYDBIDS, updates);
} | java | public static DataStoreEvent updateEvent(DBIDs updates) {
return new DataStoreEvent(DBIDUtil.EMPTYDBIDS, DBIDUtil.EMPTYDBIDS, updates);
} | [
"public",
"static",
"DataStoreEvent",
"updateEvent",
"(",
"DBIDs",
"updates",
")",
"{",
"return",
"new",
"DataStoreEvent",
"(",
"DBIDUtil",
".",
"EMPTYDBIDS",
",",
"DBIDUtil",
".",
"EMPTYDBIDS",
",",
"updates",
")",
";",
"}"
] | Update event.
@param updates Updates
@return Event | [
"Update",
"event",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/datastore/DataStoreEvent.java#L93-L95 | train |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/gui/detail/DetailView.java | DetailView.instantiateVisualization | private Visualization instantiateVisualization(VisualizationTask task) {
try {
Visualization v = task.getFactory().makeVisualization(context, task, this, width, height, item.proj);
if(task.has(RenderFlag.NO_EXPORT)) {
v.getLayer().setAttribute(NO_EXPORT_ATTRIBUTE, NO_EXPORT_ATTRIBUTE);
}
... | java | private Visualization instantiateVisualization(VisualizationTask task) {
try {
Visualization v = task.getFactory().makeVisualization(context, task, this, width, height, item.proj);
if(task.has(RenderFlag.NO_EXPORT)) {
v.getLayer().setAttribute(NO_EXPORT_ATTRIBUTE, NO_EXPORT_ATTRIBUTE);
}
... | [
"private",
"Visualization",
"instantiateVisualization",
"(",
"VisualizationTask",
"task",
")",
"{",
"try",
"{",
"Visualization",
"v",
"=",
"task",
".",
"getFactory",
"(",
")",
".",
"makeVisualization",
"(",
"context",
",",
"task",
",",
"this",
",",
"width",
",... | Instantiate a visualization.
@param task Task to instantiate
@return Visualization | [
"Instantiate",
"a",
"visualization",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/gui/detail/DetailView.java#L226-L243 | train |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/gui/detail/DetailView.java | DetailView.destroy | public void destroy() {
context.removeVisualizationListener(this);
context.removeResultListener(this);
for(Entry<VisualizationTask, Visualization> v : taskmap.entrySet()) {
Visualization vis = v.getValue();
if(vis != null) {
vis.destroy();
}
}
taskmap.clear();
} | java | public void destroy() {
context.removeVisualizationListener(this);
context.removeResultListener(this);
for(Entry<VisualizationTask, Visualization> v : taskmap.entrySet()) {
Visualization vis = v.getValue();
if(vis != null) {
vis.destroy();
}
}
taskmap.clear();
} | [
"public",
"void",
"destroy",
"(",
")",
"{",
"context",
".",
"removeVisualizationListener",
"(",
"this",
")",
";",
"context",
".",
"removeResultListener",
"(",
"this",
")",
";",
"for",
"(",
"Entry",
"<",
"VisualizationTask",
",",
"Visualization",
">",
"v",
":... | Cleanup function. To remove listeners. | [
"Cleanup",
"function",
".",
"To",
"remove",
"listeners",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/gui/detail/DetailView.java#L248-L258 | train |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/gui/detail/DetailView.java | DetailView.lazyRefresh | private void lazyRefresh() {
Runnable pr = new Runnable() {
@Override
public void run() {
if(pendingRefresh.compareAndSet(this, null)) {
refresh();
}
}
};
pendingRefresh.set(pr);
scheduleUpdate(pr);
} | java | private void lazyRefresh() {
Runnable pr = new Runnable() {
@Override
public void run() {
if(pendingRefresh.compareAndSet(this, null)) {
refresh();
}
}
};
pendingRefresh.set(pr);
scheduleUpdate(pr);
} | [
"private",
"void",
"lazyRefresh",
"(",
")",
"{",
"Runnable",
"pr",
"=",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"if",
"(",
"pendingRefresh",
".",
"compareAndSet",
"(",
"this",
",",
"null",
")",
")",
... | Trigger a refresh. | [
"Trigger",
"a",
"refresh",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/gui/detail/DetailView.java#L288-L299 | train |
elki-project/elki | elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/BufferedLineReader.java | BufferedLineReader.nextLine | public boolean nextLine() throws IOException {
while(reader.readLine(buf.delete(0, buf.length()))) {
++lineNumber;
if(lengthWithoutLinefeed(buf) > 0) {
return true;
}
}
return false;
} | java | public boolean nextLine() throws IOException {
while(reader.readLine(buf.delete(0, buf.length()))) {
++lineNumber;
if(lengthWithoutLinefeed(buf) > 0) {
return true;
}
}
return false;
} | [
"public",
"boolean",
"nextLine",
"(",
")",
"throws",
"IOException",
"{",
"while",
"(",
"reader",
".",
"readLine",
"(",
"buf",
".",
"delete",
"(",
"0",
",",
"buf",
".",
"length",
"(",
")",
")",
")",
")",
"{",
"++",
"lineNumber",
";",
"if",
"(",
"len... | Read the next line.
@return {@code true} if another line was read successfully.
@throws IOException on IO errors. | [
"Read",
"the",
"next",
"line",
"."
] | b54673327e76198ecd4c8a2a901021f1a9174498 | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/BufferedLineReader.java#L160-L168 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.