Gecode::Int::ValSet Class Reference
Class for storing values of already assigned views. More...
#include <val-set.hh>
Classes | |
| class | Ranges |
| Iterator over ranges. More... | |
Public Member Functions | |
| ValSet (void) | |
| Initialize. | |
| void | add (Space &home, int v) |
| Add value v to value set. | |
| int | size (void) const |
| Return size (number of values). | |
| bool | empty (void) const |
| Test whether set is empty. | |
| int | min (void) const |
| Return smallest value (provided the set is not empty). | |
| int | max (void) const |
| Return largest value (provided the set is not empty). | |
| template<class View > | |
| Iter::Ranges::CompareStatus | compare (View x) const |
| Compare view x with value set. | |
| template<class View > | |
| bool | subset (View x) const |
| Whether all values of x are included in the value set. | |
| void | update (Space &home, ValSet &vs) |
| Update value set during cloning. | |
| void | flush (void) |
| Flush entries. | |
| void | dispose (Space &home) |
| Dispose value set. | |
Protected Attributes | |
| RangeList * | fst |
| First element of range list. | |
| RangeList * | lst |
| Last element of range list. | |
| int | n |
| Number of stored values (integer precision is sufficient). |
Detailed Description
Class for storing values of already assigned views.
Definition at line 44 of file val-set.hh.
Constructor & Destructor Documentation
| Gecode::Int::ValSet::ValSet | ( | void | ) | [inline] |
Initialize.
Definition at line 41 of file val-set.hpp.
Member Function Documentation
| void Gecode::Int::ValSet::add | ( | Space & | home, | |
| int | v | |||
| ) | [inline] |
Add value v to value set.
Definition at line 45 of file val-set.hpp.
| int Gecode::Int::ValSet::size | ( | void | ) | const [inline] |
Return size (number of values).
Definition at line 81 of file val-set.hpp.
| bool Gecode::Int::ValSet::empty | ( | void | ) | const [inline] |
Test whether set is empty.
Definition at line 86 of file val-set.hpp.
| int Gecode::Int::ValSet::min | ( | void | ) | const [inline] |
Return smallest value (provided the set is not empty).
Definition at line 91 of file val-set.hpp.
| int Gecode::Int::ValSet::max | ( | void | ) | const [inline] |
Return largest value (provided the set is not empty).
Definition at line 96 of file val-set.hpp.
| Iter::Ranges::CompareStatus Gecode::Int::ValSet::compare | ( | View | x | ) | const [inline] |
Compare view x with value set.
Definition at line 161 of file val-set.hpp.
| bool Gecode::Int::ValSet::subset | ( | View | x | ) | const [inline] |
Whether all values of x are included in the value set.
Definition at line 171 of file val-set.hpp.
Update value set during cloning.
Definition at line 101 of file val-set.hpp.
| void Gecode::Int::ValSet::flush | ( | void | ) | [inline] |
Flush entries.
Definition at line 121 of file val-set.hpp.
| void Gecode::Int::ValSet::dispose | ( | Space & | home | ) | [inline] |
Dispose value set.
Definition at line 126 of file val-set.hpp.
Member Data Documentation
RangeList* Gecode::Int::ValSet::fst [protected] |
First element of range list.
Definition at line 47 of file val-set.hh.
RangeList* Gecode::Int::ValSet::lst [protected] |
Last element of range list.
Definition at line 49 of file val-set.hh.
int Gecode::Int::ValSet::n [protected] |
Number of stored values (integer precision is sufficient).
Definition at line 51 of file val-set.hh.
The documentation for this class was generated from the following files:
- gecode/int/val-set.hh
- gecode/int/val-set.hpp


