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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
mikepenz/Materialize | library/src/main/java/com/mikepenz/materialize/util/UIUtils.java | UIUtils.getScreenWidth | public static int getScreenWidth(Context context) {
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
return metrics.widthPixels;
} | java | public static int getScreenWidth(Context context) {
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
return metrics.widthPixels;
} | [
"public",
"static",
"int",
"getScreenWidth",
"(",
"Context",
"context",
")",
"{",
"DisplayMetrics",
"metrics",
"=",
"context",
".",
"getResources",
"(",
")",
".",
"getDisplayMetrics",
"(",
")",
";",
"return",
"metrics",
".",
"widthPixels",
";",
"}"
] | Returns the screen width in pixels
@param context is the context to get the resources
@return the screen width in pixels | [
"Returns",
"the",
"screen",
"width",
"in",
"pixels"
] | 2612c10c7570191a78d57f23620e945d61370e3d | https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/util/UIUtils.java#L334-L337 | train |
mikepenz/Materialize | library/src/main/java/com/mikepenz/materialize/util/UIUtils.java | UIUtils.getScreenHeight | public static int getScreenHeight(Context context) {
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
return metrics.heightPixels;
} | java | public static int getScreenHeight(Context context) {
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
return metrics.heightPixels;
} | [
"public",
"static",
"int",
"getScreenHeight",
"(",
"Context",
"context",
")",
"{",
"DisplayMetrics",
"metrics",
"=",
"context",
".",
"getResources",
"(",
")",
".",
"getDisplayMetrics",
"(",
")",
";",
"return",
"metrics",
".",
"heightPixels",
";",
"}"
] | Returns the screen height in pixels
@param context is the context to get the resources
@return the screen height in pixels | [
"Returns",
"the",
"screen",
"height",
"in",
"pixels"
] | 2612c10c7570191a78d57f23620e945d61370e3d | https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/util/UIUtils.java#L346-L349 | train |
mikepenz/Materialize | library/src/main/java/com/mikepenz/materialize/MaterializeBuilder.java | MaterializeBuilder.withActivity | public MaterializeBuilder withActivity(Activity activity) {
this.mRootView = (ViewGroup) activity.findViewById(android.R.id.content);
this.mActivity = activity;
return this;
} | java | public MaterializeBuilder withActivity(Activity activity) {
this.mRootView = (ViewGroup) activity.findViewById(android.R.id.content);
this.mActivity = activity;
return this;
} | [
"public",
"MaterializeBuilder",
"withActivity",
"(",
"Activity",
"activity",
")",
"{",
"this",
".",
"mRootView",
"=",
"(",
"ViewGroup",
")",
"activity",
".",
"findViewById",
"(",
"android",
".",
"R",
".",
"id",
".",
"content",
")",
";",
"this",
".",
"mActi... | Pass the activity you use the drawer in ;)
This is required if you want to set any values by resource
@param activity
@return | [
"Pass",
"the",
"activity",
"you",
"use",
"the",
"drawer",
"in",
";",
")",
"This",
"is",
"required",
"if",
"you",
"want",
"to",
"set",
"any",
"values",
"by",
"resource"
] | 2612c10c7570191a78d57f23620e945d61370e3d | https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/MaterializeBuilder.java#L53-L57 | train |
mikepenz/Materialize | library/src/main/java/com/mikepenz/materialize/MaterializeBuilder.java | MaterializeBuilder.withContainer | public MaterializeBuilder withContainer(ViewGroup container, ViewGroup.LayoutParams layoutParams) {
this.mContainer = container;
this.mContainerLayoutParams = layoutParams;
return this;
} | java | public MaterializeBuilder withContainer(ViewGroup container, ViewGroup.LayoutParams layoutParams) {
this.mContainer = container;
this.mContainerLayoutParams = layoutParams;
return this;
} | [
"public",
"MaterializeBuilder",
"withContainer",
"(",
"ViewGroup",
"container",
",",
"ViewGroup",
".",
"LayoutParams",
"layoutParams",
")",
"{",
"this",
".",
"mContainer",
"=",
"container",
";",
"this",
".",
"mContainerLayoutParams",
"=",
"layoutParams",
";",
"retur... | set the layout which will host the ScrimInsetsFrameLayout and its layoutParams
@param container
@param layoutParams
@return | [
"set",
"the",
"layout",
"which",
"will",
"host",
"the",
"ScrimInsetsFrameLayout",
"and",
"its",
"layoutParams"
] | 2612c10c7570191a78d57f23620e945d61370e3d | https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/MaterializeBuilder.java#L314-L318 | train |
mikepenz/Materialize | library/src/main/java/com/mikepenz/materialize/Materialize.java | Materialize.setFullscreen | public void setFullscreen(boolean fullscreen) {
if (mBuilder.mScrimInsetsLayout != null) {
mBuilder.mScrimInsetsLayout.setTintStatusBar(!fullscreen);
mBuilder.mScrimInsetsLayout.setTintNavigationBar(!fullscreen);
}
} | java | public void setFullscreen(boolean fullscreen) {
if (mBuilder.mScrimInsetsLayout != null) {
mBuilder.mScrimInsetsLayout.setTintStatusBar(!fullscreen);
mBuilder.mScrimInsetsLayout.setTintNavigationBar(!fullscreen);
}
} | [
"public",
"void",
"setFullscreen",
"(",
"boolean",
"fullscreen",
")",
"{",
"if",
"(",
"mBuilder",
".",
"mScrimInsetsLayout",
"!=",
"null",
")",
"{",
"mBuilder",
".",
"mScrimInsetsLayout",
".",
"setTintStatusBar",
"(",
"!",
"fullscreen",
")",
";",
"mBuilder",
"... | set the insetsFrameLayout to display the content in fullscreen
under the statusBar and navigationBar
@param fullscreen | [
"set",
"the",
"insetsFrameLayout",
"to",
"display",
"the",
"content",
"in",
"fullscreen",
"under",
"the",
"statusBar",
"and",
"navigationBar"
] | 2612c10c7570191a78d57f23620e945d61370e3d | https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/Materialize.java#L31-L36 | train |
mikepenz/Materialize | library/src/main/java/com/mikepenz/materialize/Materialize.java | Materialize.setStatusBarColor | public void setStatusBarColor(int statusBarColor) {
if (mBuilder.mScrimInsetsLayout != null) {
mBuilder.mScrimInsetsLayout.setInsetForeground(statusBarColor);
mBuilder.mScrimInsetsLayout.getView().invalidate();
}
} | java | public void setStatusBarColor(int statusBarColor) {
if (mBuilder.mScrimInsetsLayout != null) {
mBuilder.mScrimInsetsLayout.setInsetForeground(statusBarColor);
mBuilder.mScrimInsetsLayout.getView().invalidate();
}
} | [
"public",
"void",
"setStatusBarColor",
"(",
"int",
"statusBarColor",
")",
"{",
"if",
"(",
"mBuilder",
".",
"mScrimInsetsLayout",
"!=",
"null",
")",
"{",
"mBuilder",
".",
"mScrimInsetsLayout",
".",
"setInsetForeground",
"(",
"statusBarColor",
")",
";",
"mBuilder",
... | Set the color for the statusBar
@param statusBarColor | [
"Set",
"the",
"color",
"for",
"the",
"statusBar"
] | 2612c10c7570191a78d57f23620e945d61370e3d | https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/Materialize.java#L65-L70 | train |
mikepenz/Materialize | library/src/main/java/com/mikepenz/materialize/Materialize.java | Materialize.keyboardSupportEnabled | public void keyboardSupportEnabled(Activity activity, boolean enable) {
if (getContent() != null && getContent().getChildCount() > 0) {
if (mKeyboardUtil == null) {
mKeyboardUtil = new KeyboardUtil(activity, getContent().getChildAt(0));
mKeyboardUtil.disable();
... | java | public void keyboardSupportEnabled(Activity activity, boolean enable) {
if (getContent() != null && getContent().getChildCount() > 0) {
if (mKeyboardUtil == null) {
mKeyboardUtil = new KeyboardUtil(activity, getContent().getChildAt(0));
mKeyboardUtil.disable();
... | [
"public",
"void",
"keyboardSupportEnabled",
"(",
"Activity",
"activity",
",",
"boolean",
"enable",
")",
"{",
"if",
"(",
"getContent",
"(",
")",
"!=",
"null",
"&&",
"getContent",
"(",
")",
".",
"getChildCount",
"(",
")",
">",
"0",
")",
"{",
"if",
"(",
"... | a helper method to enable the keyboardUtil for a specific activity
or disable it. note this will cause some frame drops because of the
listener.
@param activity
@param enable | [
"a",
"helper",
"method",
"to",
"enable",
"the",
"keyboardUtil",
"for",
"a",
"specific",
"activity",
"or",
"disable",
"it",
".",
"note",
"this",
"will",
"cause",
"some",
"frame",
"drops",
"because",
"of",
"the",
"listener",
"."
] | 2612c10c7570191a78d57f23620e945d61370e3d | https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/Materialize.java#L99-L112 | train |
mikepenz/Materialize | library/src/main/java/com/mikepenz/materialize/holder/ColorHolder.java | ColorHolder.applyTo | public void applyTo(Context ctx, GradientDrawable drawable) {
if (mColorInt != 0) {
drawable.setColor(mColorInt);
} else if (mColorRes != -1) {
drawable.setColor(ContextCompat.getColor(ctx, mColorRes));
}
} | java | public void applyTo(Context ctx, GradientDrawable drawable) {
if (mColorInt != 0) {
drawable.setColor(mColorInt);
} else if (mColorRes != -1) {
drawable.setColor(ContextCompat.getColor(ctx, mColorRes));
}
} | [
"public",
"void",
"applyTo",
"(",
"Context",
"ctx",
",",
"GradientDrawable",
"drawable",
")",
"{",
"if",
"(",
"mColorInt",
"!=",
"0",
")",
"{",
"drawable",
".",
"setColor",
"(",
"mColorInt",
")",
";",
"}",
"else",
"if",
"(",
"mColorRes",
"!=",
"-",
"1"... | set the textColor of the ColorHolder to an drawable
@param ctx
@param drawable | [
"set",
"the",
"textColor",
"of",
"the",
"ColorHolder",
"to",
"an",
"drawable"
] | 2612c10c7570191a78d57f23620e945d61370e3d | https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/holder/ColorHolder.java#L61-L67 | train |
mikepenz/Materialize | library/src/main/java/com/mikepenz/materialize/holder/ColorHolder.java | ColorHolder.applyToBackground | public void applyToBackground(View view) {
if (mColorInt != 0) {
view.setBackgroundColor(mColorInt);
} else if (mColorRes != -1) {
view.setBackgroundResource(mColorRes);
}
} | java | public void applyToBackground(View view) {
if (mColorInt != 0) {
view.setBackgroundColor(mColorInt);
} else if (mColorRes != -1) {
view.setBackgroundResource(mColorRes);
}
} | [
"public",
"void",
"applyToBackground",
"(",
"View",
"view",
")",
"{",
"if",
"(",
"mColorInt",
"!=",
"0",
")",
"{",
"view",
".",
"setBackgroundColor",
"(",
"mColorInt",
")",
";",
"}",
"else",
"if",
"(",
"mColorRes",
"!=",
"-",
"1",
")",
"{",
"view",
"... | set the textColor of the ColorHolder to a view
@param view | [
"set",
"the",
"textColor",
"of",
"the",
"ColorHolder",
"to",
"a",
"view"
] | 2612c10c7570191a78d57f23620e945d61370e3d | https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/holder/ColorHolder.java#L75-L81 | train |
mikepenz/Materialize | library/src/main/java/com/mikepenz/materialize/holder/ColorHolder.java | ColorHolder.applyToOr | public void applyToOr(TextView textView, ColorStateList colorDefault) {
if (mColorInt != 0) {
textView.setTextColor(mColorInt);
} else if (mColorRes != -1) {
textView.setTextColor(ContextCompat.getColor(textView.getContext(), mColorRes));
} else if (colorDefault != null) ... | java | public void applyToOr(TextView textView, ColorStateList colorDefault) {
if (mColorInt != 0) {
textView.setTextColor(mColorInt);
} else if (mColorRes != -1) {
textView.setTextColor(ContextCompat.getColor(textView.getContext(), mColorRes));
} else if (colorDefault != null) ... | [
"public",
"void",
"applyToOr",
"(",
"TextView",
"textView",
",",
"ColorStateList",
"colorDefault",
")",
"{",
"if",
"(",
"mColorInt",
"!=",
"0",
")",
"{",
"textView",
".",
"setTextColor",
"(",
"mColorInt",
")",
";",
"}",
"else",
"if",
"(",
"mColorRes",
"!="... | a small helper to set the text color to a textView null save
@param textView
@param colorDefault | [
"a",
"small",
"helper",
"to",
"set",
"the",
"text",
"color",
"to",
"a",
"textView",
"null",
"save"
] | 2612c10c7570191a78d57f23620e945d61370e3d | https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/holder/ColorHolder.java#L89-L97 | train |
mikepenz/Materialize | library/src/main/java/com/mikepenz/materialize/holder/ColorHolder.java | ColorHolder.color | public int color(Context ctx) {
if (mColorInt == 0 && mColorRes != -1) {
mColorInt = ContextCompat.getColor(ctx, mColorRes);
}
return mColorInt;
} | java | public int color(Context ctx) {
if (mColorInt == 0 && mColorRes != -1) {
mColorInt = ContextCompat.getColor(ctx, mColorRes);
}
return mColorInt;
} | [
"public",
"int",
"color",
"(",
"Context",
"ctx",
")",
"{",
"if",
"(",
"mColorInt",
"==",
"0",
"&&",
"mColorRes",
"!=",
"-",
"1",
")",
"{",
"mColorInt",
"=",
"ContextCompat",
".",
"getColor",
"(",
"ctx",
",",
"mColorRes",
")",
";",
"}",
"return",
"mCo... | a small helper to get the color from the colorHolder
@param ctx
@return | [
"a",
"small",
"helper",
"to",
"get",
"the",
"color",
"from",
"the",
"colorHolder"
] | 2612c10c7570191a78d57f23620e945d61370e3d | https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/holder/ColorHolder.java#L123-L128 | train |
mikepenz/Materialize | library/src/main/java/com/mikepenz/materialize/holder/ColorHolder.java | ColorHolder.color | public static int color(ColorHolder colorHolder, Context ctx) {
if (colorHolder == null) {
return 0;
} else {
return colorHolder.color(ctx);
}
} | java | public static int color(ColorHolder colorHolder, Context ctx) {
if (colorHolder == null) {
return 0;
} else {
return colorHolder.color(ctx);
}
} | [
"public",
"static",
"int",
"color",
"(",
"ColorHolder",
"colorHolder",
",",
"Context",
"ctx",
")",
"{",
"if",
"(",
"colorHolder",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"else",
"{",
"return",
"colorHolder",
".",
"color",
"(",
"ctx",
")",
";",... | a small static helper class to get the color from the colorHolder
@param colorHolder
@param ctx
@return | [
"a",
"small",
"static",
"helper",
"class",
"to",
"get",
"the",
"color",
"from",
"the",
"colorHolder"
] | 2612c10c7570191a78d57f23620e945d61370e3d | https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/holder/ColorHolder.java#L154-L160 | train |
mikepenz/Materialize | library/src/main/java/com/mikepenz/materialize/holder/ColorHolder.java | ColorHolder.applyToOr | public static void applyToOr(ColorHolder colorHolder, TextView textView, ColorStateList colorDefault) {
if (colorHolder != null && textView != null) {
colorHolder.applyToOr(textView, colorDefault);
} else if (textView != null) {
textView.setTextColor(colorDefault);
}
... | java | public static void applyToOr(ColorHolder colorHolder, TextView textView, ColorStateList colorDefault) {
if (colorHolder != null && textView != null) {
colorHolder.applyToOr(textView, colorDefault);
} else if (textView != null) {
textView.setTextColor(colorDefault);
}
... | [
"public",
"static",
"void",
"applyToOr",
"(",
"ColorHolder",
"colorHolder",
",",
"TextView",
"textView",
",",
"ColorStateList",
"colorDefault",
")",
"{",
"if",
"(",
"colorHolder",
"!=",
"null",
"&&",
"textView",
"!=",
"null",
")",
"{",
"colorHolder",
".",
"app... | a small static helper to set the text color to a textView null save
@param colorHolder
@param textView
@param colorDefault | [
"a",
"small",
"static",
"helper",
"to",
"set",
"the",
"text",
"color",
"to",
"a",
"textView",
"null",
"save"
] | 2612c10c7570191a78d57f23620e945d61370e3d | https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/holder/ColorHolder.java#L169-L175 | train |
mikepenz/Materialize | library/src/main/java/com/mikepenz/materialize/holder/ColorHolder.java | ColorHolder.applyToOrTransparent | public static void applyToOrTransparent(ColorHolder colorHolder, Context ctx, GradientDrawable gradientDrawable) {
if (colorHolder != null && gradientDrawable != null) {
colorHolder.applyTo(ctx, gradientDrawable);
} else if (gradientDrawable != null) {
gradientDrawable.setColor(C... | java | public static void applyToOrTransparent(ColorHolder colorHolder, Context ctx, GradientDrawable gradientDrawable) {
if (colorHolder != null && gradientDrawable != null) {
colorHolder.applyTo(ctx, gradientDrawable);
} else if (gradientDrawable != null) {
gradientDrawable.setColor(C... | [
"public",
"static",
"void",
"applyToOrTransparent",
"(",
"ColorHolder",
"colorHolder",
",",
"Context",
"ctx",
",",
"GradientDrawable",
"gradientDrawable",
")",
"{",
"if",
"(",
"colorHolder",
"!=",
"null",
"&&",
"gradientDrawable",
"!=",
"null",
")",
"{",
"colorHol... | a small static helper to set the color to a GradientDrawable null save
@param colorHolder
@param ctx
@param gradientDrawable | [
"a",
"small",
"static",
"helper",
"to",
"set",
"the",
"color",
"to",
"a",
"GradientDrawable",
"null",
"save"
] | 2612c10c7570191a78d57f23620e945d61370e3d | https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/holder/ColorHolder.java#L184-L190 | train |
mikepenz/Materialize | library/src/main/java/com/mikepenz/materialize/holder/ImageHolder.java | ImageHolder.applyTo | public static boolean applyTo(ImageHolder imageHolder, ImageView imageView, String tag) {
if (imageHolder != null && imageView != null) {
return imageHolder.applyTo(imageView, tag);
}
return false;
} | java | public static boolean applyTo(ImageHolder imageHolder, ImageView imageView, String tag) {
if (imageHolder != null && imageView != null) {
return imageHolder.applyTo(imageView, tag);
}
return false;
} | [
"public",
"static",
"boolean",
"applyTo",
"(",
"ImageHolder",
"imageHolder",
",",
"ImageView",
"imageView",
",",
"String",
"tag",
")",
"{",
"if",
"(",
"imageHolder",
"!=",
"null",
"&&",
"imageView",
"!=",
"null",
")",
"{",
"return",
"imageHolder",
".",
"appl... | a small static helper to set the image from the imageHolder nullSave to the imageView
@param imageHolder
@param imageView
@param tag used to identify imageViews and define different placeholders
@return true if an image was set | [
"a",
"small",
"static",
"helper",
"to",
"set",
"the",
"image",
"from",
"the",
"imageHolder",
"nullSave",
"to",
"the",
"imageView"
] | 2612c10c7570191a78d57f23620e945d61370e3d | https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/holder/ImageHolder.java#L170-L175 | train |
mikepenz/Materialize | library/src/main/java/com/mikepenz/materialize/holder/ImageHolder.java | ImageHolder.decideIcon | public static Drawable decideIcon(ImageHolder imageHolder, Context ctx, int iconColor, boolean tint) {
if (imageHolder == null) {
return null;
} else {
return imageHolder.decideIcon(ctx, iconColor, tint);
}
} | java | public static Drawable decideIcon(ImageHolder imageHolder, Context ctx, int iconColor, boolean tint) {
if (imageHolder == null) {
return null;
} else {
return imageHolder.decideIcon(ctx, iconColor, tint);
}
} | [
"public",
"static",
"Drawable",
"decideIcon",
"(",
"ImageHolder",
"imageHolder",
",",
"Context",
"ctx",
",",
"int",
"iconColor",
",",
"boolean",
"tint",
")",
"{",
"if",
"(",
"imageHolder",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
... | a small static helper which catches nulls for us
@param imageHolder
@param ctx
@param iconColor
@param tint
@return | [
"a",
"small",
"static",
"helper",
"which",
"catches",
"nulls",
"for",
"us"
] | 2612c10c7570191a78d57f23620e945d61370e3d | https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/holder/ImageHolder.java#L243-L249 | train |
mikepenz/Materialize | library/src/main/java/com/mikepenz/materialize/holder/ImageHolder.java | ImageHolder.applyDecidedIconOrSetGone | public static void applyDecidedIconOrSetGone(ImageHolder imageHolder, ImageView imageView, int iconColor, boolean tint) {
if (imageHolder != null && imageView != null) {
Drawable drawable = ImageHolder.decideIcon(imageHolder, imageView.getContext(), iconColor, tint);
if (drawable != null... | java | public static void applyDecidedIconOrSetGone(ImageHolder imageHolder, ImageView imageView, int iconColor, boolean tint) {
if (imageHolder != null && imageView != null) {
Drawable drawable = ImageHolder.decideIcon(imageHolder, imageView.getContext(), iconColor, tint);
if (drawable != null... | [
"public",
"static",
"void",
"applyDecidedIconOrSetGone",
"(",
"ImageHolder",
"imageHolder",
",",
"ImageView",
"imageView",
",",
"int",
"iconColor",
",",
"boolean",
"tint",
")",
"{",
"if",
"(",
"imageHolder",
"!=",
"null",
"&&",
"imageView",
"!=",
"null",
")",
... | decides which icon to apply or hide this view
@param imageHolder
@param imageView
@param iconColor
@param tint | [
"decides",
"which",
"icon",
"to",
"apply",
"or",
"hide",
"this",
"view"
] | 2612c10c7570191a78d57f23620e945d61370e3d | https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/holder/ImageHolder.java#L259-L274 | train |
mikepenz/Materialize | library/src/main/java/com/mikepenz/materialize/holder/ImageHolder.java | ImageHolder.applyMultiIconTo | public static void applyMultiIconTo(Drawable icon, int iconColor, Drawable selectedIcon, int selectedIconColor, boolean tinted, ImageView imageView) {
//if we have an icon then we want to set it
if (icon != null) {
//if we got a different color for the selectedIcon we need a StateList
... | java | public static void applyMultiIconTo(Drawable icon, int iconColor, Drawable selectedIcon, int selectedIconColor, boolean tinted, ImageView imageView) {
//if we have an icon then we want to set it
if (icon != null) {
//if we got a different color for the selectedIcon we need a StateList
... | [
"public",
"static",
"void",
"applyMultiIconTo",
"(",
"Drawable",
"icon",
",",
"int",
"iconColor",
",",
"Drawable",
"selectedIcon",
",",
"int",
"selectedIconColor",
",",
"boolean",
"tinted",
",",
"ImageView",
"imageView",
")",
"{",
"//if we have an icon then we want to... | a small static helper to set a multi state drawable on a view
@param icon
@param iconColor
@param selectedIcon
@param selectedIconColor
@param tinted
@param imageView | [
"a",
"small",
"static",
"helper",
"to",
"set",
"a",
"multi",
"state",
"drawable",
"on",
"a",
"view"
] | 2612c10c7570191a78d57f23620e945d61370e3d | https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/holder/ImageHolder.java#L286-L307 | train |
blackfizz/EazeGraph | EazeGraphLibrary/src/main/java/org/eazegraph/lib/charts/PieChart.java | PieChart.setHighlightStrength | public void setHighlightStrength(float _highlightStrength) {
mHighlightStrength = _highlightStrength;
for (PieModel model : mPieData) {
highlightSlice(model);
}
invalidateGlobal();
} | java | public void setHighlightStrength(float _highlightStrength) {
mHighlightStrength = _highlightStrength;
for (PieModel model : mPieData) {
highlightSlice(model);
}
invalidateGlobal();
} | [
"public",
"void",
"setHighlightStrength",
"(",
"float",
"_highlightStrength",
")",
"{",
"mHighlightStrength",
"=",
"_highlightStrength",
";",
"for",
"(",
"PieModel",
"model",
":",
"mPieData",
")",
"{",
"highlightSlice",
"(",
"model",
")",
";",
"}",
"invalidateGlob... | Sets the highlight strength for the InnerPaddingOutline.
@param _highlightStrength The highlighting value for the outline. | [
"Sets",
"the",
"highlight",
"strength",
"for",
"the",
"InnerPaddingOutline",
"."
] | ce5e68ecc70e154f83bbb2fcce1a970db125c1e6 | https://github.com/blackfizz/EazeGraph/blob/ce5e68ecc70e154f83bbb2fcce1a970db125c1e6/EazeGraphLibrary/src/main/java/org/eazegraph/lib/charts/PieChart.java#L256-L262 | train |
blackfizz/EazeGraph | EazeGraphLibrary/src/main/java/org/eazegraph/lib/charts/PieChart.java | PieChart.addPieSlice | public void addPieSlice(PieModel _Slice) {
highlightSlice(_Slice);
mPieData.add(_Slice);
mTotalValue += _Slice.getValue();
onDataChanged();
} | java | public void addPieSlice(PieModel _Slice) {
highlightSlice(_Slice);
mPieData.add(_Slice);
mTotalValue += _Slice.getValue();
onDataChanged();
} | [
"public",
"void",
"addPieSlice",
"(",
"PieModel",
"_Slice",
")",
"{",
"highlightSlice",
"(",
"_Slice",
")",
";",
"mPieData",
".",
"add",
"(",
"_Slice",
")",
";",
"mTotalValue",
"+=",
"_Slice",
".",
"getValue",
"(",
")",
";",
"onDataChanged",
"(",
")",
";... | Adds a new Pie Slice to the PieChart. After inserting and calculation of the highlighting color
a complete recalculation is initiated.
@param _Slice The newly added PieSlice. | [
"Adds",
"a",
"new",
"Pie",
"Slice",
"to",
"the",
"PieChart",
".",
"After",
"inserting",
"and",
"calculation",
"of",
"the",
"highlighting",
"color",
"a",
"complete",
"recalculation",
"is",
"initiated",
"."
] | ce5e68ecc70e154f83bbb2fcce1a970db125c1e6 | https://github.com/blackfizz/EazeGraph/blob/ce5e68ecc70e154f83bbb2fcce1a970db125c1e6/EazeGraphLibrary/src/main/java/org/eazegraph/lib/charts/PieChart.java#L499-L504 | train |
blackfizz/EazeGraph | EazeGraphLibrary/src/main/java/org/eazegraph/lib/charts/PieChart.java | PieChart.onDraw | @Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
// If the API level is less than 11, we can't rely on the view animation system to
// do the scrolling animation. Need to tick it here and call postInvalidate() until the scrolling is done.
if (Build.VERSION.SDK_... | java | @Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
// If the API level is less than 11, we can't rely on the view animation system to
// do the scrolling animation. Need to tick it here and call postInvalidate() until the scrolling is done.
if (Build.VERSION.SDK_... | [
"@",
"Override",
"protected",
"void",
"onDraw",
"(",
"Canvas",
"canvas",
")",
"{",
"super",
".",
"onDraw",
"(",
"canvas",
")",
";",
"// If the API level is less than 11, we can't rely on the view animation system to",
"// do the scrolling animation. Need to tick it here and call ... | Implement this to do your drawing.
@param canvas the canvas on which the background will be drawn | [
"Implement",
"this",
"to",
"do",
"your",
"drawing",
"."
] | ce5e68ecc70e154f83bbb2fcce1a970db125c1e6 | https://github.com/blackfizz/EazeGraph/blob/ce5e68ecc70e154f83bbb2fcce1a970db125c1e6/EazeGraphLibrary/src/main/java/org/eazegraph/lib/charts/PieChart.java#L559-L571 | train |
blackfizz/EazeGraph | EazeGraphLibrary/src/main/java/org/eazegraph/lib/charts/PieChart.java | PieChart.onDataChanged | @Override
protected void onDataChanged() {
super.onDataChanged();
int currentAngle = 0;
int index = 0;
int size = mPieData.size();
for (PieModel model : mPieData) {
int endAngle = (int) (currentAngle + model.getValue() * 360.f / mTotalValue);
if(inde... | java | @Override
protected void onDataChanged() {
super.onDataChanged();
int currentAngle = 0;
int index = 0;
int size = mPieData.size();
for (PieModel model : mPieData) {
int endAngle = (int) (currentAngle + model.getValue() * 360.f / mTotalValue);
if(inde... | [
"@",
"Override",
"protected",
"void",
"onDataChanged",
"(",
")",
"{",
"super",
".",
"onDataChanged",
"(",
")",
";",
"int",
"currentAngle",
"=",
"0",
";",
"int",
"index",
"=",
"0",
";",
"int",
"size",
"=",
"mPieData",
".",
"size",
"(",
")",
";",
"for"... | Should be called after new data is inserted. Will be automatically called, when the view dimensions
has changed.
Calculates the start- and end-angles for every PieSlice. | [
"Should",
"be",
"called",
"after",
"new",
"data",
"is",
"inserted",
".",
"Will",
"be",
"automatically",
"called",
"when",
"the",
"view",
"dimensions",
"has",
"changed",
"."
] | ce5e68ecc70e154f83bbb2fcce1a970db125c1e6 | https://github.com/blackfizz/EazeGraph/blob/ce5e68ecc70e154f83bbb2fcce1a970db125c1e6/EazeGraphLibrary/src/main/java/org/eazegraph/lib/charts/PieChart.java#L717-L738 | train |
blackfizz/EazeGraph | EazeGraphLibrary/src/main/java/org/eazegraph/lib/charts/PieChart.java | PieChart.highlightSlice | private void highlightSlice(PieModel _Slice) {
int color = _Slice.getColor();
_Slice.setHighlightedColor(Color.argb(
0xff,
Math.min((int) (mHighlightStrength * (float) Color.red(color)), 0xff),
Math.min((int) (mHighlightStrength * (float) Color.green(colo... | java | private void highlightSlice(PieModel _Slice) {
int color = _Slice.getColor();
_Slice.setHighlightedColor(Color.argb(
0xff,
Math.min((int) (mHighlightStrength * (float) Color.red(color)), 0xff),
Math.min((int) (mHighlightStrength * (float) Color.green(colo... | [
"private",
"void",
"highlightSlice",
"(",
"PieModel",
"_Slice",
")",
"{",
"int",
"color",
"=",
"_Slice",
".",
"getColor",
"(",
")",
";",
"_Slice",
".",
"setHighlightedColor",
"(",
"Color",
".",
"argb",
"(",
"0xff",
",",
"Math",
".",
"min",
"(",
"(",
"i... | Calculate the highlight color. Saturate at 0xff to make sure that high values
don't result in aliasing.
@param _Slice The Slice which will be highlighted. | [
"Calculate",
"the",
"highlight",
"color",
".",
"Saturate",
"at",
"0xff",
"to",
"make",
"sure",
"that",
"high",
"values",
"don",
"t",
"result",
"in",
"aliasing",
"."
] | ce5e68ecc70e154f83bbb2fcce1a970db125c1e6 | https://github.com/blackfizz/EazeGraph/blob/ce5e68ecc70e154f83bbb2fcce1a970db125c1e6/EazeGraphLibrary/src/main/java/org/eazegraph/lib/charts/PieChart.java#L746-L755 | train |
blackfizz/EazeGraph | EazeGraphLibrary/src/main/java/org/eazegraph/lib/charts/PieChart.java | PieChart.calcCurrentItem | private void calcCurrentItem() {
int pointerAngle;
// calculate the correct pointer angle, depending on clockwise drawing or not
if(mOpenClockwise) {
pointerAngle = (mIndicatorAngle + 360 - mPieRotation) % 360;
}
else {
pointerAngle = (mIndicatorAngle + 1... | java | private void calcCurrentItem() {
int pointerAngle;
// calculate the correct pointer angle, depending on clockwise drawing or not
if(mOpenClockwise) {
pointerAngle = (mIndicatorAngle + 360 - mPieRotation) % 360;
}
else {
pointerAngle = (mIndicatorAngle + 1... | [
"private",
"void",
"calcCurrentItem",
"(",
")",
"{",
"int",
"pointerAngle",
";",
"// calculate the correct pointer angle, depending on clockwise drawing or not",
"if",
"(",
"mOpenClockwise",
")",
"{",
"pointerAngle",
"=",
"(",
"mIndicatorAngle",
"+",
"360",
"-",
"mPieRota... | Calculate which pie slice is under the pointer, and set the current item
field accordingly. | [
"Calculate",
"which",
"pie",
"slice",
"is",
"under",
"the",
"pointer",
"and",
"set",
"the",
"current",
"item",
"field",
"accordingly",
"."
] | ce5e68ecc70e154f83bbb2fcce1a970db125c1e6 | https://github.com/blackfizz/EazeGraph/blob/ce5e68ecc70e154f83bbb2fcce1a970db125c1e6/EazeGraphLibrary/src/main/java/org/eazegraph/lib/charts/PieChart.java#L761-L781 | train |
blackfizz/EazeGraph | EazeGraphLibrary/src/main/java/org/eazegraph/lib/charts/PieChart.java | PieChart.centerOnCurrentItem | private void centerOnCurrentItem() {
if(!mPieData.isEmpty()) {
PieModel current = mPieData.get(getCurrentItem());
int targetAngle;
if(mOpenClockwise) {
targetAngle = (mIndicatorAngle - current.getStartAngle()) - ((current.getEndAngle() - current.getStartAngle... | java | private void centerOnCurrentItem() {
if(!mPieData.isEmpty()) {
PieModel current = mPieData.get(getCurrentItem());
int targetAngle;
if(mOpenClockwise) {
targetAngle = (mIndicatorAngle - current.getStartAngle()) - ((current.getEndAngle() - current.getStartAngle... | [
"private",
"void",
"centerOnCurrentItem",
"(",
")",
"{",
"if",
"(",
"!",
"mPieData",
".",
"isEmpty",
"(",
")",
")",
"{",
"PieModel",
"current",
"=",
"mPieData",
".",
"get",
"(",
"getCurrentItem",
"(",
")",
")",
";",
"int",
"targetAngle",
";",
"if",
"("... | Kicks off an animation that will result in the pointer being centered in the
pie slice of the currently selected item. | [
"Kicks",
"off",
"an",
"animation",
"that",
"will",
"result",
"in",
"the",
"pointer",
"being",
"centered",
"in",
"the",
"pie",
"slice",
"of",
"the",
"currently",
"selected",
"item",
"."
] | ce5e68ecc70e154f83bbb2fcce1a970db125c1e6 | https://github.com/blackfizz/EazeGraph/blob/ce5e68ecc70e154f83bbb2fcce1a970db125c1e6/EazeGraphLibrary/src/main/java/org/eazegraph/lib/charts/PieChart.java#L819-L838 | train |
blackfizz/EazeGraph | EazeGraphLibrary/src/main/java/org/eazegraph/lib/charts/ValueLineChart.java | ValueLineChart.onLegendDataChanged | protected void onLegendDataChanged() {
int legendCount = mLegendList.size();
float margin = (mGraphWidth / legendCount);
float currentOffset = 0;
for (LegendModel model : mLegendList) {
model.setLegendBounds(new RectF(currentOffset, 0, currentOffset + margin, mLegendHeigh... | java | protected void onLegendDataChanged() {
int legendCount = mLegendList.size();
float margin = (mGraphWidth / legendCount);
float currentOffset = 0;
for (LegendModel model : mLegendList) {
model.setLegendBounds(new RectF(currentOffset, 0, currentOffset + margin, mLegendHeigh... | [
"protected",
"void",
"onLegendDataChanged",
"(",
")",
"{",
"int",
"legendCount",
"=",
"mLegendList",
".",
"size",
"(",
")",
";",
"float",
"margin",
"=",
"(",
"mGraphWidth",
"/",
"legendCount",
")",
";",
"float",
"currentOffset",
"=",
"0",
";",
"for",
"(",
... | Calculates the legend bounds for a custom list of legends. | [
"Calculates",
"the",
"legend",
"bounds",
"for",
"a",
"custom",
"list",
"of",
"legends",
"."
] | ce5e68ecc70e154f83bbb2fcce1a970db125c1e6 | https://github.com/blackfizz/EazeGraph/blob/ce5e68ecc70e154f83bbb2fcce1a970db125c1e6/EazeGraphLibrary/src/main/java/org/eazegraph/lib/charts/ValueLineChart.java#L958-L972 | train |
blackfizz/EazeGraph | EazeGraphLibrary/src/main/java/org/eazegraph/lib/charts/ValueLineChart.java | ValueLineChart.calculateValueTextHeight | private void calculateValueTextHeight() {
Rect valueRect = new Rect();
Rect legendRect = new Rect();
String str = Utils.getFloatString(mFocusedPoint.getValue(), mShowDecimal) + (!mIndicatorTextUnit.isEmpty() ? " " + mIndicatorTextUnit : "");
// calculate the boundaries for both texts
... | java | private void calculateValueTextHeight() {
Rect valueRect = new Rect();
Rect legendRect = new Rect();
String str = Utils.getFloatString(mFocusedPoint.getValue(), mShowDecimal) + (!mIndicatorTextUnit.isEmpty() ? " " + mIndicatorTextUnit : "");
// calculate the boundaries for both texts
... | [
"private",
"void",
"calculateValueTextHeight",
"(",
")",
"{",
"Rect",
"valueRect",
"=",
"new",
"Rect",
"(",
")",
";",
"Rect",
"legendRect",
"=",
"new",
"Rect",
"(",
")",
";",
"String",
"str",
"=",
"Utils",
".",
"getFloatString",
"(",
"mFocusedPoint",
".",
... | Calculates the text height for the indicator value and sets its x-coordinate. | [
"Calculates",
"the",
"text",
"height",
"for",
"the",
"indicator",
"value",
"and",
"sets",
"its",
"x",
"-",
"coordinate",
"."
] | ce5e68ecc70e154f83bbb2fcce1a970db125c1e6 | https://github.com/blackfizz/EazeGraph/blob/ce5e68ecc70e154f83bbb2fcce1a970db125c1e6/EazeGraphLibrary/src/main/java/org/eazegraph/lib/charts/ValueLineChart.java#L977-L1000 | train |
blackfizz/EazeGraph | EazeGraphLibrary/src/main/java/org/eazegraph/lib/charts/BaseBarChart.java | BaseBarChart.calculateBarPositions | protected void calculateBarPositions(int _DataSize) {
int dataSize = mScrollEnabled ? mVisibleBars : _DataSize;
float barWidth = mBarWidth;
float margin = mBarMargin;
if (!mFixedBarWidth) {
// calculate the bar width if the bars should be dynamically displayed
... | java | protected void calculateBarPositions(int _DataSize) {
int dataSize = mScrollEnabled ? mVisibleBars : _DataSize;
float barWidth = mBarWidth;
float margin = mBarMargin;
if (!mFixedBarWidth) {
// calculate the bar width if the bars should be dynamically displayed
... | [
"protected",
"void",
"calculateBarPositions",
"(",
"int",
"_DataSize",
")",
"{",
"int",
"dataSize",
"=",
"mScrollEnabled",
"?",
"mVisibleBars",
":",
"_DataSize",
";",
"float",
"barWidth",
"=",
"mBarWidth",
";",
"float",
"margin",
"=",
"mBarMargin",
";",
"if",
... | Calculates the bar width and bar margin based on the _DataSize and settings and starts the boundary
calculation in child classes.
@param _DataSize Amount of data sets | [
"Calculates",
"the",
"bar",
"width",
"and",
"bar",
"margin",
"based",
"on",
"the",
"_DataSize",
"and",
"settings",
"and",
"starts",
"the",
"boundary",
"calculation",
"in",
"child",
"classes",
"."
] | ce5e68ecc70e154f83bbb2fcce1a970db125c1e6 | https://github.com/blackfizz/EazeGraph/blob/ce5e68ecc70e154f83bbb2fcce1a970db125c1e6/EazeGraphLibrary/src/main/java/org/eazegraph/lib/charts/BaseBarChart.java#L322-L356 | train |
blackfizz/EazeGraph | EazeGraphLibrary/src/main/java/org/eazegraph/lib/charts/BaseBarChart.java | BaseBarChart.onGraphDraw | @Override
protected void onGraphDraw(Canvas _Canvas) {
super.onGraphDraw(_Canvas);
_Canvas.translate(-mCurrentViewport.left, -mCurrentViewport.top);
drawBars(_Canvas);
} | java | @Override
protected void onGraphDraw(Canvas _Canvas) {
super.onGraphDraw(_Canvas);
_Canvas.translate(-mCurrentViewport.left, -mCurrentViewport.top);
drawBars(_Canvas);
} | [
"@",
"Override",
"protected",
"void",
"onGraphDraw",
"(",
"Canvas",
"_Canvas",
")",
"{",
"super",
".",
"onGraphDraw",
"(",
"_Canvas",
")",
";",
"_Canvas",
".",
"translate",
"(",
"-",
"mCurrentViewport",
".",
"left",
",",
"-",
"mCurrentViewport",
".",
"top",
... | region Override Methods | [
"region",
"Override",
"Methods"
] | ce5e68ecc70e154f83bbb2fcce1a970db125c1e6 | https://github.com/blackfizz/EazeGraph/blob/ce5e68ecc70e154f83bbb2fcce1a970db125c1e6/EazeGraphLibrary/src/main/java/org/eazegraph/lib/charts/BaseBarChart.java#L467-L472 | train |
blackfizz/EazeGraph | EazeGraphLibrary/src/main/java/org/eazegraph/lib/utils/Utils.java | Utils.calculatePointDiff | public static void calculatePointDiff(Point2D _P1, Point2D _P2, Point2D _Result, float _Multiplier) {
float diffX = _P2.getX() - _P1.getX();
float diffY = _P2.getY() - _P1.getY();
_Result.setX(_P1.getX() + (diffX * _Multiplier));
_Result.setY(_P1.getY() + (diffY * _Multiplier));
} | java | public static void calculatePointDiff(Point2D _P1, Point2D _P2, Point2D _Result, float _Multiplier) {
float diffX = _P2.getX() - _P1.getX();
float diffY = _P2.getY() - _P1.getY();
_Result.setX(_P1.getX() + (diffX * _Multiplier));
_Result.setY(_P1.getY() + (diffY * _Multiplier));
} | [
"public",
"static",
"void",
"calculatePointDiff",
"(",
"Point2D",
"_P1",
",",
"Point2D",
"_P2",
",",
"Point2D",
"_Result",
",",
"float",
"_Multiplier",
")",
"{",
"float",
"diffX",
"=",
"_P2",
".",
"getX",
"(",
")",
"-",
"_P1",
".",
"getX",
"(",
")",
";... | Calculates the middle point between two points and multiplies its coordinates with the given
smoothness _Mulitplier.
@param _P1 First point
@param _P2 Second point
@param _Result Resulting point
@param _Multiplier Smoothness multiplier | [
"Calculates",
"the",
"middle",
"point",
"between",
"two",
"points",
"and",
"multiplies",
"its",
"coordinates",
"with",
"the",
"given",
"smoothness",
"_Mulitplier",
"."
] | ce5e68ecc70e154f83bbb2fcce1a970db125c1e6 | https://github.com/blackfizz/EazeGraph/blob/ce5e68ecc70e154f83bbb2fcce1a970db125c1e6/EazeGraphLibrary/src/main/java/org/eazegraph/lib/utils/Utils.java#L58-L63 | train |
blackfizz/EazeGraph | EazeGraphLibrary/src/main/java/org/eazegraph/lib/utils/Utils.java | Utils.calculateLegendInformation | public static void calculateLegendInformation(List<? extends BaseModel> _Models, float _StartX, float _EndX, Paint _Paint) {
float textMargin = Utils.dpToPx(10.f);
float lastX = _StartX;
// calculate the legend label positions and check if there is enough space to display the label,
// ... | java | public static void calculateLegendInformation(List<? extends BaseModel> _Models, float _StartX, float _EndX, Paint _Paint) {
float textMargin = Utils.dpToPx(10.f);
float lastX = _StartX;
// calculate the legend label positions and check if there is enough space to display the label,
// ... | [
"public",
"static",
"void",
"calculateLegendInformation",
"(",
"List",
"<",
"?",
"extends",
"BaseModel",
">",
"_Models",
",",
"float",
"_StartX",
",",
"float",
"_EndX",
",",
"Paint",
"_Paint",
")",
"{",
"float",
"textMargin",
"=",
"Utils",
".",
"dpToPx",
"("... | Calculates the legend positions and which legend title should be displayed or not.
Important: the LegendBounds in the _Models should be set and correctly calculated before this
function is called!
@param _Models The graph data which should have the BaseModel class as parent class.
@param _StartX Left starting point on... | [
"Calculates",
"the",
"legend",
"positions",
"and",
"which",
"legend",
"title",
"should",
"be",
"displayed",
"or",
"not",
"."
] | ce5e68ecc70e154f83bbb2fcce1a970db125c1e6 | https://github.com/blackfizz/EazeGraph/blob/ce5e68ecc70e154f83bbb2fcce1a970db125c1e6/EazeGraphLibrary/src/main/java/org/eazegraph/lib/utils/Utils.java#L98-L140 | train |
blackfizz/EazeGraph | EazeGraphLibrary/src/main/java/org/eazegraph/lib/utils/Utils.java | Utils.calculateMaxTextHeight | public static float calculateMaxTextHeight(Paint _Paint, String _Text) {
Rect height = new Rect();
String text = _Text == null ? "MgHITasger" : _Text;
_Paint.getTextBounds(text, 0, text.length(), height);
return height.height();
} | java | public static float calculateMaxTextHeight(Paint _Paint, String _Text) {
Rect height = new Rect();
String text = _Text == null ? "MgHITasger" : _Text;
_Paint.getTextBounds(text, 0, text.length(), height);
return height.height();
} | [
"public",
"static",
"float",
"calculateMaxTextHeight",
"(",
"Paint",
"_Paint",
",",
"String",
"_Text",
")",
"{",
"Rect",
"height",
"=",
"new",
"Rect",
"(",
")",
";",
"String",
"text",
"=",
"_Text",
"==",
"null",
"?",
"\"MgHITasger\"",
":",
"_Text",
";",
... | Calculates the maximum text height which is possible based on the used Paint and its settings.
@param _Paint Paint object which will be used to display a text.
@param _Text The text which should be measured. If null, a default text is chosen, which
has a maximum possible height
@return Maximum text height in px. | [
"Calculates",
"the",
"maximum",
"text",
"height",
"which",
"is",
"possible",
"based",
"on",
"the",
"used",
"Paint",
"and",
"its",
"settings",
"."
] | ce5e68ecc70e154f83bbb2fcce1a970db125c1e6 | https://github.com/blackfizz/EazeGraph/blob/ce5e68ecc70e154f83bbb2fcce1a970db125c1e6/EazeGraphLibrary/src/main/java/org/eazegraph/lib/utils/Utils.java#L165-L170 | train |
blackfizz/EazeGraph | EazeGraphLibrary/src/main/java/org/eazegraph/lib/utils/Utils.java | Utils.intersectsPointWithRectF | public static boolean intersectsPointWithRectF(RectF _Rect, float _X, float _Y) {
return _X > _Rect.left && _X < _Rect.right && _Y > _Rect.top && _Y < _Rect.bottom;
} | java | public static boolean intersectsPointWithRectF(RectF _Rect, float _X, float _Y) {
return _X > _Rect.left && _X < _Rect.right && _Y > _Rect.top && _Y < _Rect.bottom;
} | [
"public",
"static",
"boolean",
"intersectsPointWithRectF",
"(",
"RectF",
"_Rect",
",",
"float",
"_X",
",",
"float",
"_Y",
")",
"{",
"return",
"_X",
">",
"_Rect",
".",
"left",
"&&",
"_X",
"<",
"_Rect",
".",
"right",
"&&",
"_Y",
">",
"_Rect",
".",
"top",... | Checks if a point is in the given rectangle.
@param _Rect rectangle which is checked
@param _X x-coordinate of the point
@param _Y y-coordinate of the point
@return True if the points intersects with the rectangle. | [
"Checks",
"if",
"a",
"point",
"is",
"in",
"the",
"given",
"rectangle",
"."
] | ce5e68ecc70e154f83bbb2fcce1a970db125c1e6 | https://github.com/blackfizz/EazeGraph/blob/ce5e68ecc70e154f83bbb2fcce1a970db125c1e6/EazeGraphLibrary/src/main/java/org/eazegraph/lib/utils/Utils.java#L180-L182 | train |
airbnb/AirMapView | library/src/main/java/com/airbnb/android/airmapview/RuntimePermissionUtils.java | RuntimePermissionUtils.hasSelfPermissions | private static boolean hasSelfPermissions(Context context, String... permissions) {
for (String permission : permissions) {
if (checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED) {
return true;
}
}
return false;
} | java | private static boolean hasSelfPermissions(Context context, String... permissions) {
for (String permission : permissions) {
if (checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED) {
return true;
}
}
return false;
} | [
"private",
"static",
"boolean",
"hasSelfPermissions",
"(",
"Context",
"context",
",",
"String",
"...",
"permissions",
")",
"{",
"for",
"(",
"String",
"permission",
":",
"permissions",
")",
"{",
"if",
"(",
"checkSelfPermission",
"(",
"context",
",",
"permission",... | Returns true if the context has access to any given permissions. | [
"Returns",
"true",
"if",
"the",
"context",
"has",
"access",
"to",
"any",
"given",
"permissions",
"."
] | f715197db2cc2903e8d70f78385d339c3f6a1c3b | https://github.com/airbnb/AirMapView/blob/f715197db2cc2903e8d70f78385d339c3f6a1c3b/library/src/main/java/com/airbnb/android/airmapview/RuntimePermissionUtils.java#L41-L48 | train |
airbnb/AirMapView | library/src/main/java/com/airbnb/android/airmapview/RuntimePermissionUtils.java | RuntimePermissionUtils.shouldShowRequestPermissionRationale | static boolean shouldShowRequestPermissionRationale(Activity activity, String... permissions) {
for (String permission : permissions) {
if (ActivityCompat.shouldShowRequestPermissionRationale(activity, permission)) {
return true;
}
}
return false;
} | java | static boolean shouldShowRequestPermissionRationale(Activity activity, String... permissions) {
for (String permission : permissions) {
if (ActivityCompat.shouldShowRequestPermissionRationale(activity, permission)) {
return true;
}
}
return false;
} | [
"static",
"boolean",
"shouldShowRequestPermissionRationale",
"(",
"Activity",
"activity",
",",
"String",
"...",
"permissions",
")",
"{",
"for",
"(",
"String",
"permission",
":",
"permissions",
")",
"{",
"if",
"(",
"ActivityCompat",
".",
"shouldShowRequestPermissionRat... | Checks given permissions are needed to show rationale.
@return returns true if one of the permission is needed to show rationale. | [
"Checks",
"given",
"permissions",
"are",
"needed",
"to",
"show",
"rationale",
"."
] | f715197db2cc2903e8d70f78385d339c3f6a1c3b | https://github.com/airbnb/AirMapView/blob/f715197db2cc2903e8d70f78385d339c3f6a1c3b/library/src/main/java/com/airbnb/android/airmapview/RuntimePermissionUtils.java#L55-L62 | train |
airbnb/AirMapView | library/src/main/java/com/airbnb/android/airmapview/DefaultAirMapViewBuilder.java | DefaultAirMapViewBuilder.builder | public AirMapViewBuilder builder(AirMapViewTypes mapType) {
switch (mapType) {
case NATIVE:
if (isNativeMapSupported) {
return new NativeAirMapViewBuilder();
}
break;
case WEB:
return getWebMapViewBuilder();
}
throw new UnsupportedOperationException("Req... | java | public AirMapViewBuilder builder(AirMapViewTypes mapType) {
switch (mapType) {
case NATIVE:
if (isNativeMapSupported) {
return new NativeAirMapViewBuilder();
}
break;
case WEB:
return getWebMapViewBuilder();
}
throw new UnsupportedOperationException("Req... | [
"public",
"AirMapViewBuilder",
"builder",
"(",
"AirMapViewTypes",
"mapType",
")",
"{",
"switch",
"(",
"mapType",
")",
"{",
"case",
"NATIVE",
":",
"if",
"(",
"isNativeMapSupported",
")",
"{",
"return",
"new",
"NativeAirMapViewBuilder",
"(",
")",
";",
"}",
"brea... | Returns the AirMapView implementation as requested by the mapType argument. Use this method if
you need to request a specific AirMapView implementation that is not necessarily the preferred
type. For example, you can use it to explicit request a web-based map implementation.
@param mapType Map type for the requested A... | [
"Returns",
"the",
"AirMapView",
"implementation",
"as",
"requested",
"by",
"the",
"mapType",
"argument",
".",
"Use",
"this",
"method",
"if",
"you",
"need",
"to",
"request",
"a",
"specific",
"AirMapView",
"implementation",
"that",
"is",
"not",
"necessarily",
"the... | f715197db2cc2903e8d70f78385d339c3f6a1c3b | https://github.com/airbnb/AirMapView/blob/f715197db2cc2903e8d70f78385d339c3f6a1c3b/library/src/main/java/com/airbnb/android/airmapview/DefaultAirMapViewBuilder.java#L60-L71 | train |
airbnb/AirMapView | library/src/main/java/com/airbnb/android/airmapview/DefaultAirMapViewBuilder.java | DefaultAirMapViewBuilder.getWebMapViewBuilder | private AirMapViewBuilder getWebMapViewBuilder() {
if (context != null) {
try {
ApplicationInfo ai = context.getPackageManager()
.getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA);
Bundle bundle = ai.metaData;
String accessToken = bundle.getString("... | java | private AirMapViewBuilder getWebMapViewBuilder() {
if (context != null) {
try {
ApplicationInfo ai = context.getPackageManager()
.getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA);
Bundle bundle = ai.metaData;
String accessToken = bundle.getString("... | [
"private",
"AirMapViewBuilder",
"getWebMapViewBuilder",
"(",
")",
"{",
"if",
"(",
"context",
"!=",
"null",
")",
"{",
"try",
"{",
"ApplicationInfo",
"ai",
"=",
"context",
".",
"getPackageManager",
"(",
")",
".",
"getApplicationInfo",
"(",
"context",
".",
"getPa... | Decides what the Map Web provider should be used and generates a builder for it.
@return The AirMapViewBuilder for the selected Map Web provider. | [
"Decides",
"what",
"the",
"Map",
"Web",
"provider",
"should",
"be",
"used",
"and",
"generates",
"a",
"builder",
"for",
"it",
"."
] | f715197db2cc2903e8d70f78385d339c3f6a1c3b | https://github.com/airbnb/AirMapView/blob/f715197db2cc2903e8d70f78385d339c3f6a1c3b/library/src/main/java/com/airbnb/android/airmapview/DefaultAirMapViewBuilder.java#L78-L95 | train |
airbnb/AirMapView | library/src/main/java/com/airbnb/android/airmapview/AirMapView.java | AirMapView.initialize | public void initialize(FragmentManager fragmentManager) {
AirMapInterface mapInterface = (AirMapInterface)
fragmentManager.findFragmentById(R.id.map_frame);
if (mapInterface != null) {
initialize(fragmentManager, mapInterface);
} else {
initialize(fragmentManager, new DefaultAirMapViewB... | java | public void initialize(FragmentManager fragmentManager) {
AirMapInterface mapInterface = (AirMapInterface)
fragmentManager.findFragmentById(R.id.map_frame);
if (mapInterface != null) {
initialize(fragmentManager, mapInterface);
} else {
initialize(fragmentManager, new DefaultAirMapViewB... | [
"public",
"void",
"initialize",
"(",
"FragmentManager",
"fragmentManager",
")",
"{",
"AirMapInterface",
"mapInterface",
"=",
"(",
"AirMapInterface",
")",
"fragmentManager",
".",
"findFragmentById",
"(",
"R",
".",
"id",
".",
"map_frame",
")",
";",
"if",
"(",
"map... | Used for initialization of the underlying map provider.
@param fragmentManager required for initialization | [
"Used",
"for",
"initialization",
"of",
"the",
"underlying",
"map",
"provider",
"."
] | f715197db2cc2903e8d70f78385d339c3f6a1c3b | https://github.com/airbnb/AirMapView/blob/f715197db2cc2903e8d70f78385d339c3f6a1c3b/library/src/main/java/com/airbnb/android/airmapview/AirMapView.java#L85-L94 | train |
SQiShER/java-object-diff | src/main/java/de/danielbechler/diff/introspection/PropertyAccessor.java | PropertyAccessor.getFieldAnnotations | private Set<Annotation> getFieldAnnotations(final Class<?> clazz)
{
try
{
return new LinkedHashSet<Annotation>(asList(clazz.getDeclaredField(propertyName).getAnnotations()));
}
catch (final NoSuchFieldException e)
{
if (clazz.getSuperclass() != null)
{
return getFieldAnnotations(clazz.getSupercl... | java | private Set<Annotation> getFieldAnnotations(final Class<?> clazz)
{
try
{
return new LinkedHashSet<Annotation>(asList(clazz.getDeclaredField(propertyName).getAnnotations()));
}
catch (final NoSuchFieldException e)
{
if (clazz.getSuperclass() != null)
{
return getFieldAnnotations(clazz.getSupercl... | [
"private",
"Set",
"<",
"Annotation",
">",
"getFieldAnnotations",
"(",
"final",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"try",
"{",
"return",
"new",
"LinkedHashSet",
"<",
"Annotation",
">",
"(",
"asList",
"(",
"clazz",
".",
"getDeclaredField",
"(",
"prop... | Private function to allow looking for the field recursively up the superclasses.
@param clazz
@return | [
"Private",
"function",
"to",
"allow",
"looking",
"for",
"the",
"field",
"recursively",
"up",
"the",
"superclasses",
"."
] | 6f576669d49087f0e825a417cadc3d4c707a4924 | https://github.com/SQiShER/java-object-diff/blob/6f576669d49087f0e825a417cadc3d4c707a4924/src/main/java/de/danielbechler/diff/introspection/PropertyAccessor.java#L92-L110 | train |
SQiShER/java-object-diff | src/main/java/de/danielbechler/diff/ObjectDiffer.java | ObjectDiffer.compare | public <T> DiffNode compare(final T working, final T base)
{
dispatcher.resetInstanceMemory();
try
{
return dispatcher.dispatch(DiffNode.ROOT, Instances.of(working, base), RootAccessor.getInstance());
}
finally
{
dispatcher.clearInstanceMemory();
}
} | java | public <T> DiffNode compare(final T working, final T base)
{
dispatcher.resetInstanceMemory();
try
{
return dispatcher.dispatch(DiffNode.ROOT, Instances.of(working, base), RootAccessor.getInstance());
}
finally
{
dispatcher.clearInstanceMemory();
}
} | [
"public",
"<",
"T",
">",
"DiffNode",
"compare",
"(",
"final",
"T",
"working",
",",
"final",
"T",
"base",
")",
"{",
"dispatcher",
".",
"resetInstanceMemory",
"(",
")",
";",
"try",
"{",
"return",
"dispatcher",
".",
"dispatch",
"(",
"DiffNode",
".",
"ROOT",... | Recursively inspects the given objects and returns a node representing their differences. Both objects
have be have the same type.
@param working This object will be treated as the successor of the `base` object.
@param base This object will be treated as the predecessor of the <code>working</code> object.
@return ... | [
"Recursively",
"inspects",
"the",
"given",
"objects",
"and",
"returns",
"a",
"node",
"representing",
"their",
"differences",
".",
"Both",
"objects",
"have",
"be",
"have",
"the",
"same",
"type",
"."
] | 6f576669d49087f0e825a417cadc3d4c707a4924 | https://github.com/SQiShER/java-object-diff/blob/6f576669d49087f0e825a417cadc3d4c707a4924/src/main/java/de/danielbechler/diff/ObjectDiffer.java#L47-L58 | train |
SQiShER/java-object-diff | src/main/java/de/danielbechler/diff/node/DiffNode.java | DiffNode.getChild | public DiffNode getChild(final NodePath nodePath)
{
if (parentNode != null)
{
return parentNode.getChild(nodePath.getElementSelectors());
}
else
{
return getChild(nodePath.getElementSelectors());
}
} | java | public DiffNode getChild(final NodePath nodePath)
{
if (parentNode != null)
{
return parentNode.getChild(nodePath.getElementSelectors());
}
else
{
return getChild(nodePath.getElementSelectors());
}
} | [
"public",
"DiffNode",
"getChild",
"(",
"final",
"NodePath",
"nodePath",
")",
"{",
"if",
"(",
"parentNode",
"!=",
"null",
")",
"{",
"return",
"parentNode",
".",
"getChild",
"(",
"nodePath",
".",
"getElementSelectors",
"(",
")",
")",
";",
"}",
"else",
"{",
... | Retrieve a child that matches the given absolute path, starting from the current node.
@param nodePath The path from the object root to the requested child node.
@return The requested child node or <code>null</code>. | [
"Retrieve",
"a",
"child",
"that",
"matches",
"the",
"given",
"absolute",
"path",
"starting",
"from",
"the",
"current",
"node",
"."
] | 6f576669d49087f0e825a417cadc3d4c707a4924 | https://github.com/SQiShER/java-object-diff/blob/6f576669d49087f0e825a417cadc3d4c707a4924/src/main/java/de/danielbechler/diff/node/DiffNode.java#L307-L317 | train |
SQiShER/java-object-diff | src/main/java/de/danielbechler/diff/node/DiffNode.java | DiffNode.addChild | public void addChild(final DiffNode node)
{
if (node == this)
{
throw new IllegalArgumentException("Detected attempt to add a node to itself. " +
"This would cause inifite loops and must never happen.");
}
else if (node.isRootNode())
{
throw new IllegalArgumentException("Detected attempt to add ro... | java | public void addChild(final DiffNode node)
{
if (node == this)
{
throw new IllegalArgumentException("Detected attempt to add a node to itself. " +
"This would cause inifite loops and must never happen.");
}
else if (node.isRootNode())
{
throw new IllegalArgumentException("Detected attempt to add ro... | [
"public",
"void",
"addChild",
"(",
"final",
"DiffNode",
"node",
")",
"{",
"if",
"(",
"node",
"==",
"this",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Detected attempt to add a node to itself. \"",
"+",
"\"This would cause inifite loops and must never ha... | Adds a child to this node and sets this node as its parent node.
@param node The node to add. | [
"Adds",
"a",
"child",
"to",
"this",
"node",
"and",
"sets",
"this",
"node",
"as",
"its",
"parent",
"node",
"."
] | 6f576669d49087f0e825a417cadc3d4c707a4924 | https://github.com/SQiShER/java-object-diff/blob/6f576669d49087f0e825a417cadc3d4c707a4924/src/main/java/de/danielbechler/diff/node/DiffNode.java#L364-L391 | train |
SQiShER/java-object-diff | src/main/java/de/danielbechler/diff/node/DiffNode.java | DiffNode.visit | public final void visit(final Visitor visitor)
{
final Visit visit = new Visit();
try
{
visit(visitor, visit);
}
catch (final StopVisitationException ignored)
{
}
} | java | public final void visit(final Visitor visitor)
{
final Visit visit = new Visit();
try
{
visit(visitor, visit);
}
catch (final StopVisitationException ignored)
{
}
} | [
"public",
"final",
"void",
"visit",
"(",
"final",
"Visitor",
"visitor",
")",
"{",
"final",
"Visit",
"visit",
"=",
"new",
"Visit",
"(",
")",
";",
"try",
"{",
"visit",
"(",
"visitor",
",",
"visit",
")",
";",
"}",
"catch",
"(",
"final",
"StopVisitationExc... | Visit this and all child nodes.
@param visitor The visitor to use. | [
"Visit",
"this",
"and",
"all",
"child",
"nodes",
"."
] | 6f576669d49087f0e825a417cadc3d4c707a4924 | https://github.com/SQiShER/java-object-diff/blob/6f576669d49087f0e825a417cadc3d4c707a4924/src/main/java/de/danielbechler/diff/node/DiffNode.java#L398-L408 | train |
SQiShER/java-object-diff | src/main/java/de/danielbechler/diff/node/DiffNode.java | DiffNode.visitChildren | public final void visitChildren(final Visitor visitor)
{
for (final DiffNode child : children.values())
{
try
{
child.visit(visitor);
}
catch (final StopVisitationException e)
{
return;
}
}
} | java | public final void visitChildren(final Visitor visitor)
{
for (final DiffNode child : children.values())
{
try
{
child.visit(visitor);
}
catch (final StopVisitationException e)
{
return;
}
}
} | [
"public",
"final",
"void",
"visitChildren",
"(",
"final",
"Visitor",
"visitor",
")",
"{",
"for",
"(",
"final",
"DiffNode",
"child",
":",
"children",
".",
"values",
"(",
")",
")",
"{",
"try",
"{",
"child",
".",
"visit",
"(",
"visitor",
")",
";",
"}",
... | Visit all child nodes but not this one.
@param visitor The visitor to use. | [
"Visit",
"all",
"child",
"nodes",
"but",
"not",
"this",
"one",
"."
] | 6f576669d49087f0e825a417cadc3d4c707a4924 | https://github.com/SQiShER/java-object-diff/blob/6f576669d49087f0e825a417cadc3d4c707a4924/src/main/java/de/danielbechler/diff/node/DiffNode.java#L435-L448 | train |
SQiShER/java-object-diff | src/main/java/de/danielbechler/diff/node/DiffNode.java | DiffNode.getPropertyAnnotations | public Set<Annotation> getPropertyAnnotations()
{
if (accessor instanceof PropertyAwareAccessor)
{
return unmodifiableSet(((PropertyAwareAccessor) accessor).getReadMethodAnnotations());
}
return unmodifiableSet(Collections.<Annotation>emptySet());
} | java | public Set<Annotation> getPropertyAnnotations()
{
if (accessor instanceof PropertyAwareAccessor)
{
return unmodifiableSet(((PropertyAwareAccessor) accessor).getReadMethodAnnotations());
}
return unmodifiableSet(Collections.<Annotation>emptySet());
} | [
"public",
"Set",
"<",
"Annotation",
">",
"getPropertyAnnotations",
"(",
")",
"{",
"if",
"(",
"accessor",
"instanceof",
"PropertyAwareAccessor",
")",
"{",
"return",
"unmodifiableSet",
"(",
"(",
"(",
"PropertyAwareAccessor",
")",
"accessor",
")",
".",
"getReadMethod... | If this node represents a bean property this method returns all annotations of its getter.
@return A set of annotations of this nodes property getter or an empty set. | [
"If",
"this",
"node",
"represents",
"a",
"bean",
"property",
"this",
"method",
"returns",
"all",
"annotations",
"of",
"its",
"getter",
"."
] | 6f576669d49087f0e825a417cadc3d4c707a4924 | https://github.com/SQiShER/java-object-diff/blob/6f576669d49087f0e825a417cadc3d4c707a4924/src/main/java/de/danielbechler/diff/node/DiffNode.java#L499-L506 | train |
SQiShER/java-object-diff | src/main/java/de/danielbechler/diff/node/DiffNode.java | DiffNode.setParentNode | protected final void setParentNode(final DiffNode parentNode)
{
if (this.parentNode != null && this.parentNode != parentNode)
{
throw new IllegalStateException("The parent of a node cannot be changed, once it's set.");
}
this.parentNode = parentNode;
} | java | protected final void setParentNode(final DiffNode parentNode)
{
if (this.parentNode != null && this.parentNode != parentNode)
{
throw new IllegalStateException("The parent of a node cannot be changed, once it's set.");
}
this.parentNode = parentNode;
} | [
"protected",
"final",
"void",
"setParentNode",
"(",
"final",
"DiffNode",
"parentNode",
")",
"{",
"if",
"(",
"this",
".",
"parentNode",
"!=",
"null",
"&&",
"this",
".",
"parentNode",
"!=",
"parentNode",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
... | Sets the parent node.
@param parentNode The parent of this node. May be null, if this is a root node. | [
"Sets",
"the",
"parent",
"node",
"."
] | 6f576669d49087f0e825a417cadc3d4c707a4924 | https://github.com/SQiShER/java-object-diff/blob/6f576669d49087f0e825a417cadc3d4c707a4924/src/main/java/de/danielbechler/diff/node/DiffNode.java#L616-L623 | train |
uber/tchannel-java | tchannel-hyperbahn/src/main/java/com/uber/tchannel/hyperbahn/api/HyperbahnClient.java | HyperbahnClient.advertise | public TFuture<JsonResponse<AdvertiseResponse>> advertise() {
final AdvertiseRequest advertiseRequest = new AdvertiseRequest();
advertiseRequest.addService(service, 0);
// TODO: options for hard fail, retries etc.
final JsonRequest<AdvertiseRequest> request = new JsonRequest.Builder<Ad... | java | public TFuture<JsonResponse<AdvertiseResponse>> advertise() {
final AdvertiseRequest advertiseRequest = new AdvertiseRequest();
advertiseRequest.addService(service, 0);
// TODO: options for hard fail, retries etc.
final JsonRequest<AdvertiseRequest> request = new JsonRequest.Builder<Ad... | [
"public",
"TFuture",
"<",
"JsonResponse",
"<",
"AdvertiseResponse",
">",
">",
"advertise",
"(",
")",
"{",
"final",
"AdvertiseRequest",
"advertiseRequest",
"=",
"new",
"AdvertiseRequest",
"(",
")",
";",
"advertiseRequest",
".",
"addService",
"(",
"service",
",",
... | Starts advertising on Hyperbahn at a fixed interval.
@return a future that resolves to the response of the first advertise request | [
"Starts",
"advertising",
"on",
"Hyperbahn",
"at",
"a",
"fixed",
"interval",
"."
] | 009cf1e6decc9bbd2daf90eb3401b13c03bfc7e1 | https://github.com/uber/tchannel-java/blob/009cf1e6decc9bbd2daf90eb3401b13c03bfc7e1/tchannel-hyperbahn/src/main/java/com/uber/tchannel/hyperbahn/api/HyperbahnClient.java#L91-L125 | train |
bluelinelabs/LoganSquare | core/src/main/java/com/bluelinelabs/logansquare/JsonMapper.java | JsonMapper.parseList | public List<T> parseList(JsonParser jsonParser) throws IOException {
List<T> list = new ArrayList<>();
if (jsonParser.getCurrentToken() == JsonToken.START_ARRAY) {
while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
list.add(parse(jsonParser));
}
}
... | java | public List<T> parseList(JsonParser jsonParser) throws IOException {
List<T> list = new ArrayList<>();
if (jsonParser.getCurrentToken() == JsonToken.START_ARRAY) {
while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
list.add(parse(jsonParser));
}
}
... | [
"public",
"List",
"<",
"T",
">",
"parseList",
"(",
"JsonParser",
"jsonParser",
")",
"throws",
"IOException",
"{",
"List",
"<",
"T",
">",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"jsonParser",
".",
"getCurrentToken",
"(",
")",
"=... | Parse a list of objects from a JsonParser.
@param jsonParser The JsonParser, preconfigured to be at the START_ARRAY token. | [
"Parse",
"a",
"list",
"of",
"objects",
"from",
"a",
"JsonParser",
"."
] | 6c5ec5281fb58d85a99413b7b6f55e9ef18a6e06 | https://github.com/bluelinelabs/LoganSquare/blob/6c5ec5281fb58d85a99413b7b6f55e9ef18a6e06/core/src/main/java/com/bluelinelabs/logansquare/JsonMapper.java#L137-L145 | train |
bluelinelabs/LoganSquare | core/src/main/java/com/bluelinelabs/logansquare/JsonMapper.java | JsonMapper.parseMap | public Map<String, T> parseMap(JsonParser jsonParser) throws IOException {
HashMap<String, T> map = new HashMap<String, T>();
while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
String key = jsonParser.getText();
jsonParser.nextToken();
if (jsonParser.getCurrentT... | java | public Map<String, T> parseMap(JsonParser jsonParser) throws IOException {
HashMap<String, T> map = new HashMap<String, T>();
while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
String key = jsonParser.getText();
jsonParser.nextToken();
if (jsonParser.getCurrentT... | [
"public",
"Map",
"<",
"String",
",",
"T",
">",
"parseMap",
"(",
"JsonParser",
"jsonParser",
")",
"throws",
"IOException",
"{",
"HashMap",
"<",
"String",
",",
"T",
">",
"map",
"=",
"new",
"HashMap",
"<",
"String",
",",
"T",
">",
"(",
")",
";",
"while"... | Parse a map of objects from a JsonParser.
@param jsonParser The JsonParser, preconfigured to be at the START_ARRAY token. | [
"Parse",
"a",
"map",
"of",
"objects",
"from",
"a",
"JsonParser",
"."
] | 6c5ec5281fb58d85a99413b7b6f55e9ef18a6e06 | https://github.com/bluelinelabs/LoganSquare/blob/6c5ec5281fb58d85a99413b7b6f55e9ef18a6e06/core/src/main/java/com/bluelinelabs/logansquare/JsonMapper.java#L196-L208 | train |
bluelinelabs/LoganSquare | core/src/main/java/com/bluelinelabs/logansquare/LoganSquare.java | LoganSquare.parse | public static <E> E parse(InputStream is, ParameterizedType<E> jsonObjectType) throws IOException {
return mapperFor(jsonObjectType).parse(is);
} | java | public static <E> E parse(InputStream is, ParameterizedType<E> jsonObjectType) throws IOException {
return mapperFor(jsonObjectType).parse(is);
} | [
"public",
"static",
"<",
"E",
">",
"E",
"parse",
"(",
"InputStream",
"is",
",",
"ParameterizedType",
"<",
"E",
">",
"jsonObjectType",
")",
"throws",
"IOException",
"{",
"return",
"mapperFor",
"(",
"jsonObjectType",
")",
".",
"parse",
"(",
"is",
")",
";",
... | Parse a parameterized object from an InputStream.
@param is The InputStream, most likely from your networking library.
@param jsonObjectType The ParameterizedType describing the object. Ex: LoganSquare.parse(is, new ParameterizedType<MyModel<OtherModel>>() { }); | [
"Parse",
"a",
"parameterized",
"object",
"from",
"an",
"InputStream",
"."
] | 6c5ec5281fb58d85a99413b7b6f55e9ef18a6e06 | https://github.com/bluelinelabs/LoganSquare/blob/6c5ec5281fb58d85a99413b7b6f55e9ef18a6e06/core/src/main/java/com/bluelinelabs/logansquare/LoganSquare.java#L88-L90 | train |
bluelinelabs/LoganSquare | core/src/main/java/com/bluelinelabs/logansquare/LoganSquare.java | LoganSquare.serialize | @SuppressWarnings("unchecked")
public static <E> String serialize(E object, ParameterizedType<E> parameterizedType) throws IOException {
return mapperFor(parameterizedType).serialize(object);
} | java | @SuppressWarnings("unchecked")
public static <E> String serialize(E object, ParameterizedType<E> parameterizedType) throws IOException {
return mapperFor(parameterizedType).serialize(object);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"E",
">",
"String",
"serialize",
"(",
"E",
"object",
",",
"ParameterizedType",
"<",
"E",
">",
"parameterizedType",
")",
"throws",
"IOException",
"{",
"return",
"mapperFor",
"(",
"para... | Serialize a parameterized object to a JSON String.
@param object The object to serialize.
@param parameterizedType The ParameterizedType describing the object. Ex: LoganSquare.serialize(object, new ParameterizedType<MyModel<OtherModel>>() { }); | [
"Serialize",
"a",
"parameterized",
"object",
"to",
"a",
"JSON",
"String",
"."
] | 6c5ec5281fb58d85a99413b7b6f55e9ef18a6e06 | https://github.com/bluelinelabs/LoganSquare/blob/6c5ec5281fb58d85a99413b7b6f55e9ef18a6e06/core/src/main/java/com/bluelinelabs/logansquare/LoganSquare.java#L169-L172 | train |
bluelinelabs/LoganSquare | core/src/main/java/com/bluelinelabs/logansquare/LoganSquare.java | LoganSquare.serialize | @SuppressWarnings("unchecked")
public static <E> void serialize(E object, ParameterizedType<E> parameterizedType, OutputStream os) throws IOException {
mapperFor(parameterizedType).serialize(object, os);
} | java | @SuppressWarnings("unchecked")
public static <E> void serialize(E object, ParameterizedType<E> parameterizedType, OutputStream os) throws IOException {
mapperFor(parameterizedType).serialize(object, os);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"E",
">",
"void",
"serialize",
"(",
"E",
"object",
",",
"ParameterizedType",
"<",
"E",
">",
"parameterizedType",
",",
"OutputStream",
"os",
")",
"throws",
"IOException",
"{",
"mapperF... | Serialize a parameterized object to an OutputStream.
@param object The object to serialize.
@param parameterizedType The ParameterizedType describing the object. Ex: LoganSquare.serialize(object, new ParameterizedType<MyModel<OtherModel>>() { }, os);
@param os The OutputStream being written to. | [
"Serialize",
"a",
"parameterized",
"object",
"to",
"an",
"OutputStream",
"."
] | 6c5ec5281fb58d85a99413b7b6f55e9ef18a6e06 | https://github.com/bluelinelabs/LoganSquare/blob/6c5ec5281fb58d85a99413b7b6f55e9ef18a6e06/core/src/main/java/com/bluelinelabs/logansquare/LoganSquare.java#L181-L184 | train |
bluelinelabs/LoganSquare | core/src/main/java/com/bluelinelabs/logansquare/LoganSquare.java | LoganSquare.serialize | public static <E> String serialize(Map<String, E> map, Class<E> jsonObjectClass) throws IOException {
return mapperFor(jsonObjectClass).serialize(map);
} | java | public static <E> String serialize(Map<String, E> map, Class<E> jsonObjectClass) throws IOException {
return mapperFor(jsonObjectClass).serialize(map);
} | [
"public",
"static",
"<",
"E",
">",
"String",
"serialize",
"(",
"Map",
"<",
"String",
",",
"E",
">",
"map",
",",
"Class",
"<",
"E",
">",
"jsonObjectClass",
")",
"throws",
"IOException",
"{",
"return",
"mapperFor",
"(",
"jsonObjectClass",
")",
".",
"serial... | Serialize a map of objects to a JSON String.
@param map The map of objects to serialize.
@param jsonObjectClass The @JsonObject class of the list elements | [
"Serialize",
"a",
"map",
"of",
"objects",
"to",
"a",
"JSON",
"String",
"."
] | 6c5ec5281fb58d85a99413b7b6f55e9ef18a6e06 | https://github.com/bluelinelabs/LoganSquare/blob/6c5ec5281fb58d85a99413b7b6f55e9ef18a6e06/core/src/main/java/com/bluelinelabs/logansquare/LoganSquare.java#L213-L215 | train |
bluelinelabs/LoganSquare | core/src/main/java/com/bluelinelabs/logansquare/LoganSquare.java | LoganSquare.typeConverterFor | @SuppressWarnings("unchecked")
public static <E> TypeConverter<E> typeConverterFor(Class<E> cls) throws NoSuchTypeConverterException {
TypeConverter<E> typeConverter = TYPE_CONVERTERS.get(cls);
if (typeConverter == null) {
throw new NoSuchTypeConverterException(cls);
}
re... | java | @SuppressWarnings("unchecked")
public static <E> TypeConverter<E> typeConverterFor(Class<E> cls) throws NoSuchTypeConverterException {
TypeConverter<E> typeConverter = TYPE_CONVERTERS.get(cls);
if (typeConverter == null) {
throw new NoSuchTypeConverterException(cls);
}
re... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"E",
">",
"TypeConverter",
"<",
"E",
">",
"typeConverterFor",
"(",
"Class",
"<",
"E",
">",
"cls",
")",
"throws",
"NoSuchTypeConverterException",
"{",
"TypeConverter",
"<",
"E",
">",
... | Returns a TypeConverter for a given class.
@param cls The class for which the TypeConverter should be fetched. | [
"Returns",
"a",
"TypeConverter",
"for",
"a",
"given",
"class",
"."
] | 6c5ec5281fb58d85a99413b7b6f55e9ef18a6e06 | https://github.com/bluelinelabs/LoganSquare/blob/6c5ec5281fb58d85a99413b7b6f55e9ef18a6e06/core/src/main/java/com/bluelinelabs/logansquare/LoganSquare.java#L334-L341 | train |
bluelinelabs/LoganSquare | core/src/main/java/com/bluelinelabs/logansquare/LoganSquare.java | LoganSquare.registerTypeConverter | public static <E> void registerTypeConverter(Class<E> cls, TypeConverter<E> converter) {
TYPE_CONVERTERS.put(cls, converter);
} | java | public static <E> void registerTypeConverter(Class<E> cls, TypeConverter<E> converter) {
TYPE_CONVERTERS.put(cls, converter);
} | [
"public",
"static",
"<",
"E",
">",
"void",
"registerTypeConverter",
"(",
"Class",
"<",
"E",
">",
"cls",
",",
"TypeConverter",
"<",
"E",
">",
"converter",
")",
"{",
"TYPE_CONVERTERS",
".",
"put",
"(",
"cls",
",",
"converter",
")",
";",
"}"
] | Register a new TypeConverter for parsing and serialization.
@param cls The class for which the TypeConverter should be used.
@param converter The TypeConverter | [
"Register",
"a",
"new",
"TypeConverter",
"for",
"parsing",
"and",
"serialization",
"."
] | 6c5ec5281fb58d85a99413b7b6f55e9ef18a6e06 | https://github.com/bluelinelabs/LoganSquare/blob/6c5ec5281fb58d85a99413b7b6f55e9ef18a6e06/core/src/main/java/com/bluelinelabs/logansquare/LoganSquare.java#L349-L351 | train |
bluelinelabs/LoganSquare | core/src/main/java/com/bluelinelabs/logansquare/util/SimpleArrayMap.java | SimpleArrayMap.indexOfKey | public int indexOfKey(Object key) {
return key == null ? indexOfNull() : indexOf(key, key.hashCode());
} | java | public int indexOfKey(Object key) {
return key == null ? indexOfNull() : indexOf(key, key.hashCode());
} | [
"public",
"int",
"indexOfKey",
"(",
"Object",
"key",
")",
"{",
"return",
"key",
"==",
"null",
"?",
"indexOfNull",
"(",
")",
":",
"indexOf",
"(",
"key",
",",
"key",
".",
"hashCode",
"(",
")",
")",
";",
"}"
] | Returns the index of a key in the set.
@param key The key to search for.
@return Returns the index of the key if it exists, else a negative integer. | [
"Returns",
"the",
"index",
"of",
"a",
"key",
"in",
"the",
"set",
"."
] | 6c5ec5281fb58d85a99413b7b6f55e9ef18a6e06 | https://github.com/bluelinelabs/LoganSquare/blob/6c5ec5281fb58d85a99413b7b6f55e9ef18a6e06/core/src/main/java/com/bluelinelabs/logansquare/util/SimpleArrayMap.java#L273-L275 | train |
bluelinelabs/LoganSquare | core/src/main/java/com/bluelinelabs/logansquare/util/SimpleArrayMap.java | SimpleArrayMap.put | public V put(K key, V value) {
final int hash;
int index;
if (key == null) {
hash = 0;
index = indexOfNull();
} else {
hash = key.hashCode();
index = indexOf(key, hash);
}
if (index >= 0) {
index = (index<<1) + 1... | java | public V put(K key, V value) {
final int hash;
int index;
if (key == null) {
hash = 0;
index = indexOfNull();
} else {
hash = key.hashCode();
index = indexOf(key, hash);
}
if (index >= 0) {
index = (index<<1) + 1... | [
"public",
"V",
"put",
"(",
"K",
"key",
",",
"V",
"value",
")",
"{",
"final",
"int",
"hash",
";",
"int",
"index",
";",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"hash",
"=",
"0",
";",
"index",
"=",
"indexOfNull",
"(",
")",
";",
"}",
"else",
"{... | Add a new value to the array map.
@param key The key under which to store the value. <b>Must not be null.</b> If
this key already exists in the array, its value will be replaced.
@param value The value to store for the given key.
@return Returns the old value that was stored for the given key, or null if there
was no... | [
"Add",
"a",
"new",
"value",
"to",
"the",
"array",
"map",
"."
] | 6c5ec5281fb58d85a99413b7b6f55e9ef18a6e06 | https://github.com/bluelinelabs/LoganSquare/blob/6c5ec5281fb58d85a99413b7b6f55e9ef18a6e06/core/src/main/java/com/bluelinelabs/logansquare/util/SimpleArrayMap.java#L364-L408 | train |
edvin/fxlauncher | src/main/java/fxlauncher/LauncherParams.java | LauncherParams.computeUnnamedParams | private void computeUnnamedParams() {
unnamedParams.addAll(rawArgs.stream().filter(arg -> !isNamedParam(arg)).collect(Collectors.toList()));
} | java | private void computeUnnamedParams() {
unnamedParams.addAll(rawArgs.stream().filter(arg -> !isNamedParam(arg)).collect(Collectors.toList()));
} | [
"private",
"void",
"computeUnnamedParams",
"(",
")",
"{",
"unnamedParams",
".",
"addAll",
"(",
"rawArgs",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"arg",
"->",
"!",
"isNamedParam",
"(",
"arg",
")",
")",
".",
"collect",
"(",
"Collectors",
".",
"toList... | This method computes the list of unnamed parameters, by filtering the
list of raw arguments, stripping out the named parameters. | [
"This",
"method",
"computes",
"the",
"list",
"of",
"unnamed",
"parameters",
"by",
"filtering",
"the",
"list",
"of",
"raw",
"arguments",
"stripping",
"out",
"the",
"named",
"parameters",
"."
] | 3024b413c8743d1e3576e91f9911b68076bcb625 | https://github.com/edvin/fxlauncher/blob/3024b413c8743d1e3576e91f9911b68076bcb625/src/main/java/fxlauncher/LauncherParams.java#L97-L99 | train |
lessthanoptimal/ejml | examples/src/org/ejml/example/StatisticsMatrix.java | StatisticsMatrix.wrap | public static StatisticsMatrix wrap( DMatrixRMaj m ) {
StatisticsMatrix ret = new StatisticsMatrix();
ret.setMatrix( m );
return ret;
} | java | public static StatisticsMatrix wrap( DMatrixRMaj m ) {
StatisticsMatrix ret = new StatisticsMatrix();
ret.setMatrix( m );
return ret;
} | [
"public",
"static",
"StatisticsMatrix",
"wrap",
"(",
"DMatrixRMaj",
"m",
")",
"{",
"StatisticsMatrix",
"ret",
"=",
"new",
"StatisticsMatrix",
"(",
")",
";",
"ret",
".",
"setMatrix",
"(",
"m",
")",
";",
"return",
"ret",
";",
"}"
] | Wraps a StatisticsMatrix around 'm'. Does NOT create a copy of 'm' but saves a reference
to it. | [
"Wraps",
"a",
"StatisticsMatrix",
"around",
"m",
".",
"Does",
"NOT",
"create",
"a",
"copy",
"of",
"m",
"but",
"saves",
"a",
"reference",
"to",
"it",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/examples/src/org/ejml/example/StatisticsMatrix.java#L50-L55 | train |
lessthanoptimal/ejml | examples/src/org/ejml/example/StatisticsMatrix.java | StatisticsMatrix.mean | public double mean() {
double total = 0;
final int N = getNumElements();
for( int i = 0; i < N; i++ ) {
total += get(i);
}
return total/N;
} | java | public double mean() {
double total = 0;
final int N = getNumElements();
for( int i = 0; i < N; i++ ) {
total += get(i);
}
return total/N;
} | [
"public",
"double",
"mean",
"(",
")",
"{",
"double",
"total",
"=",
"0",
";",
"final",
"int",
"N",
"=",
"getNumElements",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"N",
";",
"i",
"++",
")",
"{",
"total",
"+=",
"get",
"(",... | Computes the mean or average of all the elements.
@return mean | [
"Computes",
"the",
"mean",
"or",
"average",
"of",
"all",
"the",
"elements",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/examples/src/org/ejml/example/StatisticsMatrix.java#L62-L71 | train |
lessthanoptimal/ejml | examples/src/org/ejml/example/StatisticsMatrix.java | StatisticsMatrix.stdev | public double stdev() {
double m = mean();
double total = 0;
final int N = getNumElements();
if( N <= 1 )
throw new IllegalArgumentException("There must be more than one element to compute stdev");
for( int i = 0; i < N; i++ ) {
double x = get(i);
... | java | public double stdev() {
double m = mean();
double total = 0;
final int N = getNumElements();
if( N <= 1 )
throw new IllegalArgumentException("There must be more than one element to compute stdev");
for( int i = 0; i < N; i++ ) {
double x = get(i);
... | [
"public",
"double",
"stdev",
"(",
")",
"{",
"double",
"m",
"=",
"mean",
"(",
")",
";",
"double",
"total",
"=",
"0",
";",
"final",
"int",
"N",
"=",
"getNumElements",
"(",
")",
";",
"if",
"(",
"N",
"<=",
"1",
")",
"throw",
"new",
"IllegalArgumentExce... | Computes the unbiased standard deviation of all the elements.
@return standard deviation | [
"Computes",
"the",
"unbiased",
"standard",
"deviation",
"of",
"all",
"the",
"elements",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/examples/src/org/ejml/example/StatisticsMatrix.java#L78-L97 | train |
lessthanoptimal/ejml | examples/src/org/ejml/example/StatisticsMatrix.java | StatisticsMatrix.createMatrix | @Override
protected StatisticsMatrix createMatrix(int numRows, int numCols, MatrixType type) {
return new StatisticsMatrix(numRows,numCols);
} | java | @Override
protected StatisticsMatrix createMatrix(int numRows, int numCols, MatrixType type) {
return new StatisticsMatrix(numRows,numCols);
} | [
"@",
"Override",
"protected",
"StatisticsMatrix",
"createMatrix",
"(",
"int",
"numRows",
",",
"int",
"numCols",
",",
"MatrixType",
"type",
")",
"{",
"return",
"new",
"StatisticsMatrix",
"(",
"numRows",
",",
"numCols",
")",
";",
"}"
] | Returns a matrix of StatisticsMatrix type so that SimpleMatrix functions create matrices
of the correct type. | [
"Returns",
"a",
"matrix",
"of",
"StatisticsMatrix",
"type",
"so",
"that",
"SimpleMatrix",
"functions",
"create",
"matrices",
"of",
"the",
"correct",
"type",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/examples/src/org/ejml/example/StatisticsMatrix.java#L103-L106 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/block/decomposition/chol/CholeskyOuterForm_DDRB.java | CholeskyOuterForm_DDRB.decompose | @Override
public boolean decompose(DMatrixRBlock A) {
if( A.numCols != A.numRows )
throw new IllegalArgumentException("A must be square");
this.T = A;
if( lower )
return decomposeLower();
else
return decomposeUpper();
} | java | @Override
public boolean decompose(DMatrixRBlock A) {
if( A.numCols != A.numRows )
throw new IllegalArgumentException("A must be square");
this.T = A;
if( lower )
return decomposeLower();
else
return decomposeUpper();
} | [
"@",
"Override",
"public",
"boolean",
"decompose",
"(",
"DMatrixRBlock",
"A",
")",
"{",
"if",
"(",
"A",
".",
"numCols",
"!=",
"A",
".",
"numRows",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"A must be square\"",
")",
";",
"this",
".",
"T",
"="... | Decomposes the provided matrix and stores the result in the same matrix.
@param A Matrix that is to be decomposed. Modified.
@return If it succeeded or not. | [
"Decomposes",
"the",
"provided",
"matrix",
"and",
"stores",
"the",
"result",
"in",
"the",
"same",
"matrix",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/block/decomposition/chol/CholeskyOuterForm_DDRB.java#L71-L82 | train |
lessthanoptimal/ejml | main/ejml-core/src/org/ejml/ops/MatrixIO.java | MatrixIO.saveBin | public static void saveBin(DMatrix A, String fileName)
throws IOException
{
FileOutputStream fileStream = new FileOutputStream(fileName);
ObjectOutputStream stream = new ObjectOutputStream(fileStream);
try {
stream.writeObject(A);
stream.flush();
} fi... | java | public static void saveBin(DMatrix A, String fileName)
throws IOException
{
FileOutputStream fileStream = new FileOutputStream(fileName);
ObjectOutputStream stream = new ObjectOutputStream(fileStream);
try {
stream.writeObject(A);
stream.flush();
} fi... | [
"public",
"static",
"void",
"saveBin",
"(",
"DMatrix",
"A",
",",
"String",
"fileName",
")",
"throws",
"IOException",
"{",
"FileOutputStream",
"fileStream",
"=",
"new",
"FileOutputStream",
"(",
"fileName",
")",
";",
"ObjectOutputStream",
"stream",
"=",
"new",
"Ob... | Saves a matrix to disk using Java binary serialization.
@param A The matrix being saved.
@param fileName Name of the file its being saved at.
@throws java.io.IOException | [
"Saves",
"a",
"matrix",
"to",
"disk",
"using",
"Java",
"binary",
"serialization",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/ops/MatrixIO.java#L48-L66 | train |
lessthanoptimal/ejml | main/ejml-dsparse/src/org/ejml/sparse/csc/RandomMatrices_DSCC.java | RandomMatrices_DSCC.rectangle | public static DMatrixSparseCSC rectangle(int numRows , int numCols , int nz_total ,
double min , double max , Random rand ) {
nz_total = Math.min(numCols*numRows,nz_total);
int[] selected = UtilEjml.shuffled(numRows*numCols, nz_total, rand);
Arrays.s... | java | public static DMatrixSparseCSC rectangle(int numRows , int numCols , int nz_total ,
double min , double max , Random rand ) {
nz_total = Math.min(numCols*numRows,nz_total);
int[] selected = UtilEjml.shuffled(numRows*numCols, nz_total, rand);
Arrays.s... | [
"public",
"static",
"DMatrixSparseCSC",
"rectangle",
"(",
"int",
"numRows",
",",
"int",
"numCols",
",",
"int",
"nz_total",
",",
"double",
"min",
",",
"double",
"max",
",",
"Random",
"rand",
")",
"{",
"nz_total",
"=",
"Math",
".",
"min",
"(",
"numCols",
"... | Randomly generates matrix with the specified number of non-zero elements filled with values from min to max.
@param numRows Number of rows
@param numCols Number of columns
@param nz_total Total number of non-zero elements in the matrix
@param min Minimum element value, inclusive
@param max Maximum element value, inclu... | [
"Randomly",
"generates",
"matrix",
"with",
"the",
"specified",
"number",
"of",
"non",
"-",
"zero",
"elements",
"filled",
"with",
"values",
"from",
"min",
"to",
"max",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/RandomMatrices_DSCC.java#L46-L73 | train |
lessthanoptimal/ejml | main/ejml-dsparse/src/org/ejml/sparse/csc/RandomMatrices_DSCC.java | RandomMatrices_DSCC.symmetric | public static DMatrixSparseCSC symmetric( int N , int nz_total ,
double min , double max , Random rand) {
// compute the number of elements in the triangle, including diagonal
int Ntriagle = (N*N+N)/2;
// create a list of open elements
int o... | java | public static DMatrixSparseCSC symmetric( int N , int nz_total ,
double min , double max , Random rand) {
// compute the number of elements in the triangle, including diagonal
int Ntriagle = (N*N+N)/2;
// create a list of open elements
int o... | [
"public",
"static",
"DMatrixSparseCSC",
"symmetric",
"(",
"int",
"N",
",",
"int",
"nz_total",
",",
"double",
"min",
",",
"double",
"max",
",",
"Random",
"rand",
")",
"{",
"// compute the number of elements in the triangle, including diagonal",
"int",
"Ntriagle",
"=",
... | Creates a random symmetric matrix. The entire matrix will be filled in, not just a triangular
portion.
@param N Number of rows and columns
@param nz_total Number of nonzero elements in the triangular portion of the matrix
@param min Minimum element value, inclusive
@param max Maximum element value, inclusive
@param ra... | [
"Creates",
"a",
"random",
"symmetric",
"matrix",
".",
"The",
"entire",
"matrix",
"will",
"be",
"filled",
"in",
"not",
"just",
"a",
"triangular",
"portion",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/RandomMatrices_DSCC.java#L91-L129 | train |
lessthanoptimal/ejml | main/ejml-dsparse/src/org/ejml/sparse/csc/RandomMatrices_DSCC.java | RandomMatrices_DSCC.triangle | public static DMatrixSparseCSC triangle( boolean upper , int N , double minFill , double maxFill , Random rand ) {
int nz = (int)(((N-1)*(N-1)/2)*(rand.nextDouble()*(maxFill-minFill)+minFill))+N;
if( upper ) {
return triangleUpper(N,0,nz,-1,1,rand);
} else {
return trian... | java | public static DMatrixSparseCSC triangle( boolean upper , int N , double minFill , double maxFill , Random rand ) {
int nz = (int)(((N-1)*(N-1)/2)*(rand.nextDouble()*(maxFill-minFill)+minFill))+N;
if( upper ) {
return triangleUpper(N,0,nz,-1,1,rand);
} else {
return trian... | [
"public",
"static",
"DMatrixSparseCSC",
"triangle",
"(",
"boolean",
"upper",
",",
"int",
"N",
",",
"double",
"minFill",
",",
"double",
"maxFill",
",",
"Random",
"rand",
")",
"{",
"int",
"nz",
"=",
"(",
"int",
")",
"(",
"(",
"(",
"N",
"-",
"1",
")",
... | Creates a triangular matrix where the amount of fill is randomly selected too.
@param upper true for upper triangular and false for lower
@param N number of rows and columns
er * @param minFill minimum fill fraction
@param maxFill maximum fill fraction
@param rand random number generator
@return Random matrix | [
"Creates",
"a",
"triangular",
"matrix",
"where",
"the",
"amount",
"of",
"fill",
"is",
"randomly",
"selected",
"too",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/RandomMatrices_DSCC.java#L236-L244 | train |
lessthanoptimal/ejml | main/ejml-dsparse/src/org/ejml/sparse/csc/RandomMatrices_DSCC.java | RandomMatrices_DSCC.ensureNotSingular | public static void ensureNotSingular( DMatrixSparseCSC A , Random rand ) {
// if( A.numRows < A.numCols ) {
// throw new IllegalArgumentException("Fewer equations than variables");
// }
int []s = UtilEjml.shuffled(A.numRows,rand);
Arrays.sort(s);
int N = Math.min(A.num... | java | public static void ensureNotSingular( DMatrixSparseCSC A , Random rand ) {
// if( A.numRows < A.numCols ) {
// throw new IllegalArgumentException("Fewer equations than variables");
// }
int []s = UtilEjml.shuffled(A.numRows,rand);
Arrays.sort(s);
int N = Math.min(A.num... | [
"public",
"static",
"void",
"ensureNotSingular",
"(",
"DMatrixSparseCSC",
"A",
",",
"Random",
"rand",
")",
"{",
"// if( A.numRows < A.numCols ) {",
"// throw new IllegalArgumentException(\"Fewer equations than variables\");",
"// }",
"int",
"[",
"]",
"s",... | Modies the matrix to make sure that at least one element in each column has a value | [
"Modies",
"the",
"matrix",
"to",
"make",
"sure",
"that",
"at",
"least",
"one",
"element",
"in",
"each",
"column",
"has",
"a",
"value"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/RandomMatrices_DSCC.java#L271-L283 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/misc/DeterminantFromMinor_DDRM.java | DeterminantFromMinor_DDRM.compute | public double compute( DMatrix1Row mat ) {
if( width != mat.numCols || width != mat.numRows ) {
throw new RuntimeException("Unexpected matrix dimension");
}
// make sure everything is in the proper state before it starts
initStructures();
// System.arraycopy(mat.data... | java | public double compute( DMatrix1Row mat ) {
if( width != mat.numCols || width != mat.numRows ) {
throw new RuntimeException("Unexpected matrix dimension");
}
// make sure everything is in the proper state before it starts
initStructures();
// System.arraycopy(mat.data... | [
"public",
"double",
"compute",
"(",
"DMatrix1Row",
"mat",
")",
"{",
"if",
"(",
"width",
"!=",
"mat",
".",
"numCols",
"||",
"width",
"!=",
"mat",
".",
"numRows",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Unexpected matrix dimension\"",
")",
";",
... | Computes the determinant for the specified matrix. It must be square and have
the same width and height as what was specified in the constructor.
@param mat The matrix whose determinant is to be computed.
@return The determinant. | [
"Computes",
"the",
"determinant",
"for",
"the",
"specified",
"matrix",
".",
"It",
"must",
"be",
"square",
"and",
"have",
"the",
"same",
"width",
"and",
"height",
"as",
"what",
"was",
"specified",
"in",
"the",
"constructor",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/misc/DeterminantFromMinor_DDRM.java#L113-L171 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/SingularOps_DDRM.java | SingularOps_DDRM.singularValues | public static double[] singularValues( DMatrixRMaj A ) {
SingularValueDecomposition_F64<DMatrixRMaj> svd = DecompositionFactory_DDRM.svd(A.numRows,A.numCols,false,true,true);
if( svd.inputModified() ) {
A = A.copy();
}
if( !svd.decompose(A)) {
throw new RuntimeEx... | java | public static double[] singularValues( DMatrixRMaj A ) {
SingularValueDecomposition_F64<DMatrixRMaj> svd = DecompositionFactory_DDRM.svd(A.numRows,A.numCols,false,true,true);
if( svd.inputModified() ) {
A = A.copy();
}
if( !svd.decompose(A)) {
throw new RuntimeEx... | [
"public",
"static",
"double",
"[",
"]",
"singularValues",
"(",
"DMatrixRMaj",
"A",
")",
"{",
"SingularValueDecomposition_F64",
"<",
"DMatrixRMaj",
">",
"svd",
"=",
"DecompositionFactory_DDRM",
".",
"svd",
"(",
"A",
".",
"numRows",
",",
"A",
".",
"numCols",
","... | Returns an array of all the singular values in A sorted in ascending order
@param A Matrix. Not modified.
@return singular values | [
"Returns",
"an",
"array",
"of",
"all",
"the",
"singular",
"values",
"in",
"A",
"sorted",
"in",
"ascending",
"order"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/SingularOps_DDRM.java#L48-L69 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/SingularOps_DDRM.java | SingularOps_DDRM.ratioSmallestOverLargest | public static double ratioSmallestOverLargest( double []sv ) {
if( sv.length == 0 )
return Double.NaN;
double min = sv[0];
double max = min;
for (int i = 1; i < sv.length; i++) {
double v = sv[i];
if( v > max )
max = v;
el... | java | public static double ratioSmallestOverLargest( double []sv ) {
if( sv.length == 0 )
return Double.NaN;
double min = sv[0];
double max = min;
for (int i = 1; i < sv.length; i++) {
double v = sv[i];
if( v > max )
max = v;
el... | [
"public",
"static",
"double",
"ratioSmallestOverLargest",
"(",
"double",
"[",
"]",
"sv",
")",
"{",
"if",
"(",
"sv",
".",
"length",
"==",
"0",
")",
"return",
"Double",
".",
"NaN",
";",
"double",
"min",
"=",
"sv",
"[",
"0",
"]",
";",
"double",
"max",
... | Computes the ratio of the smallest value to the largest. Does not assume
the array is sorted first
@param sv array
@return smallest / largest | [
"Computes",
"the",
"ratio",
"of",
"the",
"smallest",
"value",
"to",
"the",
"largest",
".",
"Does",
"not",
"assume",
"the",
"array",
"is",
"sorted",
"first"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/SingularOps_DDRM.java#L77-L93 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/SingularOps_DDRM.java | SingularOps_DDRM.rank | public static int rank( DMatrixRMaj A ) {
SingularValueDecomposition_F64<DMatrixRMaj> svd = DecompositionFactory_DDRM.svd(A.numRows,A.numCols,false,true,true);
if( svd.inputModified() ) {
A = A.copy();
}
if( !svd.decompose(A)) {
throw new RuntimeException("SVD F... | java | public static int rank( DMatrixRMaj A ) {
SingularValueDecomposition_F64<DMatrixRMaj> svd = DecompositionFactory_DDRM.svd(A.numRows,A.numCols,false,true,true);
if( svd.inputModified() ) {
A = A.copy();
}
if( !svd.decompose(A)) {
throw new RuntimeException("SVD F... | [
"public",
"static",
"int",
"rank",
"(",
"DMatrixRMaj",
"A",
")",
"{",
"SingularValueDecomposition_F64",
"<",
"DMatrixRMaj",
">",
"svd",
"=",
"DecompositionFactory_DDRM",
".",
"svd",
"(",
"A",
".",
"numRows",
",",
"A",
".",
"numCols",
",",
"false",
",",
"true... | Returns the matrix's rank. Automatic selection of threshold
@param A Matrix. Not modified.
@return The rank of the decomposed matrix. | [
"Returns",
"the",
"matrix",
"s",
"rank",
".",
"Automatic",
"selection",
"of",
"threshold"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/SingularOps_DDRM.java#L129-L150 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/SingularOps_DDRM.java | SingularOps_DDRM.checkSvdMatrixSize | public static void checkSvdMatrixSize(DMatrixRMaj U, boolean tranU, DMatrixRMaj W, DMatrixRMaj V, boolean tranV ) {
int numSingular = Math.min(W.numRows,W.numCols);
boolean compact = W.numRows == W.numCols;
if( compact ) {
if( U != null ) {
if( tranU && U.numRows != ... | java | public static void checkSvdMatrixSize(DMatrixRMaj U, boolean tranU, DMatrixRMaj W, DMatrixRMaj V, boolean tranV ) {
int numSingular = Math.min(W.numRows,W.numCols);
boolean compact = W.numRows == W.numCols;
if( compact ) {
if( U != null ) {
if( tranU && U.numRows != ... | [
"public",
"static",
"void",
"checkSvdMatrixSize",
"(",
"DMatrixRMaj",
"U",
",",
"boolean",
"tranU",
",",
"DMatrixRMaj",
"W",
",",
"DMatrixRMaj",
"V",
",",
"boolean",
"tranV",
")",
"{",
"int",
"numSingular",
"=",
"Math",
".",
"min",
"(",
"W",
".",
"numRows"... | Checks to see if all the provided matrices are the expected size for an SVD. If an error is encountered
then an exception is thrown. This automatically handles compact and non-compact formats | [
"Checks",
"to",
"see",
"if",
"all",
"the",
"provided",
"matrices",
"are",
"the",
"expected",
"size",
"for",
"an",
"SVD",
".",
"If",
"an",
"error",
"is",
"encountered",
"then",
"an",
"exception",
"is",
"thrown",
".",
"This",
"automatically",
"handles",
"com... | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/SingularOps_DDRM.java#L319-L347 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/SingularOps_DDRM.java | SingularOps_DDRM.nullspaceQR | public static DMatrixRMaj nullspaceQR( DMatrixRMaj A , int totalSingular ) {
SolveNullSpaceQR_DDRM solver = new SolveNullSpaceQR_DDRM();
DMatrixRMaj nullspace = new DMatrixRMaj(1,1);
if( !solver.process(A,totalSingular,nullspace))
throw new RuntimeException("Solver failed. try SVD ... | java | public static DMatrixRMaj nullspaceQR( DMatrixRMaj A , int totalSingular ) {
SolveNullSpaceQR_DDRM solver = new SolveNullSpaceQR_DDRM();
DMatrixRMaj nullspace = new DMatrixRMaj(1,1);
if( !solver.process(A,totalSingular,nullspace))
throw new RuntimeException("Solver failed. try SVD ... | [
"public",
"static",
"DMatrixRMaj",
"nullspaceQR",
"(",
"DMatrixRMaj",
"A",
",",
"int",
"totalSingular",
")",
"{",
"SolveNullSpaceQR_DDRM",
"solver",
"=",
"new",
"SolveNullSpaceQR_DDRM",
"(",
")",
";",
"DMatrixRMaj",
"nullspace",
"=",
"new",
"DMatrixRMaj",
"(",
"1"... | Computes the null space using QR decomposition. This is much faster than using SVD
@param A (Input) Matrix
@param totalSingular Number of singular values
@return Null space | [
"Computes",
"the",
"null",
"space",
"using",
"QR",
"decomposition",
".",
"This",
"is",
"much",
"faster",
"than",
"using",
"SVD"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/SingularOps_DDRM.java#L434-L443 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/SingularOps_DDRM.java | SingularOps_DDRM.nullspaceQRP | public static DMatrixRMaj nullspaceQRP( DMatrixRMaj A , int totalSingular ) {
SolveNullSpaceQRP_DDRM solver = new SolveNullSpaceQRP_DDRM();
DMatrixRMaj nullspace = new DMatrixRMaj(1,1);
if( !solver.process(A,totalSingular,nullspace))
throw new RuntimeException("Solver failed. try S... | java | public static DMatrixRMaj nullspaceQRP( DMatrixRMaj A , int totalSingular ) {
SolveNullSpaceQRP_DDRM solver = new SolveNullSpaceQRP_DDRM();
DMatrixRMaj nullspace = new DMatrixRMaj(1,1);
if( !solver.process(A,totalSingular,nullspace))
throw new RuntimeException("Solver failed. try S... | [
"public",
"static",
"DMatrixRMaj",
"nullspaceQRP",
"(",
"DMatrixRMaj",
"A",
",",
"int",
"totalSingular",
")",
"{",
"SolveNullSpaceQRP_DDRM",
"solver",
"=",
"new",
"SolveNullSpaceQRP_DDRM",
"(",
")",
";",
"DMatrixRMaj",
"nullspace",
"=",
"new",
"DMatrixRMaj",
"(",
... | Computes the null space using QRP decomposition. This is faster than using SVD but slower than QR.
Much more stable than QR though.
@param A (Input) Matrix
@param totalSingular Number of singular values
@return Null space | [
"Computes",
"the",
"null",
"space",
"using",
"QRP",
"decomposition",
".",
"This",
"is",
"faster",
"than",
"using",
"SVD",
"but",
"slower",
"than",
"QR",
".",
"Much",
"more",
"stable",
"than",
"QR",
"though",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/SingularOps_DDRM.java#L452-L461 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/SingularOps_DDRM.java | SingularOps_DDRM.nullspaceSVD | public static DMatrixRMaj nullspaceSVD( DMatrixRMaj A , int totalSingular ) {
SolveNullSpace<DMatrixRMaj> solver = new SolveNullSpaceSvd_DDRM();
DMatrixRMaj nullspace = new DMatrixRMaj(1,1);
if( !solver.process(A,totalSingular,nullspace))
throw new RuntimeException("Solver failed. ... | java | public static DMatrixRMaj nullspaceSVD( DMatrixRMaj A , int totalSingular ) {
SolveNullSpace<DMatrixRMaj> solver = new SolveNullSpaceSvd_DDRM();
DMatrixRMaj nullspace = new DMatrixRMaj(1,1);
if( !solver.process(A,totalSingular,nullspace))
throw new RuntimeException("Solver failed. ... | [
"public",
"static",
"DMatrixRMaj",
"nullspaceSVD",
"(",
"DMatrixRMaj",
"A",
",",
"int",
"totalSingular",
")",
"{",
"SolveNullSpace",
"<",
"DMatrixRMaj",
">",
"solver",
"=",
"new",
"SolveNullSpaceSvd_DDRM",
"(",
")",
";",
"DMatrixRMaj",
"nullspace",
"=",
"new",
"... | Computes the null space using SVD. Slowest bust most stable way to find the solution
@param A (Input) Matrix
@param totalSingular Number of singular values
@return Null space | [
"Computes",
"the",
"null",
"space",
"using",
"SVD",
".",
"Slowest",
"bust",
"most",
"stable",
"way",
"to",
"find",
"the",
"solution"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/SingularOps_DDRM.java#L470-L479 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/SingularOps_DDRM.java | SingularOps_DDRM.rank | public static int rank(SingularValueDecomposition_F64 svd , double threshold ) {
int numRank=0;
double w[]= svd.getSingularValues();
int N = svd.numberOfSingularValues();
for( int j = 0; j < N; j++ ) {
if( w[j] > threshold)
numRank++;
}
ret... | java | public static int rank(SingularValueDecomposition_F64 svd , double threshold ) {
int numRank=0;
double w[]= svd.getSingularValues();
int N = svd.numberOfSingularValues();
for( int j = 0; j < N; j++ ) {
if( w[j] > threshold)
numRank++;
}
ret... | [
"public",
"static",
"int",
"rank",
"(",
"SingularValueDecomposition_F64",
"svd",
",",
"double",
"threshold",
")",
"{",
"int",
"numRank",
"=",
"0",
";",
"double",
"w",
"[",
"]",
"=",
"svd",
".",
"getSingularValues",
"(",
")",
";",
"int",
"N",
"=",
"svd",
... | Extracts the rank of a matrix using a preexisting decomposition.
@see #singularThreshold(SingularValueDecomposition_F64)
@param svd A precomputed decomposition. Not modified.
@param threshold Tolerance used to determine of a singular value is singular.
@return The rank of the decomposed matrix. | [
"Extracts",
"the",
"rank",
"of",
"a",
"matrix",
"using",
"a",
"preexisting",
"decomposition",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/SingularOps_DDRM.java#L608-L621 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/SingularOps_DDRM.java | SingularOps_DDRM.nullity | public static int nullity(SingularValueDecomposition_F64 svd , double threshold ) {
int ret = 0;
double w[]= svd.getSingularValues();
int N = svd.numberOfSingularValues();
int numCol = svd.numCols();
for( int j = 0; j < N; j++ ) {
if( w[j] <= threshold) ret++;
... | java | public static int nullity(SingularValueDecomposition_F64 svd , double threshold ) {
int ret = 0;
double w[]= svd.getSingularValues();
int N = svd.numberOfSingularValues();
int numCol = svd.numCols();
for( int j = 0; j < N; j++ ) {
if( w[j] <= threshold) ret++;
... | [
"public",
"static",
"int",
"nullity",
"(",
"SingularValueDecomposition_F64",
"svd",
",",
"double",
"threshold",
")",
"{",
"int",
"ret",
"=",
"0",
";",
"double",
"w",
"[",
"]",
"=",
"svd",
".",
"getSingularValues",
"(",
")",
";",
"int",
"N",
"=",
"svd",
... | Extracts the nullity of a matrix using a preexisting decomposition.
@see #singularThreshold(SingularValueDecomposition_F64)
@param svd A precomputed decomposition. Not modified.
@param threshold Tolerance used to determine of a singular value is singular.
@return The nullity of the decomposed matrix. | [
"Extracts",
"the",
"nullity",
"of",
"a",
"matrix",
"using",
"a",
"preexisting",
"decomposition",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/SingularOps_DDRM.java#L645-L658 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/simple/SimpleSVD.java | SimpleSVD.getSingularValues | public double[] getSingularValues() {
double ret[] = new double[W.numCols()];
for (int i = 0; i < ret.length; i++) {
ret[i] = getSingleValue(i);
}
return ret;
} | java | public double[] getSingularValues() {
double ret[] = new double[W.numCols()];
for (int i = 0; i < ret.length; i++) {
ret[i] = getSingleValue(i);
}
return ret;
} | [
"public",
"double",
"[",
"]",
"getSingularValues",
"(",
")",
"{",
"double",
"ret",
"[",
"]",
"=",
"new",
"double",
"[",
"W",
".",
"numCols",
"(",
")",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ret",
".",
"length",
";",
"i",
... | Returns an array of all the singular values | [
"Returns",
"an",
"array",
"of",
"all",
"the",
"singular",
"values"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/simple/SimpleSVD.java#L176-L183 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/simple/SimpleSVD.java | SimpleSVD.rank | public int rank() {
if( is64 ) {
return SingularOps_DDRM.rank((SingularValueDecomposition_F64)svd, tol);
} else {
return SingularOps_FDRM.rank((SingularValueDecomposition_F32)svd, (float)tol);
}
} | java | public int rank() {
if( is64 ) {
return SingularOps_DDRM.rank((SingularValueDecomposition_F64)svd, tol);
} else {
return SingularOps_FDRM.rank((SingularValueDecomposition_F32)svd, (float)tol);
}
} | [
"public",
"int",
"rank",
"(",
")",
"{",
"if",
"(",
"is64",
")",
"{",
"return",
"SingularOps_DDRM",
".",
"rank",
"(",
"(",
"SingularValueDecomposition_F64",
")",
"svd",
",",
"tol",
")",
";",
"}",
"else",
"{",
"return",
"SingularOps_FDRM",
".",
"rank",
"("... | Returns the rank of the decomposed matrix.
@see SingularOps_DDRM#rank(SingularValueDecomposition_F64, double)
@return The matrix's rank | [
"Returns",
"the",
"rank",
"of",
"the",
"decomposed",
"matrix",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/simple/SimpleSVD.java#L192-L198 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/simple/SimpleSVD.java | SimpleSVD.nullity | public int nullity() {
if( is64 ) {
return SingularOps_DDRM.nullity((SingularValueDecomposition_F64)svd, 10.0 * UtilEjml.EPS);
} else {
return SingularOps_FDRM.nullity((SingularValueDecomposition_F32)svd, 5.0f * UtilEjml.F_EPS);
}
} | java | public int nullity() {
if( is64 ) {
return SingularOps_DDRM.nullity((SingularValueDecomposition_F64)svd, 10.0 * UtilEjml.EPS);
} else {
return SingularOps_FDRM.nullity((SingularValueDecomposition_F32)svd, 5.0f * UtilEjml.F_EPS);
}
} | [
"public",
"int",
"nullity",
"(",
")",
"{",
"if",
"(",
"is64",
")",
"{",
"return",
"SingularOps_DDRM",
".",
"nullity",
"(",
"(",
"SingularValueDecomposition_F64",
")",
"svd",
",",
"10.0",
"*",
"UtilEjml",
".",
"EPS",
")",
";",
"}",
"else",
"{",
"return",
... | The nullity of the decomposed matrix.
@see SingularOps_DDRM#nullity(SingularValueDecomposition_F64, double)
@return The matrix's nullity | [
"The",
"nullity",
"of",
"the",
"decomposed",
"matrix",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/simple/SimpleSVD.java#L207-L213 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/ManagerFunctions.java | ManagerFunctions.isFunctionName | public boolean isFunctionName( String s ) {
if( input1.containsKey(s))
return true;
if( inputN.containsKey(s))
return true;
return false;
} | java | public boolean isFunctionName( String s ) {
if( input1.containsKey(s))
return true;
if( inputN.containsKey(s))
return true;
return false;
} | [
"public",
"boolean",
"isFunctionName",
"(",
"String",
"s",
")",
"{",
"if",
"(",
"input1",
".",
"containsKey",
"(",
"s",
")",
")",
"return",
"true",
";",
"if",
"(",
"inputN",
".",
"containsKey",
"(",
"s",
")",
")",
"return",
"true",
";",
"return",
"fa... | Returns true if the string matches the name of a function | [
"Returns",
"true",
"if",
"the",
"string",
"matches",
"the",
"name",
"of",
"a",
"function"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/ManagerFunctions.java#L47-L54 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/ManagerFunctions.java | ManagerFunctions.create | public Operation.Info create( char op , Variable input ) {
switch( op ) {
case '\'':
return Operation.transpose(input, managerTemp);
default:
throw new RuntimeException("Unknown operation " + op);
}
} | java | public Operation.Info create( char op , Variable input ) {
switch( op ) {
case '\'':
return Operation.transpose(input, managerTemp);
default:
throw new RuntimeException("Unknown operation " + op);
}
} | [
"public",
"Operation",
".",
"Info",
"create",
"(",
"char",
"op",
",",
"Variable",
"input",
")",
"{",
"switch",
"(",
"op",
")",
"{",
"case",
"'",
"'",
":",
"return",
"Operation",
".",
"transpose",
"(",
"input",
",",
"managerTemp",
")",
";",
"default",
... | Create a new instance of a single input function from an operator character
@param op Which operation
@param input Input variable
@return Resulting operation | [
"Create",
"a",
"new",
"instance",
"of",
"a",
"single",
"input",
"function",
"from",
"an",
"operator",
"character"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/ManagerFunctions.java#L88-L96 | train |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/ManagerFunctions.java | ManagerFunctions.create | public Operation.Info create( Symbol op , Variable left , Variable right ) {
switch( op ) {
case PLUS:
return Operation.add(left, right, managerTemp);
case MINUS:
return Operation.subtract(left, right, managerTemp);
case TIMES:
... | java | public Operation.Info create( Symbol op , Variable left , Variable right ) {
switch( op ) {
case PLUS:
return Operation.add(left, right, managerTemp);
case MINUS:
return Operation.subtract(left, right, managerTemp);
case TIMES:
... | [
"public",
"Operation",
".",
"Info",
"create",
"(",
"Symbol",
"op",
",",
"Variable",
"left",
",",
"Variable",
"right",
")",
"{",
"switch",
"(",
"op",
")",
"{",
"case",
"PLUS",
":",
"return",
"Operation",
".",
"add",
"(",
"left",
",",
"right",
",",
"ma... | Create a new instance of a two input function from an operator character
@param op Which operation
@param left Input variable on left
@param right Input variable on right
@return Resulting operation | [
"Create",
"a",
"new",
"instance",
"of",
"a",
"two",
"input",
"function",
"from",
"an",
"operator",
"character"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/ManagerFunctions.java#L105-L137 | train |
lessthanoptimal/ejml | main/ejml-dsparse/src/org/ejml/sparse/csc/misc/ColumnCounts_DSCC.java | ColumnCounts_DSCC.initialize | void initialize(DMatrixSparseCSC A) {
m = A.numRows;
n = A.numCols;
int s = 4*n + (ata ? (n+m+1) : 0);
gw.reshape(s);
w = gw.data;
// compute the transpose of A
At.reshape(A.numCols,A.numRows,A.nz_length);
CommonOps_DSCC.transpose(A,At,gw);
// i... | java | void initialize(DMatrixSparseCSC A) {
m = A.numRows;
n = A.numCols;
int s = 4*n + (ata ? (n+m+1) : 0);
gw.reshape(s);
w = gw.data;
// compute the transpose of A
At.reshape(A.numCols,A.numRows,A.nz_length);
CommonOps_DSCC.transpose(A,At,gw);
// i... | [
"void",
"initialize",
"(",
"DMatrixSparseCSC",
"A",
")",
"{",
"m",
"=",
"A",
".",
"numRows",
";",
"n",
"=",
"A",
".",
"numCols",
";",
"int",
"s",
"=",
"4",
"*",
"n",
"+",
"(",
"ata",
"?",
"(",
"n",
"+",
"m",
"+",
"1",
")",
":",
"0",
")",
... | Initializes class data structures and parameters | [
"Initializes",
"class",
"data",
"structures",
"and",
"parameters"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/misc/ColumnCounts_DSCC.java#L74-L93 | train |
lessthanoptimal/ejml | main/ejml-dsparse/src/org/ejml/sparse/csc/misc/ColumnCounts_DSCC.java | ColumnCounts_DSCC.process | public void process(DMatrixSparseCSC A , int parent[], int post[], int counts[] ) {
if( counts.length < A.numCols )
throw new IllegalArgumentException("counts must be at least of length A.numCols");
initialize(A);
int delta[] = counts;
findFirstDescendant(parent, post, delt... | java | public void process(DMatrixSparseCSC A , int parent[], int post[], int counts[] ) {
if( counts.length < A.numCols )
throw new IllegalArgumentException("counts must be at least of length A.numCols");
initialize(A);
int delta[] = counts;
findFirstDescendant(parent, post, delt... | [
"public",
"void",
"process",
"(",
"DMatrixSparseCSC",
"A",
",",
"int",
"parent",
"[",
"]",
",",
"int",
"post",
"[",
"]",
",",
"int",
"counts",
"[",
"]",
")",
"{",
"if",
"(",
"counts",
".",
"length",
"<",
"A",
".",
"numCols",
")",
"throw",
"new",
... | Processes and computes column counts of A
@param A (Input) Upper triangular matrix
@param parent (Input) Elimination tree.
@param post (Input) Post order permutation of elimination tree. See {@link TriangularSolver_DSCC#postorder}
@param counts (Output) Storage for column counts. | [
"Processes",
"and",
"computes",
"column",
"counts",
"of",
"A"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/misc/ColumnCounts_DSCC.java#L103-L143 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/DMatrixVisualization.java | DMatrixVisualization.show | public static void show(DMatrixD1 A , String title ) {
JFrame frame = new JFrame(title);
int width = 300;
int height = 300;
if( A.numRows > A.numCols) {
width = width*A.numCols/A.numRows;
} else {
height = height*A.numRows/A.numCols;
}
D... | java | public static void show(DMatrixD1 A , String title ) {
JFrame frame = new JFrame(title);
int width = 300;
int height = 300;
if( A.numRows > A.numCols) {
width = width*A.numCols/A.numRows;
} else {
height = height*A.numRows/A.numCols;
}
D... | [
"public",
"static",
"void",
"show",
"(",
"DMatrixD1",
"A",
",",
"String",
"title",
")",
"{",
"JFrame",
"frame",
"=",
"new",
"JFrame",
"(",
"title",
")",
";",
"int",
"width",
"=",
"300",
";",
"int",
"height",
"=",
"300",
";",
"if",
"(",
"A",
".",
... | Creates a window visually showing the matrix's state. Block means an element is zero.
Red positive and blue negative. More intense the color larger the element's absolute value
is.
@param A A matrix.
@param title Name of the window. | [
"Creates",
"a",
"window",
"visually",
"showing",
"the",
"matrix",
"s",
"state",
".",
"Block",
"means",
"an",
"element",
"is",
"zero",
".",
"Red",
"positive",
"and",
"blue",
"negative",
".",
"More",
"intense",
"the",
"color",
"larger",
"the",
"element",
"s"... | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/DMatrixVisualization.java#L48-L68 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/decomposition/eig/EigenvalueSmall_F64.java | EigenvalueSmall_F64.value2x2 | public void value2x2( double a11 , double a12, double a21 , double a22 )
{
// apply a rotators such that th a11 and a22 elements are the same
double c,s;
if( a12 + a21 == 0 ) { // is this pointless since
c = s = 1.0 / Math.sqrt(2);
} else {
double aa = (a11-a... | java | public void value2x2( double a11 , double a12, double a21 , double a22 )
{
// apply a rotators such that th a11 and a22 elements are the same
double c,s;
if( a12 + a21 == 0 ) { // is this pointless since
c = s = 1.0 / Math.sqrt(2);
} else {
double aa = (a11-a... | [
"public",
"void",
"value2x2",
"(",
"double",
"a11",
",",
"double",
"a12",
",",
"double",
"a21",
",",
"double",
"a22",
")",
"{",
"// apply a rotators such that th a11 and a22 elements are the same",
"double",
"c",
",",
"s",
";",
"if",
"(",
"a12",
"+",
"a21",
"=... | if |a11-a22| >> |a12+a21| there might be a better way. see pg371 | [
"if",
"|a11",
"-",
"a22|",
">>",
"|a12",
"+",
"a21|",
"there",
"might",
"be",
"a",
"better",
"way",
".",
"see",
"pg371"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/decomposition/eig/EigenvalueSmall_F64.java#L33-L89 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/decomposition/eig/EigenvalueSmall_F64.java | EigenvalueSmall_F64.value2x2_fast | public void value2x2_fast( double a11 , double a12, double a21 , double a22 )
{
double left = (a11+a22)/2.0;
double inside = 4.0*a12*a21 + (a11-a22)*(a11-a22);
if( inside < 0 ) {
value0.real = value1.real = left;
value0.imaginary = Math.sqrt(-inside)/2.0;
... | java | public void value2x2_fast( double a11 , double a12, double a21 , double a22 )
{
double left = (a11+a22)/2.0;
double inside = 4.0*a12*a21 + (a11-a22)*(a11-a22);
if( inside < 0 ) {
value0.real = value1.real = left;
value0.imaginary = Math.sqrt(-inside)/2.0;
... | [
"public",
"void",
"value2x2_fast",
"(",
"double",
"a11",
",",
"double",
"a12",
",",
"double",
"a21",
",",
"double",
"a22",
")",
"{",
"double",
"left",
"=",
"(",
"a11",
"+",
"a22",
")",
"/",
"2.0",
";",
"double",
"inside",
"=",
"4.0",
"*",
"a12",
"*... | Computes the eigenvalues of a 2 by 2 matrix using a faster but more prone to errors method. This
is the typical method. | [
"Computes",
"the",
"eigenvalues",
"of",
"a",
"2",
"by",
"2",
"matrix",
"using",
"a",
"faster",
"but",
"more",
"prone",
"to",
"errors",
"method",
".",
"This",
"is",
"the",
"typical",
"method",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/decomposition/eig/EigenvalueSmall_F64.java#L95-L110 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/decomposition/eig/EigenvalueSmall_F64.java | EigenvalueSmall_F64.symm2x2_fast | public void symm2x2_fast( double a11 , double a12, double a22 )
{
// double p = (a11 - a22)*0.5;
// double r = Math.sqrt(p*p + a12*a12);
//
// value0.real = a22 + a12*a12/(r-p);
// value1.real = a22 - a12*a12/(r+p);
// }
//
// public void symm2x2_std( double a11 , double a12, doubl... | java | public void symm2x2_fast( double a11 , double a12, double a22 )
{
// double p = (a11 - a22)*0.5;
// double r = Math.sqrt(p*p + a12*a12);
//
// value0.real = a22 + a12*a12/(r-p);
// value1.real = a22 - a12*a12/(r+p);
// }
//
// public void symm2x2_std( double a11 , double a12, doubl... | [
"public",
"void",
"symm2x2_fast",
"(",
"double",
"a11",
",",
"double",
"a12",
",",
"double",
"a22",
")",
"{",
"// double p = (a11 - a22)*0.5;",
"// double r = Math.sqrt(p*p + a12*a12);",
"//",
"// value0.real = a22 + a12*a12/(r-p);",
"// value1.real = ... | See page 385 of Fundamentals of Matrix Computations 2nd | [
"See",
"page",
"385",
"of",
"Fundamentals",
"of",
"Matrix",
"Computations",
"2nd"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/decomposition/eig/EigenvalueSmall_F64.java#L116-L132 | train |
lessthanoptimal/ejml | main/ejml-experimental/benchmarks/src/org/ejml/dense/row/mult/BenchmarkMatrixMultAccessors.java | BenchmarkMatrixMultAccessors.wrapped | public static long wrapped(DMatrixRMaj a , DMatrixRMaj b , DMatrixRMaj c )
{
long timeBefore = System.currentTimeMillis();
double valA;
int indexCbase= 0;
int endOfKLoop = b.numRows*b.numCols;
for( int i = 0; i < a.numRows; i++ ) {
int indexA = i*a.numCols;
... | java | public static long wrapped(DMatrixRMaj a , DMatrixRMaj b , DMatrixRMaj c )
{
long timeBefore = System.currentTimeMillis();
double valA;
int indexCbase= 0;
int endOfKLoop = b.numRows*b.numCols;
for( int i = 0; i < a.numRows; i++ ) {
int indexA = i*a.numCols;
... | [
"public",
"static",
"long",
"wrapped",
"(",
"DMatrixRMaj",
"a",
",",
"DMatrixRMaj",
"b",
",",
"DMatrixRMaj",
"c",
")",
"{",
"long",
"timeBefore",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"double",
"valA",
";",
"int",
"indexCbase",
"=",
"0",
... | Wrapper functions with no bounds checking are used to access matrix internals | [
"Wrapper",
"functions",
"with",
"no",
"bounds",
"checking",
"are",
"used",
"to",
"access",
"matrix",
"internals"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-experimental/benchmarks/src/org/ejml/dense/row/mult/BenchmarkMatrixMultAccessors.java#L83-L119 | train |
lessthanoptimal/ejml | main/ejml-experimental/benchmarks/src/org/ejml/dense/row/mult/BenchmarkMatrixMultAccessors.java | BenchmarkMatrixMultAccessors.access2d | public static long access2d(DMatrixRMaj a , DMatrixRMaj b , DMatrixRMaj c )
{
long timeBefore = System.currentTimeMillis();
for( int i = 0; i < a.numRows; i++ ) {
for( int j = 0; j < b.numCols; j++ ) {
c.set(i,j,a.get(i,0)*b.get(0,j));
}
for( in... | java | public static long access2d(DMatrixRMaj a , DMatrixRMaj b , DMatrixRMaj c )
{
long timeBefore = System.currentTimeMillis();
for( int i = 0; i < a.numRows; i++ ) {
for( int j = 0; j < b.numCols; j++ ) {
c.set(i,j,a.get(i,0)*b.get(0,j));
}
for( in... | [
"public",
"static",
"long",
"access2d",
"(",
"DMatrixRMaj",
"a",
",",
"DMatrixRMaj",
"b",
",",
"DMatrixRMaj",
"c",
")",
"{",
"long",
"timeBefore",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
... | Only sets and gets that are by row and column are used. | [
"Only",
"sets",
"and",
"gets",
"that",
"are",
"by",
"row",
"and",
"column",
"are",
"used",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-experimental/benchmarks/src/org/ejml/dense/row/mult/BenchmarkMatrixMultAccessors.java#L124-L143 | train |
lessthanoptimal/ejml | main/ejml-core/src/org/ejml/FancyPrint.java | FancyPrint.p | public String p(double value ) {
return UtilEjml.fancyString(value,format,false,length,significant);
} | java | public String p(double value ) {
return UtilEjml.fancyString(value,format,false,length,significant);
} | [
"public",
"String",
"p",
"(",
"double",
"value",
")",
"{",
"return",
"UtilEjml",
".",
"fancyString",
"(",
"value",
",",
"format",
",",
"false",
",",
"length",
",",
"significant",
")",
";",
"}"
] | Fancy print without a space added to positive numbers | [
"Fancy",
"print",
"without",
"a",
"space",
"added",
"to",
"positive",
"numbers"
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/FancyPrint.java#L61-L63 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/decomposition/eig/symm/SymmetricQrAlgorithm_DDRM.java | SymmetricQrAlgorithm_DDRM.process | public boolean process( int sideLength,
double diag[] ,
double off[] ,
double eigenvalues[] ) {
if( diag != null )
helper.init(diag,off,sideLength);
if( Q == null )
Q = CommonOps_DDRM.identity(hel... | java | public boolean process( int sideLength,
double diag[] ,
double off[] ,
double eigenvalues[] ) {
if( diag != null )
helper.init(diag,off,sideLength);
if( Q == null )
Q = CommonOps_DDRM.identity(hel... | [
"public",
"boolean",
"process",
"(",
"int",
"sideLength",
",",
"double",
"diag",
"[",
"]",
",",
"double",
"off",
"[",
"]",
",",
"double",
"eigenvalues",
"[",
"]",
")",
"{",
"if",
"(",
"diag",
"!=",
"null",
")",
"helper",
".",
"init",
"(",
"diag",
"... | Computes the eigenvalue of the provided tridiagonal matrix. Note that only the upper portion
needs to be tridiagonal. The bottom diagonal is assumed to be the same as the top.
@param sideLength Number of rows and columns in the input matrix.
@param diag Diagonal elements from tridiagonal matrix. Modified.
@param off... | [
"Computes",
"the",
"eigenvalue",
"of",
"the",
"provided",
"tridiagonal",
"matrix",
".",
"Note",
"that",
"only",
"the",
"upper",
"portion",
"needs",
"to",
"be",
"tridiagonal",
".",
"The",
"bottom",
"diagonal",
"is",
"assumed",
"to",
"be",
"the",
"same",
"as",... | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/decomposition/eig/symm/SymmetricQrAlgorithm_DDRM.java#L111-L126 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/decomposition/eig/symm/SymmetricQrAlgorithm_DDRM.java | SymmetricQrAlgorithm_DDRM.performStep | public void performStep() {
// check for zeros
for( int i = helper.x2-1; i >= helper.x1; i-- ) {
if( helper.isZero(i) ) {
helper.splits[helper.numSplits++] = i;
helper.x1 = i+1;
return;
}
}
double lambda;
i... | java | public void performStep() {
// check for zeros
for( int i = helper.x2-1; i >= helper.x1; i-- ) {
if( helper.isZero(i) ) {
helper.splits[helper.numSplits++] = i;
helper.x1 = i+1;
return;
}
}
double lambda;
i... | [
"public",
"void",
"performStep",
"(",
")",
"{",
"// check for zeros",
"for",
"(",
"int",
"i",
"=",
"helper",
".",
"x2",
"-",
"1",
";",
"i",
">=",
"helper",
".",
"x1",
";",
"i",
"--",
")",
"{",
"if",
"(",
"helper",
".",
"isZero",
"(",
"i",
")",
... | First looks for zeros and then performs the implicit single step in the QR Algorithm. | [
"First",
"looks",
"for",
"zeros",
"and",
"then",
"performs",
"the",
"implicit",
"single",
"step",
"in",
"the",
"QR",
"Algorithm",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/decomposition/eig/symm/SymmetricQrAlgorithm_DDRM.java#L177-L205 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/misc/TransposeAlgs_DDRM.java | TransposeAlgs_DDRM.block | public static void block(DMatrix1Row A , DMatrix1Row A_tran ,
final int blockLength )
{
for( int i = 0; i < A.numRows; i += blockLength ) {
int blockHeight = Math.min( blockLength , A.numRows - i);
int indexSrc = i*A.numCols;
int indexDst = i... | java | public static void block(DMatrix1Row A , DMatrix1Row A_tran ,
final int blockLength )
{
for( int i = 0; i < A.numRows; i += blockLength ) {
int blockHeight = Math.min( blockLength , A.numRows - i);
int indexSrc = i*A.numCols;
int indexDst = i... | [
"public",
"static",
"void",
"block",
"(",
"DMatrix1Row",
"A",
",",
"DMatrix1Row",
"A_tran",
",",
"final",
"int",
"blockLength",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"A",
".",
"numRows",
";",
"i",
"+=",
"blockLength",
")",
"{",
... | Performs a transpose across block sub-matrices. Reduces
the number of cache misses on larger matrices.
*NOTE* If this is beneficial is highly dependent on the computer it is run on. e.g:
- Q6600 Almost twice as fast as standard.
- Pentium-M Same speed and some times a bit slower than standard.
@param A Original matr... | [
"Performs",
"a",
"transpose",
"across",
"block",
"sub",
"-",
"matrices",
".",
"Reduces",
"the",
"number",
"of",
"cache",
"misses",
"on",
"larger",
"matrices",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/misc/TransposeAlgs_DDRM.java#L65-L95 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/generic/GenericMatrixOps_F64.java | GenericMatrixOps_F64.isIdentity | public static boolean isIdentity(DMatrix a , double tol )
{
for( int i = 0; i < a.getNumRows(); i++ ) {
for( int j = 0; j < a.getNumCols(); j++ ) {
if( i == j ) {
if( Math.abs(a.get(i,j)-1.0) > tol )
return false;
} else... | java | public static boolean isIdentity(DMatrix a , double tol )
{
for( int i = 0; i < a.getNumRows(); i++ ) {
for( int j = 0; j < a.getNumCols(); j++ ) {
if( i == j ) {
if( Math.abs(a.get(i,j)-1.0) > tol )
return false;
} else... | [
"public",
"static",
"boolean",
"isIdentity",
"(",
"DMatrix",
"a",
",",
"double",
"tol",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"a",
".",
"getNumRows",
"(",
")",
";",
"i",
"++",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
"... | Returns true if the provided matrix is has a value of 1 along the diagonal
elements and zero along all the other elements.
@param a Matrix being inspected.
@param tol How close to zero or one each element needs to be.
@return If it is within tolerance to an identity matrix. | [
"Returns",
"true",
"if",
"the",
"provided",
"matrix",
"is",
"has",
"a",
"value",
"of",
"1",
"along",
"the",
"diagonal",
"elements",
"and",
"zero",
"along",
"all",
"the",
"other",
"elements",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/generic/GenericMatrixOps_F64.java#L63-L77 | train |
lessthanoptimal/ejml | main/ejml-dsparse/src/org/ejml/sparse/csc/decomposition/qr/QrHelperFunctions_DSCC.java | QrHelperFunctions_DSCC.computeHouseholder | public static double computeHouseholder(double []x , int xStart , int xEnd , double max , DScalar gamma ) {
double tau = 0;
for (int i = xStart; i < xEnd ; i++) {
double val = x[i] /= max;
tau += val*val;
}
tau = Math.sqrt(tau);
if( x[xStart] < 0 ) {
... | java | public static double computeHouseholder(double []x , int xStart , int xEnd , double max , DScalar gamma ) {
double tau = 0;
for (int i = xStart; i < xEnd ; i++) {
double val = x[i] /= max;
tau += val*val;
}
tau = Math.sqrt(tau);
if( x[xStart] < 0 ) {
... | [
"public",
"static",
"double",
"computeHouseholder",
"(",
"double",
"[",
"]",
"x",
",",
"int",
"xStart",
",",
"int",
"xEnd",
",",
"double",
"max",
",",
"DScalar",
"gamma",
")",
"{",
"double",
"tau",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"xStart"... | Creates a householder reflection.
(I-gamma*v*v')*x = tau*e1
<p>NOTE: Same as cs_house in csparse</p>
@param x (Input) Vector x (Output) Vector v. Modified.
@param xStart First index in X that is to be processed
@param xEnd Last + 1 index in x that is to be processed.
@param gamma (Output) Storage for computed gamma
@... | [
"Creates",
"a",
"householder",
"reflection",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/decomposition/qr/QrHelperFunctions_DSCC.java#L110-L128 | train |
lessthanoptimal/ejml | main/ejml-experimental/benchmarks/src/org/ejml/BenchmarkInliningGetSet.java | BenchmarkInliningGetSet.get1D | public static long get1D(DMatrixRMaj A , int n ) {
long before = System.currentTimeMillis();
double total = 0;
for( int iter = 0; iter < n; iter++ ) {
int index = 0;
for( int i = 0; i < A.numRows; i++ ) {
int end = index+A.numCols;
whil... | java | public static long get1D(DMatrixRMaj A , int n ) {
long before = System.currentTimeMillis();
double total = 0;
for( int iter = 0; iter < n; iter++ ) {
int index = 0;
for( int i = 0; i < A.numRows; i++ ) {
int end = index+A.numCols;
whil... | [
"public",
"static",
"long",
"get1D",
"(",
"DMatrixRMaj",
"A",
",",
"int",
"n",
")",
"{",
"long",
"before",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"double",
"total",
"=",
"0",
";",
"for",
"(",
"int",
"iter",
"=",
"0",
";",
"iter",
"... | Get by index is used here. | [
"Get",
"by",
"index",
"is",
"used",
"here",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-experimental/benchmarks/src/org/ejml/BenchmarkInliningGetSet.java#L91-L115 | train |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/block/decomposition/qr/QRDecompositionHouseholder_DDRB.java | QRDecompositionHouseholder_DDRB.initializeQ | public static DMatrixRBlock initializeQ(DMatrixRBlock Q,
int numRows , int numCols , int blockLength ,
boolean compact) {
int minLength = Math.min(numRows,numCols);
if( compact ) {
if( Q == null ) {
... | java | public static DMatrixRBlock initializeQ(DMatrixRBlock Q,
int numRows , int numCols , int blockLength ,
boolean compact) {
int minLength = Math.min(numRows,numCols);
if( compact ) {
if( Q == null ) {
... | [
"public",
"static",
"DMatrixRBlock",
"initializeQ",
"(",
"DMatrixRBlock",
"Q",
",",
"int",
"numRows",
",",
"int",
"numCols",
",",
"int",
"blockLength",
",",
"boolean",
"compact",
")",
"{",
"int",
"minLength",
"=",
"Math",
".",
"min",
"(",
"numRows",
",",
"... | Sanity checks the input or declares a new matrix. Return matrix is an identity matrix. | [
"Sanity",
"checks",
"the",
"input",
"or",
"declares",
"a",
"new",
"matrix",
".",
"Return",
"matrix",
"is",
"an",
"identity",
"matrix",
"."
] | 1444680cc487af5e866730e62f48f5f9636850d9 | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/block/decomposition/qr/QRDecompositionHouseholder_DDRB.java#L124-L152 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.