To solve a classification problem with neural network, we usually do these following steps:
1. Pick a network architecture
- Number of input units = dimension of features
- Number of output units = number of classes
- the number of hidden layer and hidden units depends
2. Randomly initialize weights
Considering the bias unit, we add layer_in with 1. And we declare so that all elements in W are in
W = rand(layer_out, 1 + layer_in) * 2 * epsilon - epsilon;
3. Forward propagation to compute
In a neural network model, \[ a^{(L)} = g((\theta^{(L-1)})^Ta^{(L-1)}) \] where g is the sigmoid function and contains a bias unit.
4. Compute the cost function J()
The cost function of the neural network is :
- m is the number of training set
- K is the number of units in the output layer
- is the number of unit in layer
- L is the total number of layers
When , the function is regularized. We take no account of the bias units for the regularization.
hidden = sigmoid([ones(m, 1) X] * Theta1');
h_theta = sigmoid([ones(m, 1) hidden] * Theta2');
term1 = (-y_code)' * log(h_theta);
term2 = (1-y_code)' * log(1-h_theta);
J = 1/m * (sum(term1(:)) - sum(term2(:)));
reg_theta1 = Theta1(:, 2:end);
reg_theta2 = Theta2(:, 2:end);
reg_term = lambda / (2*m) * (reg_theta1(:)' * reg_theta1(:)...
+ reg_theta2(:)' * reg_theta2(:));
J = J + reg_term;
5. Back propagation to compute
for i = 1 to m
-
First, get the values for all units
% code for m training set a1 = [ones(m, 1), X]; z2 = a1 * Theta1'; a2 = [ones(m, 1), sigmoid(z2)]; z3 = a2 * Theta2'; a3 = sigmoid(z3);
-
Second, define error of node j in layer l.
For the output unit,
For l = (L-1), …, 2,% code for m training set delta3 = a3 - y_code; delta2 = delta3 * Theta2(:, 2:end) .* sigmoidGradient(z2);
-
Third, suppose
% code for m training set Delta1 = delta2' * a1; Delta2 = delta3' * a2;
-
Finally,
6. Gradient checking
To make sure that the back propagation didn’t go wrong, the method gradient checking is used.
Suppose e=[0 0 … … 0 0] that is the element.
If
, the propagation will work.
7. Minimize J
Since we have both the cost function and its partial derivatives, we can minimize J with gradient descent or other advanced optimization.


The Man In The Iron Mask
A film review by Monika Huebner Copyright 1998 Monika Huebner
Director: Randall Wallace movie Cast: Leonardo DiCaprio, Jeremy Irons, Gabriel Byrne, Gérard Depardieu, John Malkovich, Anne Parillaud, Judith Godrèche and others
Most of us are familiar with the story of the Three Musketeers, or rather four. The story of the Man In The Iron Mask, also written by Alexandre Dumas, takes place 25 years later - our musketeers got older and each of them is in a different business now. King of France is no longer Louis XIII but Louis XIV, the man who built Versailles.
D'Artagnan (Gabriel Byrne), Athos (John Malkovich), Porthos (Gérard Depardieu) and Aramis (Jeremy Irons) all have their own good reasons to want to get rid of the king. A carefully guarded secret works to their advantage: Louis XIV has a twin brother who was taken away right after he was born so as not to endanger the succession. He does not know about his true identity and has been kept in a dungeon for the last six years. An iron mask covers his face so no-one will notice how much he looks like the king. The four musketeers conspire to exchange Philippe for Louis to free the people of France from their despotic monarch.
Even if THE MAN IN THE IRON MASK has nothing new to offer this remake is worth watching, especially because of its top notch cast. The "elderly gentlemen" seemed to have fun as musketeers. The women's job in this movie is to look pretty, but that's just the nature of the story.
Leonardo DiCaprio may be a surprising but nevertheless good choice for the part of Louis XIV. He masters two very different parts. His arrogant Louis reminds me of Jaye Davidson as Ra in Roland Emmerich's STARGATE, but maybe that was just the similar hairdo. One thing's for sure: There can only be one. It's either Louis or Philippe, one of them must disappear.
The strangest character in the movie is Gérard Depardieu as Porthos, although if you know the book you can hardly think of a better actor for the part. The aging Porthos lost his peace of mind, thinks about suicide and gets on his friends' nerves. They don't take him seriously, but still they make a saw-cut in a beam in the barn to prevent him from killing himself. Why Porthos has to be naked when he tries to hang himself remains a mystery. Maybe because Depardieu likes to drop his clothes. That doesn't mean that we all would like to see him that way. After seeing him climb out of a bathtub in GERMINAL I decided that I like cave bears better at the museum, but once more I was given this very special treat. So what.
THE MAN IN THE IRON MASK isn't very original, but makes for two hours of pleasant entertainment if you enjoy pretty costumes and don't expect too much.
Homepage: Book and movie reviews http://sites.inka.de/sites/darwin
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


|
Panda3D
|
This is the base class for all three-component vectors and points. More...
Public Types | |
| enum | { num_components = 3, is_int = 0 } |
Public Member Functions | |
| object | __getattr__ (str attr_name) |
| __init__ () | |
| __init__ (const LVecBase2f copy, float z) | |
| __init__ (const LVecBase3f) | |
| __init__ (float fill_value) | |
| __init__ (float x, float y, float z) | |
| object | __ipow__ (float exponent) |
| LVecBase3f | __pow__ (float exponent) |
| object | __reduce__ () |
| str | __repr__ () |
| int | __setattr__ (str attr_name, object assign) |
| int | addHash (int hash) |
| Adds the vector into the running hash. More... | |
| int | addHash (int hash, float threshold) |
| Adds the vector into the running hash. More... | |
| addToCell (int i, float value) | |
| addX (float value) | |
| addY (float value) | |
| addZ (float value) | |
| bool | almostEqual (const LVecBase3f other) |
| Returns true if two vectors are memberwise equal within a default tolerance based on the numeric type. More... | |
| bool | almostEqual (const LVecBase3f other, float threshold) |
| Returns true if two vectors are memberwise equal within a specified tolerance. More... | |
| int | compareTo (const LVecBase3f other) |
| This flavor of compare_to uses a default threshold value based on the numeric type. More... | |
| int | compareTo (const LVecBase3f other, float threshold) |
| Sorts vectors lexicographically, componentwise. More... | |
| componentwiseMult (const LVecBase3f other) | |
| LVecBase3f | cross (const LVecBase3f other) |
| crossInto (const LVecBase3f other) | |
| float | dot (const LVecBase3f other) |
| fill (float fill_value) | |
| Sets each element of the vector to the indicated fill_value. More... | |
| LVecBase3f | fmax (const LVecBase3f other) |
| LVecBase3f | fmin (const LVecBase3f other) |
| generateHash (ChecksumHashGenerator hashgen) | |
| Adds the vector to the indicated hash generator. More... | |
| generateHash (ChecksumHashGenerator hashgen, float threshold) | |
| Adds the vector to the indicated hash generator. More... | |
| float | getCell (int i) |
| getData () | |
| Returns the address of the first of the three data elements in the vector. More... | |
| int | getHash () |
| Returns a suitable hash for phash_map. More... | |
| int | getHash (float threshold) |
| Returns a suitable hash for phash_map. More... | |
| LVecBase3f | getStandardizedHpr () |
| Try to un-spin the hpr to a standard form. More... | |
| float | getX () |
| LVecBase2f | getXy () |
| Returns a 2-component vector that shares just the first two components of this vector. More... | |
| LVecBase2f | getXz () |
| Returns a 2-component vector that shares just the first and last components of this vector. More... | |
| float | getY () |
| LVecBase2f | getYz () |
| Returns a 2-component vector that shares just the last two components of this vector. More... | |
| float | getZ () |
| bool | isNan () |
| Returns true if any component of the vector is not-a-number, false otherwise. More... | |
| float | length () |
| Returns the length of the vector, by the Pythagorean theorem. More... | |
| float | lengthSquared () |
| Returns the square of the vector's length, cheap and easy. More... | |
| bool | normalize () |
| Normalizes the vector in place. More... | |
| LVecBase3f | normalized () |
| Normalizes the vector and returns the normalized vector as a copy. More... | |
| operator new (int size) | |
| bool | operator!= (const LVecBase3f other) |
| LVecBase3f | operator* (float scalar) |
| LVecBase3f | operator*= (float scalar) |
| LVecBase3f | operator+ (const LVecBase3f other) |
| LVecBase3f | operator+= (const LVecBase3f other) |
| LVecBase3f | operator- () |
| LVecBase3f | operator- (const LVecBase3f other) |
| LVecBase3f | operator-= (const LVecBase3f other) |
| LVecBase3f | operator/ (float scalar) |
| LVecBase3f | operator/= (float scalar) |
| bool | operator< (const LVecBase3f other) |
| LVecBase3f | operator= (const LVecBase3f copy) |
| LVecBase3f | operator= (float fill_value) |
| bool | operator== (const LVecBase3f other) |
| float | operator[] (int i) |
| operator[] (int i, float assign_val) | |
| output (Ostream out) | |
| LVecBase3f | project (const LVecBase3f onto) |
| Returns a new vector representing the projection of this vector onto another one. More... | |
| readDatagram (DatagramIterator source) | |
| Reads the vector from the Datagram using get_stdfloat(). More... | |
| readDatagramFixed (DatagramIterator source) | |
| Reads the vector from the Datagram using get_float32() or get_float64(). More... | |
| set (float x, float y, float z) | |
| setCell (int i, float value) | |
| setX (float value) | |
| setY (float value) | |
| setZ (float value) | |
| writeDatagram (Datagram destination) | |
| Writes the vector to the Datagram using add_stdfloat(). More... | |
| writeDatagramFixed (Datagram destination) | |
| Writes the vector to the Datagram using add_float32() or add_float64(), depending on the type of floats in the vector, regardless of the setting of Datagram::set_stdfloat_double(). More... | |
Static Public Member Functions | |
| static TypeHandle | getClassType () |
| static int | getNumComponents () |
| static int | size () |
| static const LVecBase3f | unitX () |
| Returns a unit X vector. More... | |
| static const LVecBase3f | unitY () |
| Returns a unit Y vector. More... | |
| static const LVecBase3f | unitZ () |
| Returns a unit Z vector. More... | |
| static const LVecBase3f | zero () |
| Returns a zero-length vector. More... | |
Public Attributes | |
| float | x |
| LVecBase2f | xy |
| Returns a 2-component vector that shares just the first two components of this vector. More... | |
| LVecBase2f | xz |
| Returns a 2-component vector that shares just the first and last components of this vector. More... | |
| float | y |
| LVecBase2f | yz |
| Returns a 2-component vector that shares just the last two components of this vector. More... | |
| float | z |
This is the base class for all three-component vectors and points.
| object __getattr__ | ( | str | attr_name | ) |
| __init__ | ( | ) |
| __init__ | ( | const LVecBase2f | copy, |
| float | z | ||
| ) |
| __init__ | ( | const | LVecBase3f | ) |
| __init__ | ( | float | fill_value | ) |
| __init__ | ( | float | x, |
| float | y, | ||
| float | z | ||
| ) |
| object __ipow__ | ( | float | exponent | ) |
| LVecBase3f __pow__ | ( | float | exponent | ) |
| object __reduce__ | ( | ) |
| str __repr__ | ( | ) |
| int __setattr__ | ( | str | attr_name, |
| object | assign | ||
| ) |
| int addHash | ( | int | hash | ) |
Adds the vector into the running hash.
| int addHash | ( | int | hash, |
| float | threshold | ||
| ) |
Adds the vector into the running hash.
| addToCell | ( | int | i, |
| float | value | ||
| ) |
| addX | ( | float | value | ) |
| addY | ( | float | value | ) |
| addZ | ( | float | value | ) |
| bool almostEqual | ( | const LVecBase3f | other | ) |
Returns true if two vectors are memberwise equal within a default tolerance based on the numeric type.
| bool almostEqual | ( | const LVecBase3f | other, |
| float | threshold | ||
| ) |
Returns true if two vectors are memberwise equal within a specified tolerance.
| int compareTo | ( | const LVecBase3f | other | ) |
This flavor of compare_to uses a default threshold value based on the numeric type.
| int compareTo | ( | const LVecBase3f | other, |
| float | threshold | ||
| ) |
Sorts vectors lexicographically, componentwise.
Returns a number less than 0 if this vector sorts before the other one, greater than zero if it sorts after, 0 if they are equivalent (within the indicated tolerance).
| componentwiseMult | ( | const LVecBase3f | other | ) |
| LVecBase3f cross | ( | const LVecBase3f | other | ) |
| crossInto | ( | const LVecBase3f | other | ) |
| float dot | ( | const LVecBase3f | other | ) |
| fill | ( | float | fill_value | ) |
Sets each element of the vector to the indicated fill_value.
This is particularly useful for initializing to zero.
| LVecBase3f fmax | ( | const LVecBase3f | other | ) |
| LVecBase3f fmin | ( | const LVecBase3f | other | ) |
| generateHash | ( | ChecksumHashGenerator | hashgen | ) |
Adds the vector to the indicated hash generator.
| generateHash | ( | ChecksumHashGenerator | hashgen, |
| float | threshold | ||
| ) |
Adds the vector to the indicated hash generator.
| float getCell | ( | int | i | ) |
|
static |
| getData | ( | ) |
Returns the address of the first of the three data elements in the vector.
The remaining elements occupy the next positions consecutively in memory.
| int getHash | ( | ) |
Returns a suitable hash for phash_map.
| int getHash | ( | float | threshold | ) |
Returns a suitable hash for phash_map.
|
static |
| LVecBase3f getStandardizedHpr | ( | ) |
Try to un-spin the hpr to a standard form.
Like all standards, someone decides between many arbitrary possible standards. This function assumes that 0 and 360 are the same, as is 720 and -360. Also 180 and -180 are the same. Another example is -90 and 270. Each element will be in the range -180.0 to 179.99999. The original usage of this function is for human readable output.
It doesn't work so well for asserting that foo_hpr is roughly equal to bar_hpr. Try using LQuaternionf::is_same_direction() for that. See Also: get_standardized_rotation, LQuaternion::is_same_direction
| float getX | ( | ) |
| LVecBase2f getXy | ( | ) |
Returns a 2-component vector that shares just the first two components of this vector.
| LVecBase2f getXz | ( | ) |
Returns a 2-component vector that shares just the first and last components of this vector.
| float getY | ( | ) |
| LVecBase2f getYz | ( | ) |
Returns a 2-component vector that shares just the last two components of this vector.
| float getZ | ( | ) |
| bool isNan | ( | ) |
Returns true if any component of the vector is not-a-number, false otherwise.
| float length | ( | ) |
Returns the length of the vector, by the Pythagorean theorem.
| float lengthSquared | ( | ) |
Returns the square of the vector's length, cheap and easy.
| bool normalize | ( | ) |
Normalizes the vector in place.
Returns true if the vector was normalized, false if it was a zero-length vector.
| LVecBase3f normalized | ( | ) |
Normalizes the vector and returns the normalized vector as a copy.
If the vector was a zero-length vector, a zero length vector will be returned.
| operator new | ( | int | size | ) |
| bool operator!= | ( | const LVecBase3f | other | ) |
| LVecBase3f operator* | ( | float | scalar | ) |
| LVecBase3f operator*= | ( | float | scalar | ) |
| LVecBase3f operator+ | ( | const LVecBase3f | other | ) |
| LVecBase3f operator+= | ( | const LVecBase3f | other | ) |
| LVecBase3f operator- | ( | ) |
| LVecBase3f operator- | ( | const LVecBase3f | other | ) |
| LVecBase3f operator-= | ( | const LVecBase3f | other | ) |
| LVecBase3f operator/ | ( | float | scalar | ) |
| LVecBase3f operator/= | ( | float | scalar | ) |
| bool operator< | ( | const LVecBase3f | other | ) |
| LVecBase3f operator= | ( | const LVecBase3f | copy | ) |
| LVecBase3f operator= | ( | float | fill_value | ) |
| bool operator== | ( | const LVecBase3f | other | ) |
| float operator[] | ( | int | i | ) |
| operator[] | ( | int | i, |
| float | assign_val | ||
| ) |
| output | ( | Ostream | out | ) |
| LVecBase3f project | ( | const LVecBase3f | onto | ) |
Returns a new vector representing the projection of this vector onto another one.
The resulting vector will be a scalar multiple of onto.
| readDatagram | ( | DatagramIterator | source | ) |
Reads the vector from the Datagram using get_stdfloat().
| readDatagramFixed | ( | DatagramIterator | source | ) |
Reads the vector from the Datagram using get_float32() or get_float64().
See write_datagram_fixed().
| set | ( | float | x, |
| float | y, | ||
| float | z | ||
| ) |
| setCell | ( | int | i, |
| float | value | ||
| ) |
| setX | ( | float | value | ) |
| setY | ( | float | value | ) |
| setZ | ( | float | value | ) |
|
static |
|
static |
Returns a unit X vector.
|
static |
Returns a unit Y vector.
|
static |
Returns a unit Z vector.
| writeDatagram | ( | Datagram | destination | ) |
Writes the vector to the Datagram using add_stdfloat().
This is appropriate when you want to write the vector using the standard width setting, especially when you are writing a bam file.
| writeDatagramFixed | ( | Datagram | destination | ) |
Writes the vector to the Datagram using add_float32() or add_float64(), depending on the type of floats in the vector, regardless of the setting of Datagram::set_stdfloat_double().
This is appropriate when you want to write a fixed-width value to the datagram, especially when you are not writing a bam file.
|
static |
Returns a zero-length vector.
| float x |
| LVecBase2f xy |
Returns a 2-component vector that shares just the first two components of this vector.
| LVecBase2f xz |
Returns a 2-component vector that shares just the first and last components of this vector.
| float y |
| LVecBase2f yz |
Returns a 2-component vector that shares just the last two components of this vector.
| float z |


Radius
21
Up
Down
Intensity
200
Up
Down
Opacity
.6
Up
Down
Region
Select
Clear
Mode
Claim ID
Loss
Premium
Loss Ratio


Many good tutorials online and excellent textbook
#include <omp.h>
#pragma omp...
#pragma omp construct [ clause ...]
#include <omp.h>
OpenMP supports several different ways to specify thread parallelism
#include <omp.h>
main ()
{
int var1, var2, var3;
/* serial code */
/* ... */
/* start of a parallel region */
#pragma omp parallel private(var1, var2) shared(var3)
{
/* ... */
}
/* more serial code */
/* ... */
/* another parallel region */
#pragma omp parallel
{
/* ... */
}
}
#pragma omp parallel { ... }
#include <omp.h>
#include <cstdio>
int main (int argc, char *argv[])
{
int th_id, nthreads;
#pragma omp parallel private(th_id) shared(nthreads)
{
th_id = omp_get_thread_num();
printf("Hello World from thread %d\n", th_id);
#pragma omp barrier
if ( th_id == 0 ) {
nthreads = omp_get_num_threads();
printf("There are %d threads\n",nthreads);
}
}
return 0;
}
#include <cstdio>
#include <omp.h>
int main(int argc, char *argv[])
{
omp_set_num_threads(4);
#pragma omp parallel
{
int id = omp_get_thread_num();
int nproc = omp_get_num_threads();
cout << "Hello world with id number and processes " << id << nproc << endl;
}
return 0;
}
Variables declared outside of the parallel region are shared by all threads If a variable like id is declared outside of the
#pragma omp parallel,
it would have been shared by various the threads, possibly causing erroneous output
Private clause can be used to make thread- private versions of such variables:
#pragma omp parallel private(id)
{
int id = omp_get_thread_num();
cout << "My thread num" << id << endl;
}
It is often useful to have only one thread execute some of the code in a parallel region. I/O statements are a common example
#pragma omp parallel
{
#pragma omp master
{
int id = omp_get_thread_num();
cout << "My thread num" << id << endl;
}
}
#pragma omp for
OpenMP provides an easy way to parallelize a loop
#pragma omp parallel for
for (i=0; i<n; i++) c[i] = a[i];
OpenMP handles index variable (no need to declare in for loop or make private)
Which thread does which values? Several options.
We can let the OpenMP runtime decide. The decision is about how the loop iterates are scheduled and OpenMP defines three choices of loop scheduling:
#include <omp.h>
#define CHUNKSIZE 100
#define N 1000
int main (int argc, char *argv[])
{
int i, chunk;
float a[N], b[N], c[N];
for (i=0; i < N; i++) a[i] = b[i] = i * 1.0;
chunk = CHUNKSIZE;
#pragma omp parallel shared(a,b,c,chunk) private(i)
{
#pragma omp for schedule(dynamic,chunk)
for (i=0; i < N; i++) c[i] = a[i] + b[i];
} /* end of parallel region */
}
#include <omp.h>
#define CHUNKSIZE 100
#define N 1000
int main (int argc, char *argv[])
{
int i, chunk;
float a[N], b[N], c[N];
for (i=0; i < N; i++) a[i] = b[i] = i * 1.0;
chunk = CHUNKSIZE;
#pragma omp parallel shared(a,b,c,chunk) private(i)
{
#pragma omp for schedule(guided,chunk)
for (i=0; i < N; i++) c[i] = a[i] + b[i];
} /* end of parallel region */
}
// #pragma omp parallel and #pragma omp for
can be combined into
#pragma omp parallel for
What happens with code like this
#pragma omp parallel for
for (i=0; i<n; i++) sum += a[i]*a[i];
All threads can access the sum variable, but the addition is not atomic! It is important to avoid race between threads. So-called reductions in OpenMP are thus important for performance and for obtaining correct results. OpenMP lets us indicate that a variable is used for a reduction with a particular operator. The above code becomes
sum = 0.0;
#pragma omp parallel for reduction(+:sum)
for (i=0; i<n; i++) sum += a[i]*a[i];
$$ \sum_{i=0}^{n-1} a_ib_i $$
int i;
double sum = 0.;
/* allocating and initializing arrays */
/* ... */
#pragma omp parallel for default(shared) private(i) reduction(+:sum)
for (i=0; i<N; i++) sum += a[i]*b[i];
}
Different threads do different tasks independently, each section is executed by one thread.
#pragma omp parallel
{
#pragma omp sections
{
#pragma omp section
funcA ();
#pragma omp section
funcB ();
#pragma omp section
funcC ();
}
}
#pragma omp single { ... }
The code is executed by one thread only, no guarantee which thread
Can introduce an implicit barrier at the end
#pragma omp master { ... }
Code executed by the master thread, guaranteed and no implicit barrier at the end.
#pragma omp barrier
Synchronization, must be encountered by all threads in a team (or none)
#pragma omp ordered { a block of codes }
is another form of synchronization (in sequential order). The form
#pragma omp critical { a block of codes }
and
#pragma omp atomic { single assignment statement }
is more efficient than
#pragma omp critical
What are the purposes of these attributes
for (i=0; i<100; i++)
for (j=0; j<100; j++)
a[i][j] = b[i][j] + c[i][j];
}
}
#pragma omp parallel for private(j)
for (i=0; i<100; i++)
for (j=0; j<100; j++)
a[i][j] = b[i][j] + c[i][j];
}
}
When a thread in a parallel region encounters another parallel construct, it may create a new team of threads and become the master of the new team.
#pragma omp parallel num_threads(4)
{
/* .... */
#pragma omp parallel num_threads(2)
{
//
}
}
#pragma omp task
#pragma omp parallel shared(p_vec) private(i)
{
#pragma omp single
{
for (i=0; i<N; i++) {
double r = random_number();
if (p_vec[i] > r) {
#pragma omp task
do_work (p_vec[i]);
Race condition
int nthreads;
#pragma omp parallel shared(nthreads)
{
nthreads = omp_get_num_threads();
}
Deadlock
#pragma omp parallel
{
...
#pragma omp critical
{
...
#pragma omp barrier
}
}
Not all computations are simple loops where the data can be evenly divided among threads without any dependencies between threads
An example is finding the location and value of the largest element in an array
for (i=0; i<n; i++) {
if (x[i] > maxval) {
maxval = x[i];
maxloc = i;
}
}
All threads are potentially accessing and changing the same values, maxloc and maxval.
#pragma omp atomic
#pragma omp critical
Atomic may be faster than critical but depends on hardware
Write down the simplest algorithm and look carefully for race conditions. How would you handle them? The first step would be to parallelize as
#pragma omp parallel for
for (i=0; i<n; i++) {
if (x[i] > maxval) {
maxval = x[i];
maxloc = i;
}
}
Write down the simplest algorithm and look carefully for race conditions. How would you handle them? The first step would be to parallelize as
#pragma omp parallel for
for (i=0; i<n; i++) {
#pragma omp critical
{
if (x[i] > maxval) {
maxval = x[i];
maxloc = i;
}
}
}
Exercise: write a code which implements this and give an estimate on performance. Perform several runs, with a serial code only with and without vectorization and compare the serial code with the one that uses OpenMP. Run on different archictectures if you can.
Give it a thought!
Performance poor because we insisted on keeping track of the maxval and location during the execution of the loop.
This is a common source of performance issues, namely the description of the method used to compute a value imposes additional, unnecessary requirements or properties
Idea: Have each thread find the maxloc in its own data, then combine and use temporary arrays indexed by thread number to hold the values found by each thread
int maxloc[MAX_THREADS], mloc;
double maxval[MAX_THREADS], mval;
#pragma omp parallel shared(maxval,maxloc)
{
int id = omp_get_thread_num();
maxval[id] = -1.0e30;
#pragma omp for
for (int i=0; i<n; i++) {
if (x[i] > maxval[id]) {
maxloc[id] = i;
maxval[id] = x[i];
}
}
}
#pragma omp flush (maxloc,maxval)
#pragma omp master
{
int nt = omp_get_num_threads();
mloc = maxloc[0];
mval = maxval[0];
for (int i=1; i<nt; i++) {
if (maxval[i] > mval) {
mval = maxval[i];
mloc = maxloc[i];
}
}
}
Note that we let the master process perform the last operation.
This code computes the norm of a vector using OpenMp
// OpenMP program to compute vector norm by adding two other vectors
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <iomanip>
#include <omp.h>
# include <ctime>
using namespace std; // note use of namespace
int main (int argc, char* argv[])
{
// read in dimension of vector
int n = atoi(argv[1]);
double *a, *b, *c;
int i;
int thread_num;
double wtime, Norm2, s, angle;
cout << " Perform addition of two vectors and compute the norm-2." << endl;
omp_set_num_threads(4);
thread_num = omp_get_max_threads ();
cout << " The number of processors available = " << omp_get_num_procs () << endl ;
cout << " The number of threads available = " << thread_num << endl;
cout << " The matrix order n = " << n << endl;
s = 1.0/sqrt( (double) n);
wtime = omp_get_wtime ( );
// Allocate space for the vectors to be used
a = new double [n]; b = new double [n]; c = new double [n];
// Define parallel region
# pragma omp parallel for default(shared) private (angle, i) reduction(+:Norm2)
// Set up values for vectors a and b
for (i = 0; i < n; i++){
angle = 2.0*M_PI*i/ (( double ) n);
a[i] = s*(sin(angle) + cos(angle));
b[i] = s*sin(2.0*angle);
c[i] = 0.0;
}
// Then perform the vector addition
for (i = 0; i < n; i++){
c[i] += a[i]+b[i];
}
// Compute now the norm-2
Norm2 = 0.0;
for (i = 0; i < n; i++){
Norm2 += c[i]*c[i];
}
// end parallel region
wtime = omp_get_wtime ( ) - wtime;
cout << setiosflags(ios::showpoint | ios::uppercase);
cout << setprecision(10) << setw(20) << "Time used for norm-2 computation=" << wtime << endl;
cout << " Norm-2 = " << Norm2 << endl;
// Free up space
delete[] a;
delete[] b;
delete[] c;
return 0;
}
This the matrix-matrix multiplication code with plain c++ memory allocation using OpenMP
// Matrix-matrix multiplication and Frobenius norm of a matrix with OpenMP
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <iomanip>
#include <omp.h>
# include <ctime>
using namespace std; // note use of namespace
int main (int argc, char* argv[])
{
// read in dimension of square matrix
int n = atoi(argv[1]);
double **A, **B, **C;
int i, j, k;
int thread_num;
double wtime, Fsum, s, angle;
cout << " Compute matrix product C = A * B and Frobenius norm." << endl;
omp_set_num_threads(4);
thread_num = omp_get_max_threads ();
cout << " The number of processors available = " << omp_get_num_procs () << endl ;
cout << " The number of threads available = " << thread_num << endl;
cout << " The matrix order n = " << n << endl;
s = 1.0/sqrt( (double) n);
wtime = omp_get_wtime ( );
// Allocate space for the two matrices
A = new double*[n]; B = new double*[n]; C = new double*[n];
for (i = 0; i < n; i++){
A[i] = new double[n];
B[i] = new double[n];
C[i] = new double[n];
}
// Define parallel region
# pragma omp parallel for default(shared) private (angle, i, j, k) reduction(+:Fsum)
// Set up values for matrix A and B and zero matrix C
for (i = 0; i < n; i++){
for (j = 0; j < n; j++) {
angle = 2.0*M_PI*i*j/ (( double ) n);
A[i][j] = s * ( sin ( angle ) + cos ( angle ) );
B[j][i] = A[i][j];
}
}
// Then perform the matrix-matrix multiplication
for (i = 0; i < n; i++){
for (j = 0; j < n; j++) {
C[i][j] = 0.0;
for (k = 0; k < n; k++) {
C[i][j] += A[i][k]*B[k][j];
}
}
}
// Compute now the Frobenius norm
Fsum = 0.0;
for (i = 0; i < n; i++){
for (j = 0; j < n; j++) {
Fsum += C[i][j]*C[i][j];
}
}
Fsum = sqrt(Fsum);
// end parallel region and letting only one thread perform I/O
wtime = omp_get_wtime ( ) - wtime;
cout << setiosflags(ios::showpoint | ios::uppercase);
cout << setprecision(10) << setw(20) << "Time used for matrix-matrix multiplication=" << wtime << endl;
cout << " Frobenius norm = " << Fsum << endl;
// Free up space
for (int i = 0; i < n; i++){
delete[] A[i];
delete[] B[i];
delete[] C[i];
}
delete[] A;
delete[] B;
delete[] C;
return 0;
}


Research
RESEARCH MAIN PAGE
Find
Books & Media
Journals
|
Tutorial
Subject Databases
|
Tutorial
ArticlesPlus
|
Tutorial
Classic Catalog
(
retiring July 2018
)
Research Guides
Subjects:
Art
|
Psychology
|
More...
Topics:
Industry
|
Grants
|
More...
Tools:
RefWorks
|
Citation Styles
|
More...
How Do I? (Tutorials)
Get Help
Ask A Librarian
Research Consultation
Research Staff
How Do I? (Tutorials)
Collections
COLLECTIONS MAIN PAGE
Special Collections Research Center
Global Resources Center
Art & Design Collection from the Corcoran
Teamsters Labor History Research Center
University Archives
Kiev Judaica Collection
Media
Collection Development Librarians
(more...)


z-transformation is an ubiquitous operation in data analysis. It is often quite practical.
Example: Assume Dr Zack scored 42 points on a test (say, IQ). Average score is 40 in the relevant population, and SD is 1, let’s say. So Zack’s score is 2 points above average. 2 points equals to SDs in this example. We can thus safely infer that Zack is about 2 SDs above average (leaving measurement precision and other issues at side).
If the variable (IQ) is normally distributed, than we are allowed to look up the percentiles of this z-value in a table. Or ask the computer (in R):
pnorm(2)
## [1] 0.9772499
Here, R tells us that approx. 98% of all individuals have an IQ that is smaller than that of Dr. Zack. Lucky guy! Compare the figure.
Here an overview on some frequently used quantiles of the normal distribution:
Now, next step. We have a bunch of guys, and test each of them. Say, 10 guys. Now we can calculate mean and SD of this distribution. To see the differences more clearly, we can z-transform the values.
IQ <- rnorm(10, mean = 40, sd = 1)
IQ
## [1] 40.91472 38.53260 40.30042 40.87957 40.99679 39.86815 40.14272
## [8] 39.26335 40.19174 39.85837
IQ_z <- scale(IQ)
IQ_z
## [,1]
## [1,] 1.05897590
## [2,] -2.01783361
## [3,] 0.26552871
## [4,] 1.01356631
## [5,] 1.16497561
## [6,] -0.29280567
## [7,] 0.06183789
## [8,] -1.07397171
## [9,] 0.12515803
## [10,] -0.30543146
## attr(,"scaled:center")
## [1] 40.09484
## attr(,"scaled:scale")
## [1] 0.7742196
Ok. Let’s compute mean and sd of the z-scaled values:
mean(IQ_z)
## [1] -4.605338e-15
sd(IQ_z)
## [1] 1
So it worked apparently.
But why is it that mean and sd will end up nicely with 0 (mean) and 1 (sd)?
To see this, consider the following. A z-transformation is in step 1 nothing more than subtracting the mean of some value. If I subtract the mean (42 here) from each value, and compute the mean then, I will not be surprised that the mean is now 42 points lower than it was. But 42-42=0. So the new mean (after z-transformation) will be 0.
Ok, but what about sd? Why must it equal 1? A similar reasoning applies. If I divide each value by the SD of the distribution (here 1), the new SD will be exactly by this factor lower. So whatever it used to be before z-transformtion, it will be 1 afterwards, as x / x = 1.


{% extends 'base.html' %} {% block content %}
{{ _('The goal of this project is to demonstrate the capabilities of convolutional neural networks in solving the problem of pattern recognition.') }}
{{ _('The convolutional neural network is a special architecture of artificial neural networks, proposed by Yan LeCun in 1988 and aimed at effective pattern recognition, is part of the technology of deep learning. The idea of convolutional neural networks is the alternation of convolutional layers and pooling layers. The network structure is feedforward, essentially multi-layered. For training such a network, standard methods are used, most often the method of backpropagation. The activation function can be any, according to the choice of the researcher. The network architecture received its name because of the convolution operation, the essence of which is that each image fragment is multiplied by the convolution matrix (kernel) element by element, and the result is summed up and written to the similar position of the output image.') }}
{{ _('Today, convolutional neural networks show the best results in various competitions related to the pattern recognition problem, which was the main reason for choosing this type of neural network for implementation in the project.') }}
{{ _('To get started, click on the button below and upload the image for recognition. At the moment, the neural network can recognize such objects on images: PLANE, CAR, BIRD, CAT, DEER, DOG, FROG, HORSE, SHIP, TRUCK. After the image is uploaded, you will be redirected to the page with the result of the neural network prediction.') }}


Seed:
Use non-deterministic randomness:
Curve Order:
Value related to piece "size":
Piece segment length:
mm
Jigsaw size:
w
x
h
mm
Generate Jigsaw
Download SVG
Download SVG colored (VERY BROKEN)


| Return type | Name and parameters |
|---|---|
boolean
|
asBoolean()
Coerce a string (an instance of CharSequence) to a boolean value. |
Object
|
asType(Class c)
Provides a method to perform custom 'dynamic' type conversion
to the given class using the |
Pattern
|
bitwiseNegate()
Turns a CharSequence into a regular expression Pattern |
String
|
capitalize()
Convenience method to capitalize the first letter of a CharSequence (typically the first letter of a word). |
String
|
center(Number numberOfChars)
Pad a CharSequence to a minimum length specified by numberOfChars by adding the space character around it as many times as needed so that it remains centered. |
String
|
center(Number numberOfChars, CharSequence padding)
Pad a CharSequence to a minimum length specified by numberOfChars, appending the supplied padding CharSequence around the original as many times as needed keeping it centered. |
boolean
|
contains(CharSequence text)
Provide an implementation of contains() like Collection#contains(Object) to make CharSequences more polymorphic. |
int
|
count(CharSequence text)
Count the number of occurrences of a sub CharSequence. |
String
|
denormalize()
Return a CharSequence with lines (separated by LF, CR/LF, or CR) terminated by the platform specific line separator. |
CharSequence
|
drop(int num)
Drops the given number of chars from the head of this CharSequence if they are available. |
CharSequence
|
dropWhile(Closure condition)
Create a suffix of the given CharSequence by dropping as many characters as possible from the front of the original CharSequence such that calling the given closure condition evaluates to true when passed each of the dropped characters. |
Object
|
eachLine(Closure closure)
Iterates through this CharSequence line by line. |
Object
|
eachLine(int firstLine, Closure closure)
Iterates through this CharSequence line by line. |
Object
|
eachMatch(CharSequence regex, Closure closure)
Process each regex group matched substring of the given CharSequence. |
Object
|
eachMatch(Pattern pattern, Closure closure)
Process each regex group matched substring of the given pattern. |
String
|
expand()
Expands all tabs into spaces with tabStops of size 8. |
String
|
expand(int tabStop)
Expands all tabs into spaces. |
String
|
expandLine(int tabStop)
Expands all tabs into spaces. |
String
|
find(CharSequence regex)
Finds the first occurrence of a regular expression String within a String. |
String
|
find(CharSequence regex, Closure closure)
Returns the result of calling a closure with the first occurrence of a regular expression found within a CharSequence. |
String
|
find(Pattern pattern)
Finds the first occurrence of a compiled regular expression Pattern within a String. |
String
|
find(Pattern pattern, Closure closure)
Returns the result of calling a closure with the first occurrence of a compiled regular expression found within a String. |
List
|
findAll(CharSequence regex)
Returns a (possibly empty) list of all occurrences of a regular expression (provided as a CharSequence) found within a CharSequence. |
List
|
findAll(CharSequence regex, Closure closure)
Finds all occurrences of a regular expression string within a CharSequence. |
List
|
findAll(Pattern pattern)
Returns a (possibly empty) list of all occurrences of a regular expression (in Pattern format) found within a CharSequence. |
List
|
findAll(Pattern pattern, Closure closure)
Finds all occurrences of a compiled regular expression Pattern within a CharSequence. |
String
|
getAt(EmptyRange range)
Support the range subscript operator for CharSequence or StringBuffer with EmptyRange |
CharSequence
|
getAt(IntRange range)
Support the range subscript operator for CharSequence with IntRange |
CharSequence
|
getAt(Range range)
Support the range subscript operator for CharSequence |
CharSequence
|
getAt(int index)
Support the subscript operator for CharSequence. |
String
|
getAt(Collection indices)
Select a List of characters from a CharSequence using a Collection to identify the indices to be selected. |
char[]
|
getChars()
Converts the given CharSequence into an array of characters. |
boolean
|
isAllWhitespace()
True if a CharSequence only contains whitespace characters. |
boolean
|
isBigDecimal()
Determine if a CharSequence can be parsed as a BigDecimal. |
boolean
|
isBigInteger()
Determine if a CharSequence can be parsed as a BigInteger. |
boolean
|
isCase(Object switchValue)
'Case' implementation for a CharSequence, which uses equals between the toString() of the caseValue and the switchValue. |
boolean
|
isDouble()
Determine if a CharSequence can be parsed as a Double. |
boolean
|
isFloat()
Determine if a CharSequence can be parsed as a Float. |
boolean
|
isInteger()
Determine if a CharSequence can be parsed as an Integer. |
boolean
|
isLong()
Determine if a CharSequence can be parsed as a Long. |
boolean
|
isNumber()
Determine if a CharSequence can be parsed as a Number. |
StringBuilder
|
leftShift(Object value)
Overloads the left shift operator to provide an easy way to append multiple objects as string representations to a CharSequence. |
boolean
|
matches(Pattern pattern)
Tells whether or not a CharSequence matches the given compiled regular expression Pattern. |
String
|
minus(Object target)
Remove a part of a CharSequence by replacing the first occurrence of target within self with '' and returns the result. |
String
|
minus(Pattern pattern)
Remove a part of a CharSequence. |
String
|
multiply(Number factor)
Repeat a CharSequence a certain number of times. |
String
|
next()
This method is called by the ++ operator for the class CharSequence. |
String
|
normalize()
Return a String with linefeeds and carriage returns normalized to linefeeds. |
String
|
padLeft(Number numberOfChars)
Pad a CharSequence to a minimum length specified by numberOfChars by adding the space character to the left as many times as needed. |
String
|
padLeft(Number numberOfChars, CharSequence padding)
Pad a CharSequence to a minimum length specified by numberOfChars, adding the supplied padding CharSequence as many times as needed to the left. |
String
|
padRight(Number numberOfChars)
Pad a CharSequence to a minimum length specified by numberOfChars by adding the space character to the right as many times as needed. |
String
|
padRight(Number numberOfChars, CharSequence padding)
Pad a CharSequence to a minimum length specified by numberOfChars, adding the supplied padding CharSequence as many times as needed to the right. |
String
|
plus(Object value)
Appends the String representation of the given operand to this CharSequence. |
String
|
previous()
This method is called by the -- operator for the class CharSequence. |
List
|
readLines()
Return the lines of a CharSequence as a List of String. |
String
|
replaceAll(CharSequence regex, Closure closure)
Replaces all occurrences of a captured group by the result of a closure on that text. |
String
|
replaceAll(CharSequence regex, CharSequence replacement)
Replaces each substring of this CharSequence that matches the given regular expression with the given replacement. |
String
|
replaceAll(Pattern pattern, Closure closure)
Replaces all occurrences of a captured group by the result of a closure call on that text. |
String
|
replaceAll(Pattern pattern, CharSequence replacement)
Replaces all substrings of a CharSequence that match the given compiled regular expression with the given replacement. |
String
|
replaceFirst(CharSequence regex, Closure closure)
Replaces the first occurrence of a captured group by the result of a closure call on that text. |
String
|
replaceFirst(CharSequence regex, CharSequence replacement)
Replaces the first substring of this CharSequence that matches the given regular expression with the given replacement. |
String
|
replaceFirst(Pattern pattern, Closure closure)
Replaces the first occurrence of a captured group by the result of a closure call on that text. |
String
|
replaceFirst(Pattern pattern, CharSequence replacement)
Replaces the first substring of a CharSequence that matches the given compiled regular expression with the given replacement. |
String
|
reverse()
Creates a String which is the reverse (backwards) of this CharSequence |
int
|
size()
Provide the standard Groovy size() method for CharSequence .
|
String[]
|
split()
Convenience method to split a CharSequence (with whitespace as delimiter). |
Object
|
splitEachLine(CharSequence regex, Closure closure)
Iterates through the given CharSequence line by line, splitting each line using the given regex delimiter. |
Object
|
splitEachLine(Pattern pattern, Closure closure)
Iterates through the given CharSequence line by line, splitting each line using the given separator Pattern. |
String
|
stripIndent()
Strip leading spaces from every line in a CharSequence. |
String
|
stripIndent(int numChars)
Strip numChar leading characters from every line in a CharSequence. |
String
|
stripMargin()
Strip leading whitespace/control characters followed by '|' from every line in a CharSequence. |
String
|
stripMargin(char marginChar)
Strip leading whitespace/control characters followed by marginChar from every line in a CharSequence. |
String
|
stripMargin(CharSequence marginChar)
Strip leading whitespace/control characters followed by marginChar from every line in a CharSequence. |
CharSequence
|
take(int num)
Returns the first num elements from this CharSequence.
|
CharSequence
|
takeWhile(Closure condition)
Returns the longest prefix of this CharSequence where each element passed to the given closure evaluates to true. |
BigDecimal
|
toBigDecimal()
Parse a CharSequence into a BigDecimal |
BigInteger
|
toBigInteger()
Parse a CharSequence into a BigInteger |
Double
|
toDouble()
Parse a CharSequence into a Double |
Float
|
toFloat()
Parse a CharSequence into a Float |
Integer
|
toInteger()
Parse a CharSequence into an Integer |
List
|
toList()
Converts the given CharSequence into a List of Strings of one character. |
Long
|
toLong()
Parse a CharSequence into a Long |
Set
|
toSet()
Converts the given CharSequence into a Set of unique String of one character. |
Short
|
toShort()
Parse a CharSequence into a Short |
URI
|
toURI()
Transforms a CharSequence representing a URI into a URI object. |
URL
|
toURL()
Transforms a CharSequence representing a URL into a URL object. |
List
|
tokenize()
Tokenize a CharSequence (with a whitespace as the delimiter). |
List
|
tokenize(CharSequence token)
Tokenize a CharSequence based on the given CharSequence delimiter. |
List
|
tokenize(Character token)
Tokenize a CharSequence based on the given character delimiter. |
String
|
tr(CharSequence sourceSet, CharSequence replacementSet)
Translates a CharSequence by replacing characters from the sourceSet with characters from replacementSet. |
String
|
unexpand()
Replaces sequences of whitespaces with tabs using tabStops of size 8. |
String
|
unexpand(int tabStop)
Replaces sequences of whitespaces with tabs. |
String
|
unexpandLine(int tabStop)
Replaces sequences of whitespaces with tabs within a line. |
Coerce a string (an instance of CharSequence) to a boolean value. A string is coerced to false if it is of length 0, and to true otherwise.
Provides a method to perform custom 'dynamic' type conversion
to the given class using the as
operator.
c
- the desired classTurns a CharSequence into a regular expression Pattern
Convenience method to capitalize the first letter of a CharSequence (typically the first letter of a word). Example usage:
assert 'h'.capitalize() == 'H' assert 'hello'.capitalize() == 'Hello' assert 'hello world'.capitalize() == 'Hello world' assert 'Hello World' == 'hello world'.split(' ').collect{ it.capitalize() }.join(' ')
Pad a CharSequence to a minimum length specified by numberOfChars by adding the space character around it as many times as needed so that it remains centered. If the String is already the same size or bigger than the target numberOfChars, then the original String is returned. An example:
['A', 'BB', 'CCC', 'DDDD'].each{ println '|' + it.center(6) + '|' }will produce output like:
| A | | BB | | CCC | | DDDD |
numberOfChars
- the total minimum number of characters of the resultPad a CharSequence to a minimum length specified by numberOfChars, appending the supplied padding CharSequence around the original as many times as needed keeping it centered. If the String is already the same size or bigger than the target numberOfChars, then the original String is returned. An example:
['A', 'BB', 'CCC', 'DDDD'].each{ println '|' + it.center(6, '+') + '|' }will produce output like:
|++A+++| |++BB++| |+CCC++| |+DDDD+|
numberOfChars
- the total minimum number of characters of the resulting CharSequencepadding
- the characters used for paddingProvide an implementation of contains() like Collection#contains(Object) to make CharSequences more polymorphic.
text
- the CharSequence to look forCount the number of occurrences of a sub CharSequence.
text
- a sub CharSequenceReturn a CharSequence with lines (separated by LF, CR/LF, or CR) terminated by the platform specific line separator.
Drops the given number of chars from the head of this CharSequence if they are available.
def text = "Groovy" assert text.drop( 0 ) == 'Groovy' assert text.drop( 2 ) == 'oovy' assert text.drop( 7 ) == ''
num
- the number of characters to drop from this iteratornum
ones,
or else an empty String, if this CharSequence has less than num
characters.Create a suffix of the given CharSequence by dropping as many characters as possible from the front of the original CharSequence such that calling the given closure condition evaluates to true when passed each of the dropped characters.
def text = "Groovy" assert text.dropWhile{ false } == 'Groovy' assert text.dropWhile{ true } == '' assert text.dropWhile{ it < 'Z' } == 'roovy' assert text.dropWhile{ it != 'v' } == 'vy'
condition
- the closure that while continuously evaluating to true will cause us to drop elements from
the front of the original CharSequenceIterates through this CharSequence line by line. Each line is passed to the given 1 or 2 arg closure. If a 2 arg closure is found the line count is passed as the second argument.
closure
- a closureIterates through this CharSequence line by line. Each line is passed to the given 1 or 2 arg closure. If a 2 arg closure is found the line count is passed as the second argument.
firstLine
- the line number value used for the first line (default is 1, set to 0 to start counting from 0)closure
- a closure (arg 1 is line, optional arg 2 is line number)Process each regex group matched substring of the given CharSequence. If the closure parameter takes one argument, an array with all match groups is passed to it. If the closure takes as many arguments as there are match groups, then each parameter will be one match group.
regex
- a Regex CharSequenceclosure
- a closure with one parameter or as much parameters as groupsProcess each regex group matched substring of the given pattern. If the closure parameter takes one argument, an array with all match groups is passed to it. If the closure takes as many arguments as there are match groups, then each parameter will be one match group.
pattern
- a regex Patternclosure
- a closure with one parameter or as much parameters as groupsExpands all tabs into spaces with tabStops of size 8.
Expands all tabs into spaces. If the CharSequence has multiple lines, expand each line - restarting tab stops at the start of each line.
tabStop
- The number of spaces a tab representsExpands all tabs into spaces. Assumes the CharSequence represents a single line of text.
tabStop
- The number of spaces a tab representsFinds the first occurrence of a regular expression String within a String. If the regex doesn't match, null will be returned.
For example, if the regex doesn't match the result is null:
assert null == "New York, NY".find(/\d{5}/)If it does match, we get the matching string back:
assert "10292" == "New York, NY 10292-0098".find(/\d{5}/)If we have capture groups in our expression, we still get back the full match
assert "10292-0098" == "New York, NY 10292-0098".find(/(\d{5})-?(\d{4})/)
regex
- the capturing regexReturns the result of calling a closure with the first occurrence of a regular expression found within a CharSequence. If the regex doesn't match, the closure will not be called and find will return null.
regex
- the capturing regex CharSequenceclosure
- the closure that will be passed the full match, plus each of the capturing groups (if any)Finds the first occurrence of a compiled regular expression Pattern within a String. If the pattern doesn't match, null will be returned.
For example, if the pattern doesn't match the result is null:
assert null == "New York, NY".find(~/\d{5}/)If it does match, we get the matching string back:
assert "10292" == "New York, NY 10292-0098".find(~/\d{5}/)If we have capture groups in our expression, the groups are ignored and we get back the full match:
assert "10292-0098" == "New York, NY 10292-0098".find(~/(\d{5})-?(\d{4})/)If you need to work with capture groups, then use the closure version of this method or use Groovy's matcher operators or use eachMatch.
pattern
- the compiled regex PatternReturns the result of calling a closure with the first occurrence of a compiled regular expression found within a String. If the regex doesn't match, the closure will not be called and find will return null.
For example, if the pattern doesn't match, the result is null:
assert null == "New York, NY".find(~/\d{5}/) { match -> return "-$match-"}If it does match and we don't have any capture groups in our regex, there is a single parameter on the closure that the match gets passed to:
assert "-10292-" == "New York, NY 10292-0098".find(~/\d{5}/) { match -> return "-$match-"}If we have capture groups in our expression, our closure has one parameter for the match, followed by one for each of the capture groups:
assert "10292" == "New York, NY 10292-0098".find(~/(\d{5})-?(\d{4})/) { match, zip, plusFour -> assert match == "10292-0098" assert zip == "10292" assert plusFour == "0098" return zip }If we have capture groups in our expression, and our closure has one parameter, the closure will be passed an array with the first element corresponding to the whole match, followed by an element for each of the capture groups:
assert "10292" == "New York, NY 10292-0098".find(~/(\d{5})-?(\d{4})/) { match, zip, plusFour -> assert array[0] == "10292-0098" assert array[1] == "10292" assert array[2] == "0098" return array[1] }If a capture group is optional, and doesn't match, then the corresponding value for that capture group passed to the closure will be null as illustrated here:
assert "2339999" == "adsf 233-9999 adsf".find(~/(\d{3})?-?(\d{3})-(\d{4})/) { match, areaCode, exchange, stationNumber -> assert "233-9999" == match assert null == areaCode assert "233" == exchange assert "9999" == stationNumber return "$exchange$stationNumber" }
pattern
- the compiled regex Patternclosure
- the closure that will be passed the full match, plus each of the capturing groups (if any)Returns a (possibly empty) list of all occurrences of a regular expression (provided as a CharSequence) found within a CharSequence.
For example, if the regex doesn't match, it returns an empty list:
assert [] == "foo".findAll(/(\w*) Fish/)Any regular expression matches are returned in a list, and all regex capture groupings are ignored, only the full match is returned:
def expected = ["One Fish", "Two Fish", "Red Fish", "Blue Fish"] assert expected == "One Fish, Two Fish, Red Fish, Blue Fish".findAll(/(\w*) Fish/)If you need to work with capture groups, then use the closure version of this method or use Groovy's matcher operators or use eachMatch.
regex
- the capturing regex CharSequenceFinds all occurrences of a regular expression string within a CharSequence. Any matches are passed to the specified closure. The closure is expected to have the full match in the first parameter. If there are any capture groups, they will be placed in subsequent parameters.
If there are no matches, the closure will not be called, and an empty List will be returned.
For example, if the regex doesn't match, it returns an empty list:
assert [] == "foo".findAll(/(\w*) Fish/) { match, firstWord -> return firstWord }Any regular expression matches are passed to the closure, if there are no capture groups, there will be one parameter for the match:
assert ["couldn't", "wouldn't"] == "I could not, would not, with a fox.".findAll(/.ould/) { match -> "${match}n't"}If there are capture groups, the first parameter will be the match followed by one parameter for each capture group:
def orig = "There's a Wocket in my Pocket" assert ["W > Wocket", "P > Pocket"] == orig.findAll(/(.)ocket/) { match, firstLetter -> "$firstLetter > $match" }
regex
- the capturing regex CharSequenceclosure
- will be passed the full match plus each of the capturing groups (if any)Returns a (possibly empty) list of all occurrences of a regular expression (in Pattern format) found within a CharSequence.
For example, if the pattern doesn't match, it returns an empty list:
assert [] == "foo".findAll(~/(\w*) Fish/)Any regular expression matches are returned in a list, and all regex capture groupings are ignored, only the full match is returned:
def expected = ["One Fish", "Two Fish", "Red Fish", "Blue Fish"] assert expected == "One Fish, Two Fish, Red Fish, Blue Fish".findAll(~/(\w*) Fish/)
pattern
- the compiled regex PatternFinds all occurrences of a compiled regular expression Pattern within a CharSequence. Any matches are passed to the specified closure. The closure is expected to have the full match in the first parameter. If there are any capture groups, they will be placed in subsequent parameters.
If there are no matches, the closure will not be called, and an empty List will be returned.
For example, if the pattern doesn't match, it returns an empty list:
assert [] == "foo".findAll(~/(\w*) Fish/) { match, firstWord -> return firstWord }Any regular expression matches are passed to the closure, if there are no capture groups, there will be one parameter for the match:
assert ["couldn't", "wouldn't"] == "I could not, would not, with a fox.".findAll(~/.ould/) { match -> "${match}n't"}If there are capture groups, the first parameter will be the match followed by one parameter for each capture group:
def orig = "There's a Wocket in my Pocket" assert ["W > Wocket", "P > Pocket"] == orig.findAll(~/(.)ocket/) { match, firstLetter -> "$firstLetter > $match" }
pattern
- the compiled regex Patternclosure
- will be passed the full match plus each of the capturing groups (if any)Support the range subscript operator for CharSequence or StringBuffer with EmptyRange
range
- an EmptyRangeSupport the range subscript operator for CharSequence with IntRange
range
- an IntRangeSupport the range subscript operator for CharSequence
range
- a RangeSupport the subscript operator for CharSequence.
index
- the index of the Character to getSelect a List of characters from a CharSequence using a Collection to identify the indices to be selected.
indices
- a Collection of indicesConverts the given CharSequence into an array of characters.
True if a CharSequence only contains whitespace characters.
Determine if a CharSequence can be parsed as a BigDecimal.
Determine if a CharSequence can be parsed as a BigInteger.
'Case' implementation for a CharSequence, which uses equals between the toString() of the caseValue and the switchValue. This allows CharSequence values to be used in switch statements. For example:
switch( str ) { case 'one' : // etc... }Note that this returns
true
for the case where both the
'switch' and 'case' operand is null
.
switchValue
- the switch valueDetermine if a CharSequence can be parsed as a Double.
Determine if a CharSequence can be parsed as a Float.
Determine if a CharSequence can be parsed as an Integer.
Determine if a CharSequence can be parsed as a Long.
Determine if a CharSequence can be parsed as a Number. Synonym for 'isBigDecimal()'.
Overloads the left shift operator to provide an easy way to append multiple objects as string representations to a CharSequence.
value
- an ObjectTells whether or not a CharSequence matches the given compiled regular expression Pattern.
pattern
- the regex Pattern to which the string of interest is to be matchedRemove a part of a CharSequence by replacing the first occurrence of target within self with '' and returns the result.
target
- an object representing the part to removeRemove a part of a CharSequence. This replaces the first occurrence of the pattern within self with '' and returns the result.
pattern
- a Pattern representing the part to removeRepeat a CharSequence a certain number of times.
factor
- the number of times the CharSequence should be repeatedThis method is called by the ++ operator for the class CharSequence. It increments the last character in the given CharSequence. If the last character in the CharSequence is Character.MAX_VALUE a Character.MIN_VALUE will be appended. The empty CharSequence is incremented to a string consisting of the character Character.MIN_VALUE.
Return a String with linefeeds and carriage returns normalized to linefeeds.
Pad a CharSequence to a minimum length specified by numberOfChars by adding the space character to the left as many times as needed. If the String is already the same size or bigger than the target numberOfChars, then the original String is returned. An example:
println 'Numbers:' [1, 10, 100, 1000].each{ println it.toString().padLeft(5) }will produce output like:
Numbers: 1 10 100 1000
numberOfChars
- the total minimum number of characters of the resulting CharSequencePad a CharSequence to a minimum length specified by numberOfChars, adding the supplied padding CharSequence as many times as needed to the left. If the CharSequence is already the same size or bigger than the target numberOfChars, then the toString() of the original CharSequence is returned. An example:
println 'Numbers:' [1, 10, 100, 1000].each{ println it.toString().padLeft(5, '*') } [2, 20, 200, 2000].each{ println it.toString().padLeft(5, '*_') }will produce output like:
Numbers: ****1 ***10 **100 *1000 *_*_2 *_*20 *_200 *2000
numberOfChars
- the total minimum number of characters of the resulting CharSequencepadding
- the characters used for paddingPad a CharSequence to a minimum length specified by numberOfChars by adding the space character to the right as many times as needed. If the CharSequence is already the same size or bigger than the target numberOfChars, then the toString() of the original CharSequence is returned. An example:
['A', 'BB', 'CCC', 'DDDD'].each{ println it.padRight(5) + it.size() }will produce output like:
A 1 BB 2 CCC 3 DDDD 4
numberOfChars
- the total minimum number of characters of the resulting stringPad a CharSequence to a minimum length specified by numberOfChars, adding the supplied padding CharSequence as many times as needed to the right. If the CharSequence is already the same size or bigger than the target numberOfChars, then the toString() of the original CharSequence is returned. An example:
['A', 'BB', 'CCC', 'DDDD'].each{ println it.padRight(5, '#') + it.size() }will produce output like:
A####1 BB###2 CCC##3 DDDD#4
numberOfChars
- the total minimum number of characters of the resulting CharSequencepadding
- the characters used for paddingAppends the String representation of the given operand to this CharSequence.
value
- any ObjectThis method is called by the -- operator for the class CharSequence. It decrements the last character in the given CharSequence. If the last character in the CharSequence is Character.MIN_VALUE it will be deleted. The empty CharSequence can't be decremented.
Return the lines of a CharSequence as a List of String.
Replaces all occurrences of a captured group by the result of a closure on that text.
For examples,
assert "hellO wOrld" == "hello world".replaceAll("(o)") { it[0].toUpperCase() } assert "FOOBAR-FOOBAR-" == "foobar-FooBar-".replaceAll("(([fF][oO]{2})[bB]ar)", { Object[] it -> it[0].toUpperCase() }) Here, it[0] is the global string of the matched group it[1] is the first string in the matched group it[2] is the second string in the matched group assert "FOO-FOO-" == "foobar-FooBar-".replaceAll("(([fF][oO]{2})[bB]ar)", { x, y, z -> z.toUpperCase() }) Here, x is the global string of the matched group y is the first string in the matched group z is the second string in the matched groupNote that unlike String.replaceAll(String regex, String replacement), where the replacement string treats '$' and '\' specially (for group substitution), the result of the closure is converted to a string and that value is used literally for the replacement.
regex
- the capturing regexclosure
- the closure to apply on each captured groupReplaces each substring of this CharSequence that matches the given regular expression with the given replacement.
regex
- the capturing regexreplacement
- the string to be substituted for each matchReplaces all occurrences of a captured group by the result of a closure call on that text.
For examples,
assert "hellO wOrld" == "hello world".replaceAll(~"(o)") { it[0].toUpperCase() } assert "FOOBAR-FOOBAR-" == "foobar-FooBar-".replaceAll(~"(([fF][oO]{2})[bB]ar)", { it[0].toUpperCase() }) Here, it[0] is the global string of the matched group it[1] is the first string in the matched group it[2] is the second string in the matched group assert "FOOBAR-FOOBAR-" == "foobar-FooBar-".replaceAll(~"(([fF][oO]{2})[bB]ar)", { Object[] it -> it[0].toUpperCase() }) Here, it[0] is the global string of the matched group it[1] is the first string in the matched group it[2] is the second string in the matched group assert "FOO-FOO-" == "foobar-FooBar-".replaceAll("(([fF][oO]{2})[bB]ar)", { x, y, z -> z.toUpperCase() }) Here, x is the global string of the matched group y is the first string in the matched group z is the second string in the matched groupNote that unlike String.replaceAll(String regex, String replacement), where the replacement string treats '$' and '\' specially (for group substitution), the result of the closure is converted to a string and that value is used literally for the replacement.
pattern
- the capturing regex Patternclosure
- the closure to apply on each captured groupReplaces all substrings of a CharSequence that match the given compiled regular expression with the given replacement.
Note that backslashes (\) and dollar signs ($) in the replacement string may cause the results to be different than if it were being treated as a literal replacement string; see Matcher#replaceAll. Use Matcher#quoteReplacement to suppress the special meaning of these characters, if desired.
assert "foo".replaceAll('o', 'X') == 'fXX'
pattern
- the regex Pattern to which the CharSequence of interest is to be matchedreplacement
- the CharSequence to be substituted for the first matchReplaces the first occurrence of a captured group by the result of a closure call on that text.
For example (with some replaceAll variants thrown in for comparison purposes),
assert "hellO world" == "hello world".replaceFirst("(o)") { it[0].toUpperCase() } // first match assert "hellO wOrld" == "hello world".replaceAll("(o)") { it[0].toUpperCase() } // all matches assert '1-FISH, two fish' == "one fish, two fish".replaceFirst(/([a-z]{3})\s([a-z]{4})/) { [one:1, two:2][it[1]] + '-' + it[2].toUpperCase() } assert '1-FISH, 2-FISH' == "one fish, two fish".replaceAll(/([a-z]{3})\s([a-z]{4})/) { [one:1, two:2][it[1]] + '-' + it[2].toUpperCase() }
regex
- the capturing regexclosure
- the closure to apply on the first captured groupReplaces the first substring of this CharSequence that matches the given regular expression with the given replacement.
regex
- the capturing regexreplacement
- the CharSequence to be substituted for each matchReplaces the first occurrence of a captured group by the result of a closure call on that text.
For example (with some replaceAll variants thrown in for comparison purposes),
assert "hellO world" == "hello world".replaceFirst(~"(o)") { it[0].toUpperCase() } // first match assert "hellO wOrld" == "hello world".replaceAll(~"(o)") { it[0].toUpperCase() } // all matches assert '1-FISH, two fish' == "one fish, two fish".replaceFirst(~/([a-z]{3})\s([a-z]{4})/) { [one:1, two:2][it[1]] + '-' + it[2].toUpperCase() } assert '1-FISH, 2-FISH' == "one fish, two fish".replaceAll(~/([a-z]{3})\s([a-z]{4})/) { [one:1, two:2][it[1]] + '-' + it[2].toUpperCase() }
pattern
- the capturing regex Patternclosure
- the closure to apply on the first captured groupReplaces the first substring of a CharSequence that matches the given compiled regular expression with the given replacement.
Note that backslashes (\) and dollar signs ($) in the replacement string may cause the results to be different than if it were being treated as a literal replacement string; see Matcher#replaceFirst. Use Matcher#quoteReplacement to suppress the special meaning of these characters, if desired.
assert "foo".replaceFirst('o', 'X') == 'fXo'
pattern
- the regex Pattern to which the CharSequence of interest is to be matchedreplacement
- the CharSequence to be substituted for the first matchCreates a String which is the reverse (backwards) of this CharSequence
Provide the standard Groovy size()
method for CharSequence
.
Convenience method to split a CharSequence (with whitespace as delimiter). Similar to tokenize, but returns an Array of String instead of a List.
Iterates through the given CharSequence line by line, splitting each line using the given regex delimiter. The list of tokens for each line is then passed to the given closure.
regex
- the delimiting regular expressionclosure
- a closureIterates through the given CharSequence line by line, splitting each line using the given separator Pattern. The list of tokens for each line is then passed to the given closure.
pattern
- the regular expression Pattern for the delimiterclosure
- a closureStrip leading spaces from every line in a CharSequence. The line with the least number of leading spaces determines the number to remove. Lines only containing whitespace are ignored when calculating the number of leading spaces to strip.
assert ' A\n B\nC' == ' A\n B\n C'.stripIndent()
Strip numChar leading characters from every line in a CharSequence.
assert 'DEF\n456' == '''ABCDEF\n123456'''.stripIndent(3)
numChars
- The number of characters to stripStrip leading whitespace/control characters followed by '|' from every line in a CharSequence.
assert 'ABC\n123\n456' == '''ABC |123 |456'''.stripMargin()
Strip leading whitespace/control characters followed by marginChar from every line in a CharSequence.
assert 'ABC\n123\n456' == '''ABC *123 *456'''.stripMargin('*')
marginChar
- Any character that serves as margin delimiterStrip leading whitespace/control characters followed by marginChar from every line in a CharSequence.
marginChar
- Any character that serves as margin delimiterReturns the first num
elements from this CharSequence.
def text = "Groovy" assert text.take( 0 ) == '' assert text.take( 2 ) == 'Gr' assert text.take( 7 ) == 'Groovy'
num
- the number of chars to take from this CharSequencenum
chars,
or else the whole CharSequence if it has less then num
elements.Returns the longest prefix of this CharSequence where each element passed to the given closure evaluates to true.
def text = "Groovy" assert text.takeWhile{ it < 'A' } == '' assert text.takeWhile{ it < 'Z' } == 'G' assert text.takeWhile{ it != 'v' } == 'Groo' assert text.takeWhile{ it < 'z' } == 'Groovy'
condition
- the closure that must evaluate to true to continue taking elementsParse a CharSequence into a BigDecimal
Parse a CharSequence into a BigInteger
Parse a CharSequence into a Double
Parse a CharSequence into a Float
Parse a CharSequence into an Integer
Converts the given CharSequence into a List of Strings of one character.
Parse a CharSequence into a Long
Converts the given CharSequence into a Set of unique String of one character.
Parse a CharSequence into a Short
Transforms a CharSequence representing a URI into a URI object.
Transforms a CharSequence representing a URL into a URL object.
Tokenize a CharSequence (with a whitespace as the delimiter).
Tokenize a CharSequence based on the given CharSequence delimiter.
token
- the delimiterTokenize a CharSequence based on the given character delimiter. For example:
char pathSep = ':' assert "/tmp:/usr".tokenize(pathSep) == ["/tmp", "/usr"]
token
- the delimiterTranslates a CharSequence by replacing characters from the sourceSet with characters from replacementSet. If the first character from sourceSet appears in the CharSequence, it will be replaced with the first character from replacementSet. If the second character from sourceSet appears in the CharSequence, it will be replaced with the second character from replacementSet. and so on for all provided replacement characters.
Here is an example which converts the vowels in a word from lower to uppercase:
assert 'hello'.tr('aeiou', 'AEIOU') == 'hEllO'A character range using regex-style syntax can also be used, e.g. here is an example which converts a word from lower to uppercase:
assert 'hello'.tr('a-z', 'A-Z') == 'HELLO'Hyphens at the start or end of sourceSet or replacementSet are treated as normal hyphens and are not considered to be part of a range specification. Similarly, a hyphen immediately after an earlier range is treated as a normal hyphen. So, '-x', 'x-' have no ranges while 'a-c-e' has the range 'a-c' plus the '-' character plus the 'e' character.
Unlike the unix tr command, Groovy's tr command supports reverse ranges, e.g.:
assert 'hello'.tr('z-a', 'Z-A') == 'HELLO'If replacementSet is smaller than sourceSet, then the last character from replacementSet is used as the replacement for all remaining source characters as shown here:
assert 'Hello World!'.tr('a-z', 'A') == 'HAAAA WAAAA!'If sourceSet contains repeated characters, the last specified replacement is used as shown here:
assert 'Hello World!'.tr('lloo', '1234') == 'He224 W4r2d!'The functionality provided by tr can be achieved using regular expressions but tr provides a much more compact notation and efficient implementation for certain scenarios.
sourceSet
- the set of characters to translate fromreplacementSet
- the set of replacement charactersReplaces sequences of whitespaces with tabs using tabStops of size 8.
Replaces sequences of whitespaces with tabs.
tabStop
- The number of spaces a tab representsReplaces sequences of whitespaces with tabs within a line.
tabStop
- The number of spaces a tab represents


FakeLocalSigner is a signer which already has identity an nonce set to fake values
var FakeLocalSigner = &LocalSigner{ Identity: []byte("IdentityBytes"), Nonce: []byte("NonceValue"), }
LocalSigner is a mock implementation of crypto.LocalSigner
type LocalSigner struct { Identity []byte Nonce []byte }
func (ls *LocalSigner) NewSignatureHeader() (*cb.SignatureHeader, error)
NewSignatureHeader returns a new signature header, nil
func (ls *LocalSigner) Serialize() ([]byte, error)
func (ls *LocalSigner) Sign(msg []byte) ([]byte, error)
Sign returns the msg, nil


|
|||||||||
| PREV NEXT | FRAMES NO FRAMES |
GXLLocalConnection
contains dangling tentacles.
GXLString
to another object.
GXLLocator
to another object.
GXLInt
to another object.
GXLFloat
to another object.
GXLEnum
to another object.
GXLBool
to another object.
hypergraph
attribute.
attr
child element with the specified name.
attr
element.
attr
elements contained in this element.
GXLBool
as a boolean.
GXLLocalConnectionTentacle
s connected to this GXLGraphElement
.
GXLDocument
that this element is contained in,
or null if this element isn't contained in a GXLDocument
gxl
element.
edgeids
attribute.
edgemode
attribute.
GXLAtomicValue
element whose value has changed.
attr
element whose value has been replaced.
GXLFloat
as a float.
GXLGraph
.
GXLGraph
s in this element.
GXLGraphElement
.
GXLGraphElement
s (nodes, edges and relations) contained in this graph.
id
attribute or null
if the attribute isn't set.
GXLInt
as an int.
kind
attribute or null
if the attribute isn't set.
GXLRel
that this relend
connects from.
GXLLocalConnection
that this tentacle connects from.
name
attribute or null
if the attribute isn't set.
relend
child.
relend
children contained in this rel
element.
relend
.
role
attribute or null
if the attribute isn't set.
role
attribute or null
if the attribute isn't set.
GXLGraphElement
that this relend
connects to.
GXLGraphElement
that this tentacle connects to.
target
attribute.
GXLGraphElement
that this tentacle connects to.
GXLLocalConnection
has.
GXLLocator
.
GXLValue
of this attr
element.
String
.
attr
element.
GXLAttr
element.
GXLElement
s that can be attributed using attr
elements.
GXLDocumentListener
s when an attribute has been modified.attr
elements value has been replaced.
attr
elements value has been replaced.
GXLDocumentListener
s when an attr
elements
value has been replaced.bag
element.
GXLBag
element.
bool
element.
GXLBool
element.
bag, set, seq
and tup
).gxl
element.
InputStream
and builds the GXL document structure out of it.
edge
element.
GXLEdge
element with the specified source and target.
GXLEdge
element with the specified source and target.
enum
element.
GXLEnum
element.
float
element.
GXLFloat
element.
graph
element.
GXLGraph
element with the specified id.
GXLElement
s that can be connected by GXLLocalConnection
s.
gxl
element.
int
element.
GXLInt
element.
GXLEdge
and GXLRel
providing basic edge functionality.GXLLocalConnection
and a GXLGraphElement
.
locator
element.
GXLLocator
element.
node
element.
rel
element.
GXLRel
element containing no tentacles.
relend
element.
GXLRelend
element with the specified target.
GXLRelend
element with the specified target.
seq
element.
GXLSeq
element.
set
element.
GXLSet
element.
string
element.
GXLString
element.
GXLDocumentListener
s when an element has been inserted or removed.tup
element.
GXLTup
element.
type
element.
GXLType
element.
GXLElement
s that can be typed using the type
element.
GXLDocumentListener
s when a GXLAtomicValue
has been modified.relend
is ordered relative to the surrounding relations other relend
s.
GXLLocalConnection
is directed.
hypergraph
attribute.
directed
attribute.
direction
attribute.
edgeids
attribute.
edgemode
attribute.
id
attribute.
kind
attribute.
name
attribute.
relend
.
role
attribute.
role
attribute.
GXLGraphElement
that this relend
connects to.
GXLGraphElement
that this tentacle connects to.
target
attribute.
GXLGraphElement
that this tentacle connects to.
attr
element.
OutputStream
.
|
|||||||||
| PREV NEXT | FRAMES NO FRAMES |


(#) Separate attach() and detach() into separate FragmentTransactions !!! WARNING: Separate attach() and detach() into separate FragmentTransactions This is a warning. Id : `DetachAndAttachSameFragment` Summary : Separate attach() and detach() into separate FragmentTransactions Severity : Warning Category : Correctness Platform : Android Vendor : Android Open Source Project Identifier : androidx.fragment Feedback : https://issuetracker.google.com/issues/new?component=460964 Min : Lint 7.0 Compiled : Lint 8.0 and 8.1 Artifact : [androidx.fragment:fragment](androidx_fragment_fragment.md.html) Affects : Kotlin and Java files Editing : This check runs on the fly in the IDE editor Implementation : [Source Code](https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:/fragment/fragment-lint/src/main/java/androidx/fragment/lint/AttachAndDetachInSameTransactionDetector.kt) Tests : [Source Code](https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:/fragment/fragment-lint/src/test/java/androidx/fragment/lint/AttachAndDetachInSameTransactionDetectorTest.kt) Copyright Year : 2019 When doing a FragmentTransaction that includes both attach() and detach() operations being committed on the same fragment instance, it is a no-op. The reason for this is that the FragmentManager optimizes all operations within a single transaction so the attach() and detach() cancel each other out and neither is actually executed. To get the desired behavior, you should separate the attach() and detach() calls into separate FragmentTransactions. (##) Including !!! This is not a built-in check. To include it, add the below dependency to your project. ``` // build.gradle.kts implementation("androidx.fragment:fragment:1.7.0-alpha01") // build.gradle implementation 'androidx.fragment:fragment:1.7.0-alpha01' // build.gradle.kts with version catalogs: implementation(libs.fragment) # libs.versions.toml [versions] fragment = "1.7.0-alpha01" [libraries] fragment = { module = "androidx.fragment:fragment", version.ref = "fragment" } ``` 1.7.0-alpha01 is the version this documentation was generated from; there may be newer versions available. [Additional details about androidx.fragment:fragment](androidx_fragment_fragment.md.html). (##) Suppressing You can suppress false positives using one of the following mechanisms: * Using a suppression annotation like this on the enclosing element: ```kt // Kotlin @Suppress("DetachAndAttachSameFragment") fun method() { beginTransaction(...) } ``` or ```java // Java @SuppressWarnings("DetachAndAttachSameFragment") void method() { beginTransaction(...); } ``` * Using a suppression comment like this on the line above: ```kt //noinspection DetachAndAttachSameFragment problematicStatement() ``` * Using a special `lint.xml` file in the source tree which turns off the check in that folder and any sub folder. A simple file might look like this: ```xml <?xml version="1.0" encoding="UTF-8"?> <lint> <issue id="DetachAndAttachSameFragment" severity="ignore" /> </lint> ``` Instead of `ignore` you can also change the severity here, for example from `error` to `warning`. You can find additional documentation on how to filter issues by path, regular expression and so on [here](https://googlesamples.github.io/android-custom-lint-rules/usage/lintxml.md.html). * In Gradle projects, using the DSL syntax to configure lint. For example, you can use something like ```gradle lintOptions { disable 'DetachAndAttachSameFragment' } ``` In Android projects this should be nested inside an `android { }` block. * For manual invocations of `lint`, using the `--ignore` flag: ``` $ lint --ignore DetachAndAttachSameFragment ...` ``` * Last, but not least, using baselines, as discussed [here](https://googlesamples.github.io/android-custom-lint-rules/usage/baselines.md.html).


Graeme Wahn
<EMAIL_ADDRESS>Lind Prize 2021
Lamp in the Hand (11mb)
Revealers, 2019, published 2020
Green Glass Door
Selected Works 2
Selected Works 1
CV


The close() function allows you to close open files and pipes. There are a number of reasons you should use it.
You can only have so many pipes open at a time. (See the section "Limitations" below, which describes how such limitations can differ from system to system.) In order to open as many pipes in a program as you wish, you must use the close() function to close a pipe when you are done with it (ordinarily, when getline returns 0 or -1). It takes a single argument, the same expression used to create the pipe. Here's an example:
close("who")
Closing a pipe allows you to run the same command twice. For example, you can use date twice to time a command.
Using close() may be necessary in order to get an output pipe to finish its work. For example:
{ some processing of $0 | "sort > tmpfile" } END { close("sort > tmpfile") while ((getline < "tmpfile") > 0) { do more work } }
Closing open files is necessary to keep you from exceeding your system's limit on simultaneously open files.
We will see an example of the close() function in the section "Working with Multiple Files" later in this chapter.


Raag - Singing Competition
Mirage - Fashion Show
Hasya Kavi
Natraj - Solo Dance
Games
Banjo - The Clash of Bands
Sargam - Group Singing
Nritya - Group Dance
Manch Tantra - Skit ompetition
Gudgudi - A comic act
Tamaasha - Nukkad Natak
Filmy Mukabala - Cine Quiz
Sa Re Ga Ma Pa - Antakshri
Drishyam - Mobile Movie Making
Ad Mad - Advertisement
Technical Quiz
Rags To Rich
Bidding C Quiz
LAN Games
Hack Fest
Robo Race
Circuit Designing
Code Debugging
Web Developer
Bear Your Load
AUTO Cad
Build a bridge
Idea Presentation


MT
3/4 BP
BS
BO
2LM
CP
Are there at least 2 (preferable 4+) red super WRB?
Does the 'last' bar have massive Ending Volume?
Do(es) the last bar(s) have Bottoming Tails?
Does price break prior Support or Resistance?
Do the last bars change color?
Is price far away from the 21 EMA?
Does the Igniting Bar have big volume?
Check
Reset
Calculator Your Share Size
Rating:
-


News
Rocket Timeline
Born in Faculdade de Ciências e Tecnologia of NOVA University of Lisbon last year with the will to learn new concepts, explore the unknown and test our limits. The project's team dedicates not just to learning how to design, assemble, and launch rockets, but also to improve its efficiency from paper electronics for weight reduction to rocket motor designs.
Currently we are in talks with Seixal municipality to get permission to launch at Aeromodelling Track of Seixal. We hope to launch rocket mid-May. The rocket will reach 300 m under simulation with electronics to measure the altitude, speed and rotation. Every part of the rocket made by us with paper, balsa, and 3d printed parts, except the motor engine.
Development of motor engine made of Potassium Nitrate/Sorbitol (KNSB), with paper electronics developed at CENIMAT|i3n and new body materials.
Still under discussion, it will be our most challenging rocket. Using previously used technologies and improving in our mistakes, it will probably be launched in Spain.
The final frontier is Space, at 100 Km.
About Us
This project was born in Faculdade de Ciências e Tecnologia of NOVA University of Lisbon last year with the will to learn new concepts, explore the unknown and test our limits. The project's team dedicates not just to learning how to design, assemble, and launch rockets, but also to improve its efficiency from paper electronics for weight reduction to rocket motor designs.
Even tought model rocketry is a very popular hobby in other countries in Portugal there is a very small culture. So we also aim to educate and inspire the next generation of engineers.


Why can't I skip ahead from Syntactical/validity to Quality before you fixing my Syntactical/Validity edit errors?
When you recheck the file that you have fixed, you need to recheck the full file and not just the changes


Wallabag URL
http://
Check URL
Use HTTPS
Client ID
Client secret
User login
User password
Get token
Allow Space in tags (this disables Space as send-tags key, use Enter key instead)
Checklist
ok?
Wallabag URL checked
Not checked
Wallabag api version
Not checked
Wallabag api token
Not granted
Token expires at
Not granted


ZLIB-FLATE(1) User Commands ZLIB-FLATE(1) NAME zlib-flate - raw zlib compression program SYNOPSIS zlib-flate -compress | -uncompress DESCRIPTION The zlib-flate program is part of the qpdf package. The zlib-flate program reads from standard input and writes to standard output either compressing or uncompressing its input using raw zlib com‐ pression. It can be used to uncompress or compress raw PDF streams or other data that is compressed with raw zlib compression. This program is provided primarily as a debugging tool, though it could be used for other purposes, such as being called from a script that creates simple PDF files. This program should not be used as a general purpose compression tool. Use something like gzip(1) instead. For details about qpdf, please see the qpdf manual, which can be found in /usr/share/doc/qpdf/qpdf-manual.html or /usr/share/doc/qpdf/qpdf-man‐ ual.pdf. SEE ALSO qpdf(1), gzip(1) zlib-flate from qpdf version 2.3.1 April 2008 ZLIB-FLATE(1)


{% include template_header.html %}
I am a Robotics gradate student at Johns Hopkins University. I am seeking employment in Robotics, Software and Mechatronics filed
I Worked with Bosch Engineers and contributed to ROS 2 (Robot Operating System) robot navigation open source community. I also created a ROS2 dashing beginner tutorial and a TurtleBot indoor SLAM demonstration package for beginners. I built simulation environment of Bosch Sunnyvale office space and home environment for algorithm validation.
I coordinated the communicate with customers and design detailed motor solutions for customer’s specific application, and provide technical support for custom application development. During my time at Lin Engineering, I prevented a major quality issue by performing failure analysis to returned merchandise, and coordinated multi-department investigation to improve manufacturing processes.
I developed autonomous RC car with collision avoidance functionality, and applied adaptive cruise control, path planning for the robot trajectory. I practiced sensor fusion and data processing for IMU, GPS and Lidar sensors.


--- layout: page title: "About" description: "Statement" active: about header-img: "img/about-bg.jpg" ---


Author<EMAIL_ADDRESS>Subject: Review: State And Main (2000) Approved<EMAIL_ADDRESS>Newsgroups: rec.arts.movies.reviews Organization: None X-Questions-to<EMAIL_ADDRESS>X-Submissions-to<EMAIL_ADDRESS>Followup-To: rec.arts.movies.current-films Summary: r.a.m.r. #28090 Keywords: author=polenz
State And Main a film review by Chad Polenz
WHAT IT'S ABOUT:
A Hollywood film crew invades the small town of Waterford, Vermont for its authenticity of an old-fashioned small American town where everyone knows each other's names, the firehouse is the same one used 100 years ago, and they have an old water mill. Problems arise when the screenwriter is called in to makes changes to the script on the fly because the old town is missing a few key landmarks and the starring actress doesn't want to do the nude scene. The film is also going over budget and the starring actor could be in big trouble with the law due to his craving for teenage girls.
WHAT'S GOOD ABOUT IT:
Writer/director David Mamet tells this story in the style of a classic stage play or musical, a la "Our Town" or "The Music Man." He keeps the atmosphere satirical which allows the comedy to work quite well. And yes, this is a comedy, but a thinking man's comedy where the jokes are derived from witty, biting jabs at Hollywood. You've seen this stuff before such as in "The Player" or "Bowfinger," or on quite a few sitcoms but Mamet's approach is a little different to keep it original, fresh and unpredictable so that when the story suddenly shifts or a wacky jokes pops up out of nowhere you're genuinely surprised.
WHAT'S NOT SO GOOD ABOUT IT:
Sometimes Mamet's mannerisms can be really annoying, especially if you're familiar with his work. If you're not, it includes characters repeating themselves; slowly-paced scenes and unnecessary foul language.
Rebecca Pidgeon plays essentially the same character she did in "The Spanish Prisoner" - an eccentric smart woman with a penchant for detail who likes to force herself onto others. She doesn't talk like a real person and when she dumps her fiancee for the screenwriter whom she's only known for a few days it comes across as quite lame and forced.
"State And Main" also has its moments of unbridled zaniness that reminds you of something on "Frasier." Although most of the comedy is original the jokes that are predictable are REALLY predictable.
OVERALL CRITIQUE:
It's nice to see Mamet lighten up a bit, relatively speaking. This being something of a throwaway, insignificant story it's still a heck of a lot better than if some Hollywood clown tried to write and direct it their way.
"State And Main" has a well-written screenplay of nuances and detail that's never gratuitous. Everything has a reason for being put in the place that it is. What's more, it even makes good use of the film-within-the-film's supposedly Oscar-caliber theme about getting a second chance. The actual film isn't quite THAT good, but it is a refreshing and satisfying change of pace that anyone would be bettered by seeing it.
GRADE: B
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


Example:
condition ? true : foo
After the quick fix is applied the result looks like:
condition || foo


Let's talk about text, or as it's known to programmers, strings! In this lesson we'll take a look at one of {{.Get "lang"}}'s most powerful data types and how you can use them to write awesome programs.
As you continue on your journey to becoming a {{.Get "lang"}} developer, one really useful skill you'll want to pickup along the way is the ability to work with strings in a variety of ways. Text is an important component of the programs we'll be writing in this course, so I want to introduce you to how strings are structured in {{.Get "lang"}}, and show you some cool and interesting ways we can manipulate and utilize them.
First let's take a look at how we might store a string inside a variable:
{{ partial "shortcodes/code" (dict "lang" (.Get "code-lang") "file" "" "Content" $.Page.Params.code.a ) }}
Notice first the way the string is formatted. Whenever we create strings in {{.Get "lang"}} we want to surround them with quotation marks. Any text inside the quotation marks is considered part of the string.
A string can contain any characters you want, including spaces, numbers, special characters, and even quotation marks (if you prefix them with a backslash \"
). Strings can also be as long as you want, in fact many programs you'll encounter as a developer might have strings with thousands or even millions of characters in them!
No converstaion about strings would be complete without talking about string indexes.
{{ partial "shortcodes/code" (dict "lang" (.Get "code-lang") "file" "" "Content" $.Page.Params.code.b ) }}
All characters in a string have specific indexes associated to them, it's basically their location from the start of the string. Notice above I've labeled each character in the string with it's corresponding index (the line of code with the indexes is a comment, it doesn't get executed by the computer).
If you look closely though you might notice something weird. The first letter of the string has an index of 0, not as you might have expected 1. This isn't a mistake on my part, in fact all string indexes start at 0. So we would say that the first character of the string is at index position 0, the second character is at index position 1, etc.
This is something that tends to trip up new developers (myself included when I learned it). This way of indexing things, where you start at 0 instead of 1, is common across most programming languages, and is something you'll get used to over time.
{{ partial "shortcodes/spotlight" (dict "Content" "Almost all counting in programming will start with 0 instead of 1, it's just something you have to get used to." ) }}
If you know the index of a character in a string, or want to know the character at a give index you can access one single character like so:
{{ partial "shortcodes/code" (dict "lang" (.Get "code-lang") "file" "" "Content" $.Page.Params.code.c ) }}
In the code above, we're accessing a character in the string at the specified index. You can use this syntax to access any of the characters in the string as long as a valid index is used.
So now that we have a handle on string indexes, I'll show you how you can get the length of a string. Knowing the length of a particular string can come in handy in many circumstances:
{{ partial "shortcodes/code" (dict "lang" (.Get "code-lang") "file" "" "Content" $.Page.Params.code.d ) }}
If you execute the program above, you'll see the length of the string printed out.
Now there's one thing you need to understand which is the relationship between string length and string indexes. In {{.Get "lang"}}, a string's length will always be one more than the index of it's last character. This is because we start the indexes at 0. So the string Hello
has a length of 5, but the index of the o
at the end is at position 4.
{{ partial "shortcodes/spotlight" (dict "Content" "Understanding this relationship between string length and string indexes is really important, and will be necessary later on in the course when we dive into more advanced topics!" ) }}
Now that we've talked about how strings are structured and learned about the relationship between string length & indexes, we can build off these concepts to continue learning. Check out the video above for an explanation of some more cool things you can do with strings in {{.Get "lang"}}.