class Solargraph::LanguageServer::Host
The language server protocol's data provider. Hosts are responsible for querying the library and processing messages. They also provide thread safety for multi-threaded transports.
Attributes
Public Class Methods
# File lib/solargraph/language_server/host.rb, line 25 def initialize @cancel_semaphore = Mutex.new @buffer_semaphore = Mutex.new @register_semaphore = Mutex.new @cancel = [] @buffer = String.new @stopped = true @next_request_id = 0 @dynamic_capabilities = Set.new @registered_capabilities = Set.new end
Public Instance Methods
Flag a method as available for dynamic registration.
@param method [String] The method name, e.g., 'textDocument/completion' @return [void]
# File lib/solargraph/language_server/host.rb, line 419 def allow_registration method @register_semaphore.synchronize do @dynamic_capabilities.add method end end
True if the specified LSP method can be dynamically registered.
@param method [String] @return [Boolean]
# File lib/solargraph/language_server/host.rb, line 429 def can_register? method @dynamic_capabilities.include?(method) end
Cancel the method with the specified ID.
@param id [Integer] @return [void]
# File lib/solargraph/language_server/host.rb, line 67 def cancel id @cancel_semaphore.synchronize { @cancel.push id } end
True if the host received a request to cancel the method with the specified ID.
@param id [Integer] @return [Boolean]
# File lib/solargraph/language_server/host.rb, line 76 def cancel? id result = false @cancel_semaphore.synchronize { result = @cancel.include? id } result end
@return [void]
# File lib/solargraph/language_server/host.rb, line 628 def catalog libraries.each(&:catalog) end
Update a document from the parameters of a textDocument/didChange method.
@param params [Hash] @return [void]
# File lib/solargraph/language_server/host.rb, line 237 def change params updater = generate_updater(params) sources.async_update params['textDocument']['uri'], updater diagnoser.schedule params['textDocument']['uri'] end
Delete the specified ID from the list of cancelled IDs if it exists.
@param id [Integer] @return [void]
# File lib/solargraph/language_server/host.rb, line 86 def clear id @cancel_semaphore.synchronize { @cancel.delete id } end
# File lib/solargraph/language_server/host.rb, line 632 def client_capabilities @client_capabilities ||= {} end
Close the file specified by the URI.
@param uri [String] @return [void]
# File lib/solargraph/language_server/host.rb, line 184 def close uri logger.info "Closing #{uri}" sources.close uri diagnoser.schedule uri end
@param uri [String] @param line [Integer] @param column [Integer] @return [Solargraph::SourceMap::Completion]
# File lib/solargraph/language_server/host.rb, line 501 def completions_at uri, line, column library = library_for(uri) library.completions_at uri_to_file(uri), line, column end
Update the configuration options with the provided hash.
@param update [Hash] @return [void]
# File lib/solargraph/language_server/host.rb, line 52 def configure update return if update.nil? options.merge! update logger.level = LOG_LEVELS[options['logLevel']] || DEFAULT_LOG_LEVEL end
Respond to a notification that a file was created in the workspace. The libraries will determine whether the file should be merged; see Solargraph::Library#create_from_disk
.
@param uri [String] The file uri. @return [Boolean] True if a library accepted the file.
# File lib/solargraph/language_server/host.rb, line 124 def create uri filename = uri_to_file(uri) result = false libraries.each do |lib| result = true if lib.create_from_disk(filename) end diagnoser.schedule uri if open?(uri) result end
@return [Hash{String => Object}]
# File lib/solargraph/language_server/host.rb, line 605 def default_configuration { 'completion' => true, 'hover' => true, 'symbols' => true, 'definitions' => true, 'rename' => true, 'references' => true, 'autoformat' => false, 'diagnostics' => false, 'formatting' => false, 'folding' => true, 'logLevel' => 'warn' } end
@param uri [String] @param line [Integer] @param column [Integer] @return [Array<Solargraph::Pin::Base>]
# File lib/solargraph/language_server/host.rb, line 510 def definitions_at uri, line, column library = library_for(uri) library.definitions_at(uri_to_file(uri), line, column) end
Delete the specified file from the library.
@param uri [String] The file uri. @return [void]
# File lib/solargraph/language_server/host.rb, line 138 def delete uri filename = uri_to_file(uri) libraries.each do |lib| lib.delete(filename) end send_notification "textDocument/publishDiagnostics", { uri: uri, diagnostics: [] } end
@param uri [String] @return [void]
# File lib/solargraph/language_server/host.rb, line 192 def diagnose uri if sources.include?(uri) library = library_for(uri) if library.synchronized? logger.info "Diagnosing #{uri}" begin results = library.diagnose uri_to_file(uri) send_notification "textDocument/publishDiagnostics", { uri: uri, diagnostics: results } rescue DiagnosticsError => e logger.warn "Error in diagnostics: #{e.message}" options['diagnostics'] = false send_notification 'window/showMessage', { type: LanguageServer::MessageTypes::ERROR, message: "Error in diagnostics: #{e.message}" } rescue FileNotFoundError => e # @todo This appears to happen when an external file is open and # scheduled for diagnosis, but the file was closed (i.e., the # editor moved to a different file) before diagnosis started logger.warn "Unable to diagnose #{uri} : #{e.message}" send_notification 'textDocument/publishDiagnostics', { uri: uri, diagnostics: [] } end else logger.info "Deferring diagnosis of #{uri}" diagnoser.schedule uri end else send_notification 'textDocument/publishDiagnostics', { uri: uri, diagnostics: [] } end end
@param query [String] @return [Array]
# File lib/solargraph/language_server/host.rb, line 552 def document query result = [] libraries.each { |lib| result.concat lib.document(query) } result end
@param uri [String] @return [Array<Solargraph::Pin::Base>]
# File lib/solargraph/language_server/host.rb, line 560 def document_symbols uri library = library_for(uri) # At this level, document symbols should be unique; e.g., a # module_function method should return the location for Module.method # or Module#method, but not both. library.document_symbols(uri_to_file(uri)).uniq(&:location) end
Clear the message buffer and return the most recent data.
@return [String] The most recent data or an empty string.
# File lib/solargraph/language_server/host.rb, line 256 def flush tmp = '' @buffer_semaphore.synchronize do tmp = @buffer.clone @buffer.clear end tmp end
@return [Array<String>]
# File lib/solargraph/language_server/host.rb, line 321 def folders libraries.map { |lib| lib.workspace.directory } end
@param uri [String] @return [Array<Range>]
# File lib/solargraph/language_server/host.rb, line 623 def folding_ranges uri sources.find(uri).folding_ranges end
Locate multiple pins that match a completion item. The first match is based on the corresponding location in a library source if available. Subsequent matches are based on path.
@param params [Hash] A hash representation of a completion item @return [Array<Pin::Base>]
# File lib/solargraph/language_server/host.rb, line 466 def locate_pins params return [] unless params['data'] && params['data']['uri'] library = library_for(params['data']['uri']) result = [] if params['data']['location'] location = Location.new( params['data']['location']['filename'], Range.from_to( params['data']['location']['range']['start']['line'], params['data']['location']['range']['start']['character'], params['data']['location']['range']['end']['line'], params['data']['location']['range']['end']['character'] ) ) result.concat library.locate_pins(location).select{ |pin| pin.name == params['label'] } end if params['data']['path'] result.concat library.path_pins(params['data']['path']) end # Selecting by both location and path can result in duplicate pins result.uniq { |p| [p.path, p.location] } end
Open the specified file in the library.
@param uri [String] The file uri. @param text [String] The contents of the file. @param version [Integer] A version number. @return [void]
# File lib/solargraph/language_server/host.rb, line 155 def open uri, text, version src = sources.open(uri, text, version) libraries.each do |lib| lib.merge src end diagnoser.schedule uri end
True if the specified file is currently open in the library.
@param uri [String] @return [Boolean]
# File lib/solargraph/language_server/host.rb, line 176 def open? uri sources.include? uri end
@param uri [String] @return [void]
# File lib/solargraph/language_server/host.rb, line 165 def open_from_disk uri sources.open_from_disk(uri) library = library_for(uri) # library.open_from_disk uri_to_file(uri) diagnoser.schedule uri end
@return [Hash]
# File lib/solargraph/language_server/host.rb, line 59 def options @options ||= default_configuration end
Get a list of IDs for server requests that are waiting for responses from the client.
@return [Array<Integer>]
# File lib/solargraph/language_server/host.rb, line 600 def pending_requests requests.keys end
Prepare a library for the specified directory.
@param directory [String] @param name [String, nil] @return [void]
# File lib/solargraph/language_server/host.rb, line 270 def prepare directory, name = nil # No need to create a library without a directory. The generic library # will handle it. return if directory.nil? logger.info "Preparing library for #{directory}" path = '' path = normalize_separators(directory) unless directory.nil? begin lib = Solargraph::Library.load(path, name) libraries.push lib rescue WorkspaceTooLargeError => e send_notification 'window/showMessage', { 'type' => Solargraph::LanguageServer::MessageTypes::WARNING, 'message' => e.message } end end
Prepare multiple folders.
@param array [Array<Hash{String => String}>] @return [void]
# File lib/solargraph/language_server/host.rb, line 292 def prepare_folders array return if array.nil? array.each do |folder| prepare uri_to_file(folder['uri']), folder['name'] end end
@param query [String] @return [Array<Solargraph::Pin::Base>]
# File lib/solargraph/language_server/host.rb, line 536 def query_symbols query result = [] (libraries + [generic_library]).each { |lib| result.concat lib.query_symbols(query) } result.uniq end
Queue a message to be sent to the client.
@param message [String] The message to send. @return [void]
# File lib/solargraph/language_server/host.rb, line 247 def queue message @buffer_semaphore.synchronize { @buffer += message } changed notify_observers end
@param uri [String] @return [String]
# File lib/solargraph/language_server/host.rb, line 491 def read_text uri library = library_for(uri) filename = uri_to_file(uri) library.read_text(filename) end
Start processing a request from the client. After the message is processed, the transport is responsible for sending the response.
@param request [Hash] The contents of the message. @return [Solargraph::LanguageServer::Message::Base] The message handler.
# File lib/solargraph/language_server/host.rb, line 95 def receive request if request['method'] logger.info "Server received #{request['method']}" logger.debug request message = Message.select(request['method']).new(self, request) begin message.process rescue StandardError => e logger.warn "Error processing request: [#{e.class}] #{e.message}" logger.warn e.backtrace.join("\n") message.set_error Solargraph::LanguageServer::ErrorCodes::INTERNAL_ERROR, "[#{e.class}] #{e.message}" end message elsif request['id'] # @todo What if the id is invalid? requests[request['id']].process(request['result']) requests.delete request['id'] else logger.warn "Invalid message received." logger.debug request end end
@param uri [String] @param line [Integer] @param column [Integer] @param strip [Boolean] Strip special characters from variable names @return [Array<Solargraph::Range>]
# File lib/solargraph/language_server/host.rb, line 529 def references_from uri, line, column, strip: true library = library_for(uri) library.references_from(uri_to_file(uri), line, column, strip: strip) end
Register the methods as capabilities with the client. This method will avoid duplicating registrations and ignore methods that were not flagged for dynamic registration by the client.
@param methods [Array<String>] The methods to register @return [void]
# File lib/solargraph/language_server/host.rb, line 374 def register_capabilities methods logger.debug "Registering capabilities: #{methods}" registrations = methods.select{|m| can_register?(m) and !registered?(m)}.map { |m| @registered_capabilities.add m { id: m, method: m, registerOptions: dynamic_capability_options[m] } } return if registrations.empty? @register_semaphore.synchronize do send_request 'client/registerCapability', { registrations: registrations } end end
True if the specified method has been registered.
@param method [String] The method name, e.g., 'textDocument/completion' @return [Boolean]
# File lib/solargraph/language_server/host.rb, line 437 def registered? method @registered_capabilities.include?(method) end
Remove a directory.
@param directory [String] @return [void]
# File lib/solargraph/language_server/host.rb, line 303 def remove directory logger.info "Removing library for #{directory}" # @param lib [Library] libraries.delete_if do |lib| next false if lib.workspace.directory != directory true end end
@param array [Array<Hash>] @return [void]
# File lib/solargraph/language_server/host.rb, line 314 def remove_folders array array.each do |folder| remove uri_to_file(folder['uri']) end end
@param query [String] @return [Array<String>]
# File lib/solargraph/language_server/host.rb, line 544 def search query result = [] libraries.each { |lib| result.concat lib.search(query) } result end
Send a notification to the client.
@param method [String] The message method @param params [Hash] The method parameters @return [void]
# File lib/solargraph/language_server/host.rb, line 330 def send_notification method, params response = { jsonrpc: "2.0", method: method, params: params } json = response.to_json envelope = "Content-Length: #{json.bytesize}\r\n\r\n#{json}" queue envelope logger.info "Server sent #{method}" logger.debug params end
Send a request to the client and execute the provided block to process the response. If an ID is not provided, the host will use an auto- incrementing integer.
@param method [String] The message method @param params [Hash] The method parameters @param block [Proc] The block that processes the response @yieldparam [Hash] The result sent by the client @return [void]
# File lib/solargraph/language_server/host.rb, line 352 def send_request method, params, &block message = { jsonrpc: "2.0", method: method, params: params, id: @next_request_id } json = message.to_json requests[@next_request_id] = Request.new(@next_request_id, &block) envelope = "Content-Length: #{json.bytesize}\r\n\r\n#{json}" queue envelope @next_request_id += 1 logger.info "Server sent #{method}" logger.debug params end
Send a notification to the client.
@param text [String] @param type [Integer] A MessageType constant @return [void]
# File lib/solargraph/language_server/host.rb, line 573 def show_message text, type = LanguageServer::MessageTypes::INFO send_notification 'window/showMessage', { type: type, message: text } end
Send a notification with optional responses.
@param text [String] @param type [Integer] A MessageType constant @param actions [Array<String>] Response options for the client @param block The block that processes the response @yieldparam [String] The action received from the client @return [void]
# File lib/solargraph/language_server/host.rb, line 588 def show_message_request text, type, actions, &block send_request 'window/showMessageRequest', { type: type, message: text, actions: actions }, &block end
@param uri [String] @param line [Integer] @param column [Integer] @return [Array<Solargraph::Pin::Base>]
# File lib/solargraph/language_server/host.rb, line 519 def signatures_at uri, line, column library = library_for(uri) library.signatures_at(uri_to_file(uri), line, column) end
Start asynchronous process handling.
@return [void]
# File lib/solargraph/language_server/host.rb, line 40 def start return unless stopped? @stopped = false diagnoser.start cataloger.start sources.start end
@return [void]
# File lib/solargraph/language_server/host.rb, line 446 def stop return if @stopped @stopped = true cataloger.stop diagnoser.stop sources.stop changed notify_observers end
# File lib/solargraph/language_server/host.rb, line 456 def stopped? @stopped end
# File lib/solargraph/language_server/host.rb, line 441 def synchronizing? !libraries.all?(&:synchronized?) end
Unregister the methods with the client. This method will avoid duplicating unregistrations and ignore methods that were not flagged for dynamic registration by the client.
@param methods [Array<String>] The methods to unregister @return [void]
# File lib/solargraph/language_server/host.rb, line 398 def unregister_capabilities methods logger.debug "Unregistering capabilities: #{methods}" unregisterations = methods.select{|m| registered?(m)}.map{ |m| @registered_capabilities.delete m { id: m, method: m } } return if unregisterations.empty? @register_semaphore.synchronize do send_request 'client/unregisterCapability', { unregisterations: unregisterations } end end
Private Instance Methods
@return [Cataloger]
# File lib/solargraph/language_server/host.rb, line 644 def cataloger @cataloger ||= Cataloger.new(self) end
@return [Diagnoser]
# File lib/solargraph/language_server/host.rb, line 639 def diagnoser @diagnoser ||= Diagnoser.new(self) end
@return [Hash]
# File lib/solargraph/language_server/host.rb, line 684 def dynamic_capability_options @dynamic_capability_options ||= { # textDocumentSync: 2, # @todo What should this be? 'textDocument/completion' => { resolveProvider: true, triggerCharacters: ['.', ':', '@'] }, # hoverProvider: true, # definitionProvider: true, 'textDocument/signatureHelp' => { triggerCharacters: ['(', ',', ' '] }, # documentFormattingProvider: true, 'textDocument/onTypeFormatting' => { firstTriggerCharacter: '{', moreTriggerCharacter: ['('] }, # documentSymbolProvider: true, # workspaceSymbolProvider: true, # workspace: { # workspaceFolders: { # supported: true, # changeNotifications: true # } # } 'textDocument/definition' => { definitionProvider: true }, 'textDocument/references' => { referencesProvider: true }, 'textDocument/rename' => { renameProvider: prepare_rename? ? { prepareProvider: true } : true }, 'textDocument/documentSymbol' => { documentSymbolProvider: true }, 'workspace/symbol' => { workspaceSymbolProvider: true }, 'textDocument/formatting' => { formattingProvider: true }, 'textDocument/foldingRange' => { foldingRangeProvider: true }, 'textDocument/codeAction' => { codeActionProvider: true } } end
@param params [Hash] @return [Source::Updater]
# File lib/solargraph/language_server/host.rb, line 665 def generate_updater params changes = [] params['contentChanges'].each do |chng| changes.push Solargraph::Source::Change.new( (chng['range'].nil? ? nil : Solargraph::Range.from_to(chng['range']['start']['line'], chng['range']['start']['character'], chng['range']['end']['line'], chng['range']['end']['character']) ), chng['text'] ) end Solargraph::Source::Updater.new( uri_to_file(params['textDocument']['uri']), params['textDocument']['version'], changes ) end
@param path [String] @return [String]
# File lib/solargraph/language_server/host.rb, line 658 def normalize_separators path return path if File::ALT_SEPARATOR.nil? path.gsub(File::ALT_SEPARATOR, File::SEPARATOR) end
# File lib/solargraph/language_server/host.rb, line 736 def prepare_rename? client_capabilities['rename'] && client_capabilities['rename']['prepareSupport'] end
A hash of client requests by ID. The host uses this to keep track of pending responses.
@return [Hash{Integer => Hash}]
# File lib/solargraph/language_server/host.rb, line 652 def requests @requests ||= {} end


Monica: You look cute in bubbles.

(They move into kiss but are interrupted by Joey knocking on the door.)
Joey: Hey, it's me! I'm comin' in!
(Monica quickly dives under the water as Joey enters. He looks a little shocked at what Chandler's doing.)
Chandler: I've had a very long, hard day.
 Want some?
Chandler: Ahh, no thanks. No chicken, bye-bye then.
Joey: Okay.
(Joey turns to leave but stops at the door.)
Joey: You sure? Some extra crispy? Dirty rice? Beans?
Chandler: For the last time no!  Get out, Joey!
Joey: All right!
(Joey leaves and Monica comes up for air.)
Chandler: Are you okay? I'm so sorry, he wouldn't leave. He kept asking me about chicken.
Monica: Chicken? I could eat some chicken.
Chandler: Hey Joe!
(Monica goes back underwater as Joey re-enters.)

(Joey gives him a thumbs up and heads for the chicken.)
Opening Credits
[Scene: Monica and Rachel's, Chandler, Joey, and Monica are eating breakfast.]
Phoebe: (entering) Hey!
Chandler: Hey, Pheebs!
Joey: Mornin' Pheebs!
Phoebe: I have to tell you this story. Okay, I was coming over here and this driver
Joey: (interrupting) Was his name Angus? (Monica and Chandler laugh.)
Phoebe: What?
Joey: Oh, he was this cab driver we had in London.
Phoebe: Oh. Ha-ha-ha. All right, anyway
Monica: Wait, what that place, that pub he took us too?
Chandler: Uh, The Wheatsheaf.
Joey: Yeah-yeah-yeah, and they had that beer! That uh
Monica: Bodington's!
All: Bodington's! Woohoo! (And they all high-five each other.)
Chandler: Ooh! Ahh, Pheebs, was gonna tell a story.
Phoebe: Yeah, so, he had a really funny hatI don't want to talk about it.
Ross: (entering) Hey!
All: Hey!
Joey: Hey, Ross, Bodington's!
Ross: Yeah! (They high-five.)
Joey: That was good beer.
Ross: Ohh
Joey: Y'know, I'd walk back to London for another frosty one of those bad boys.
Ross: Y'know, I think they have those at that British pub near the trade center.
Joey: Later! (Exits.)
Ross: Isn't Rachel supposed to be back by now?
Monica: Yeah, but her plane got delayed in Athens. But actually, (Checks watch) she should be here by now.
Ross: Oh, so-so you talked to her. Did she, did she sound mad?
Monica: No, but she likes me. You abandoned her on a plane to Greece.
Ross: Okay, I did not abandon Rachel! Okay? Emily showed up at the airport! I had to go after her!  She's my wife! Rachel is my wife! Y'knowEmily! Emily, is my wife! Man, what is that?
Phoebe: So you still hadn't heard from Emily?
Ross: No, not since I lost her at the airport.
Chandler: I can't believe she can out run you man!
Ross: HEY, SHE'S FAST!! OKAY?!! (Chandler is so shocked at Ross's outburst that he drops his spoon and backs up) Oh! You-you think you can be beat me? Let's go! Outside!!
Rachel: (entering) Hi!
All: Hey! (They all go hug her, except for Ross.)
Ross: Rach, Rach, I am so sorry. I am so-so sorry.
Rachel: Oh Ross, come on! You just did what you had to do.
Ross: That's it? You're not mad? I mean, it must've been terrible.
Rachel: Terrible? Hell, I was in Greece! That was a nice hotel! Nice beach, met the nice people. Not to shabby for Rachel. (Goes and puts her luggage away.)
Ross: So, what? That's it?
Rachel: Well, yeah! We're cool. Totally cool.
Ross: Oh, thanks. Oh, you're the best. (They hug.)
Rachel: Oh no, you're the best.
Ross: (breaking the hug) Ohh, I gotta go to the flower store! (Runs to the door.) Check it out, no one will tell me where Emily is, so I'm gonna send 72 long-stem, red roses to Emily's parent's house, one for each day that I've known and loved her. That oughta get her talking to me again.
Chandler: Oh, Ross, when you make out card; be sure to make it out to, EM-I-LY.
(Ross bangs his fists together to tell Chandler off, like what was learned last season. Read about it here.)
Monica: Rach, that's great! It's so good that you had a good time in Greece!
Rachel: What?! I didn't have a good time in Greece! Ross abandoned me! Okay, I couldn't get a plane out, so I had to stay in their honeymoon suite with people coming up to me all the time going, "Oh, Mrs. Geller, why are you crying?" I mean, it was sooo humiliating.  I mean, it's all my fault! And you know why, because I make very bad decisions.
Chandler: Oh that's not true.
Rachel: Yes it is! It is true!
Phoebe: London is stupid! Stupid!
Rachel: Phoebe, you were right. I should've never gone to London, and from now on you make all of my decisions for me.

Monica: I'll do it!
Rachel: That's fine. So Monica, you are now in control of my love life.
Chandler: Okay, I gotta go to work.
(He gets up and gives Monica a rather passionate kiss as Rachel and Phoebe look on in amazement. After the kiss ends, Chandler suddenly realizes what he just did, so he decides to do something rather rash.)
Chandler: And uh, Rachel, glad to have you back.
(He goes over and gives Rachel the same treatment he gave Monica, only Rachel is shocked.)
Chandler: Pheebs! (He goes over and kisses Phoebe, who is also stunned.) Always a pleasure. (And he struts out leaving the girls to stare at each other.)
[Scene: Central Perk, Monica, Rachel, Chandler and Joey are there looking at pictures from the trip to London.]
Monica: Oh, Rachel, sweetie, look, here's a really cute picture of Joey and you at the reception.
Rachel: Ohh, he's married! Ross is married. I can'tI still can't believe it. (Rachel grabs the picture from Monica)
Monica: Honey, sweetie, by the edges.
Rachel: I mean, y'know I'm just gonna have to accept it (She grabs the rest of the pictures)
Monica: Ohh. (Monica covers her eyes in horror.)
Rachel: I mean it's my fault.
Monica: Sweetie! Edges! Fingers! Smudgey! Pictures!
Rachel: Oh my God! (She licks the top picture and hands them back.)
Monica: Okay. That's okay. I-I know that you're very upset right now. I know, I know that wasn't about me.
Joey: (To Chandler) I bet it was about her a little.
Monica: If you would stop thinking about Ross for one minute you would notice that there are great guys everywhere! I mean, look! Look, Gunther! (Gunther turns to listen in.) I mean, he's nice, he's cute.
Rachel: Yeah, I guess Gunther is kinda
Monica: (Interrupting) Oh, what about that guy over there? (She points at another guy and Gunther is deflated.) Remember? That is the guy you flirted with at the counter that time.
Rachel: Oh, I don't know. I don't know.
Monica: You're going to talk to him! Y'know what? We made a deal, I make your decisions and I say you're going to talk to him.
Rachel: All right, you're the boss. I guess I gotta do what you tell me.
Joey: Say that to him and you're golden. (She just glares at him.)
Phoebe: (entering) Hey!
Rachel: Hey!
Joey: Hey, Pheebs!
Monica: We got out pictures back from London. (Shows her one.) Here's all of us at the Tower of London.
Phoebe: (Grabs the pictures) Oh! Here we all are! Yeah, there's Ross and Joey and you and me. (She picks up a magic marker and draws herself in. Monica can't watch.)
Chandler: All right, y'know what, we've been talking about London too much haven't we?
Phoebe: No. I'm sorry. It's just 'cause I couldn't be there. 'Cause all I ever get to do now is pregnant stuff, it just bums me out.
All: Sorry.
(Rachel returns.)
Monica: What happened?
Rachel: Well, y'know, a little of this, a little of that. Got myself a date tomorrow night.
Monica: See, didn't I tell you?! You're getting over Ross already!
Rachel: Well
(Gunther goes up to the guy and holds a sign that reads, "We reserve the right to refuse service to anyone.")

[Scene: Monica and Rachel's, Chandler enters to find Monica waiting patiently for him. He closes the door and they start kissing.]
Monica: What took you so long?
Chandler: I got caught up and work, but I'm quitting tomorrow.
Monica: Oh, good.
(They start kissing and turn around so that Chandler is facing the door. And Chandler sees Rachel, Phoebe, and Joey walk in and quickly ends the kiss with Monica.)
Chandler: So, thanks for having me over! Rach. (Goes over, grabs her, and kisses her.) Pheebs. (After a moment while he decides how to kiss her around her belly, grabs her and kisses her.)
Joey: (Jumping out of his way) See ya!! (To the girls.)
Monica: Probably some y'know, European good-bye thing he picked up in London.
Rachel: That's not European!
Phoebe: Well, it felt French.
(Joey is intrigued.)
[Scene: The hallway between the apartments, Rachel is returning from her date with Dave.]
Rachel: Oh God, I really had a good time!
Dave: Yeah, me too. (They reach her door.) So, I guess this is it.
Rachel: Yeah. Umm, unless you wanna come inside?
Dave: Yeah!
Rachel: Okay. Oh, uh, wait a minute, y'know what? I uh, I can't decide this. Umm, okay, just hold on a second.
Dave: Okay, yeah!
(She enters the apartment, leaving Dave in the hallway, to find Ross sitting on the couch with a big box.)
Rachel: Umm, hi!
Ross: Hi.
Rachel: Is Monica around? I-I have to ask her something.
Ross: She's doing her laundry.
Rachel: What's that? (Points to the box.)
Ross: It came in the mail today, it's uh, 72 long-stemmed red roses, one for each day that I've known and loved Emily, cut up into mulch!
Rachel: Oh, honey that's awful.
Ross: Oh, it's not so bad. Monica's gonna make potpourri! I think I'm gonna go wander out in the rain for a while.
Rachel: But, it's not raining.
Ross: I can't catch a break!
Rachel: Y'know what Ross? You're not going anywhere. You're gonna sit right here. I'm gonna make you a cup of tea and we're gonna talk this thing whole out. All right? (She goes out to talk to Dave) Hey, Dave!
Dave: Yeah?
Rachel: Umm, listen, I'm gonna need to take a rain check, my roommate is just really sick. Okay? Bye! (She goes back in to talk to Ross.) Honey, listen, I know, I know things seem so bad right now.
Monica: (Poking her head in) Rach? Can I talk to for just a minute? I-I dropped some socks.
Rachel: Yeah. (She goes out to join her in the hall and starts looking for the dropped socks.)
Monica: What is the matter with you?! Do you want to fall into the trap? Do you want to fall into the trap?!
Rachel: Ohh! You did not drop any socks!
Monica: I just ran into Dave and he told me that you blew him off!  Now, I'm calling the shots! I say you leave Ross alone and go get Dave!
Rachel: Well, ultimately, I was trying y'know, I-I wanted tell him y'know, that I'm still in love with him.
Monica: (Gasps) What?!! You cannot tell him that!!
Rachel: Why? Why not?! People love to hear that!
Monica: I make the decisions, and I say no.
Rachel: Well, y'know what, no, you do not make my decisions because y'know what, you're fired.
 I make your decisions and I say, "I'm not fired!" Ha!
Rachel: Well (At a loss for words, she grabs some of Monica's laundry and throws it on the floor as a diversion to allow Rachel to run back inside and close the door. Monica chases her to find that Rachel had locked the door.)
Monica: Rachel!! Come on! Let me in!
Joey: (Poking his head out.) Havin' some trouble?
Monica: Rachel locked the door.
Joey: I'll kick that door in if you give me a little sugar.
Commercial Break
[Scene: The hallway, continued from earlier. Monica is still locked out.]
Monica: Rachel! Let me in! Rachel!
[Cut to inside the apartment, Ross decides to let Monica in and goes over and opens the door in mid-pound.]
Monica: Thank you. Rachel, can I talk to you outside for a sec?
Rachel: No.
Monica: I really need to talk to you.
Rachel: Well, then talk!
Monica: Okay, I will. Remember that thing that we just discussed that you wanted to do?
Rachel: Yes!
Ross: What thing?
Monica: Well, Rachel wants to take swing dance lessons.  It's dangerous, she's never gonna get what she wants, and who knows who she might (Turns to look at Ross) end up hurting.
Ross: Monica's right, swing dancing can be tricky. I'm gonna use the phone. I gotta cancel those five giant teddy bears I sent to Emily. (Looks at the rose mulch.) My God, think of the massacre.
Rachel: I'm gonna do it.
Monica: All right, Rachel, I know-I know you think I'm crazy, please, before you tell him you love him, just-just try to find one person who thinks this is a good idea.
Rachel: But I
Monica: Please!
Rachel: All right, fine.
(There's a loud bang on the door.)
Monica: Joey, I'm in!
Joey: (In tremendous pain) All right. Good deal.
[Scene: Central Perk, Joey, Chandler, Monica, and Rachel are there as Phoebe enters.]
All: Pheebs! Hey Pheebs!
Joey: Uh, okay, Pheebs?
Phoebe: Yeah?
Joey: Umm, y'know how the other day you were talking about how you didn't get to go to London and how you were kinda feeling left out?
Phoebe: Yeah?
Joey: All right, well, we felt really bad about that so we decided we should all take a little trip together!
Phoebe: Ohh, that's so nice! How great! Well, where? Where's the trip?!
Monica: Well, we thought we would all go to a picnic (Phoebe gasps), in Central Park!
Phoebe: (excited) Central (not so excited) Park!
Joey: Yeah, all of us! All day!
 That's not a trip! I just came from the park!  "Well, it's right by my house, all right!"
Chandler: Well, I'm gonna go home and bask in the triumph of my Central Park idea. (Gets up to leave.)
Rachel: (stopping him) Hey-whoa-whoa-whoa!! Ho-ho-hold on a sec there, Mr. Kissey! Y'know, I've been meaning to talk to you about this whole, little, new European thing you got going on, and I just need to tell you that it makes me very uncomfortable and I justy'knowstop it!
Chandler: I was just trying to bring a little culture to the group.
Phoebe: That's fine, just don't bring it in my mouth.
 (Chandler looks at her, quizzically.)
[Scene: Central Perk, Rachel, Monica, Chandler, and Joey are there as Ross enters with Phoebe.]
Ross: Hey everybody, Pheebs is here!
Joey: Phoebe!
Chandler: Hey, Pheebs!
Rachel: Phoebe, woo!
Phoebe: Okay, woo! Hi.
Chandler: Okay, Pheebs, we decided the picnic idea was a little Y'know, it didn't have any It-it, well it blew. So, we thought, that this afternoon that we would all go away for the whole weekend to, Atlantic City!
Phoebe: Ooh, Atlantic City! Oh, that's a great plan! Who's plan was that?
Joey: Mine!
Ross: Wait! It was my plan.
Joey: Nooo, I said we needed a new plan.
Ross: And, I came up with Atlantic City.
Joey: Which, is the new plan!
Monica: Okay, well, why don't we all meet upstairs in an hour?
Phoebe: Okay! Ooh-ahh, I'm gonna go pack.
(They all go pack except for Ross.)
Monica: Come on Rach, let's go.
Rachel: Yeah, y'know what? I'm-I'm gonna meet you upstairs in a minute.
Monica: No! Rachel, you didn't find anyone so you can't tell him.
Rachel: Well, y'know what, that doesn't matter.
Monica: Okay, Rachel, do you have any idea how painful it is to tell someone that you love them and not have them say it back?
Rachel: Yeah, I-I don't care.
Monica: Okay. I-I can't watch. (Leaves as sits down to read the paper.)
Rachel: What 'cha readin'?
Ross: The paper.
Rachel: Yeah, what's it about?
Ross: Events from around the globe.
Rachel: Okay. Uhh, Ross, y'know what, there's something that I-that I have to talk to you about and everybody's saying that I shouldn't tell you, but I think they're wrong. I mean, and you know how people can be wrong.
Ross: Sure. Once, at work I-I thought carbon dating was fossilized
Rachel: Okay, Ross, I'm really trying to tell you something here.
Ross: Yeah.
Rachel: Okay.
Ross: Go ahead.
Rachel: Umm, okay, I think I'm-I'm just gonna-just gonna say it. Just gonna say it. Uhh, (pause) I'm still in love with you Ross.
(Ross is stunned.)
Ross: Wow. Umm Huh I'm-I'm not sure what to do with that right now.
(Rachel starts laughing hysterically.)
Ross: What? What? Was that a joke? 'Cause it's mean.
 I'm totally serious.
Ross: Why are you laughing?
Rachel: Because (laughs), because, I just heard it. I heard it, and it's ridiculous!  You're-you're married and it's just ridiculous, and it's like, it's like when said it, I sort of like, I floated up out of my body, y'know?
Ross: Well, well I am married. Even though I haven't spoken to my wife since the wedding.
Rachel: (laughs) I'm sorry, that's not funny.
Ross: Actually, it kinda is. My wife won't return my calls. I don't know where my wife is. (Laughs) "Hey Ross, where's the Mrs.?" Don't know!

Ross: Well, I kinda half to. I mean, because the thing is
Rachel: The thing is y'know, that you're married to Emily.
Ross: That is what the thing is.
Rachel: Ross, things aren't gonna be weird between us, right? I mean was that just the stupidest thing, me telling you that?
Ross: No. No. No, I'm-I'm glad you did. Look, if nothing else, it's-it's always great when someone tells you they love you.
Rachel: That's what I said! Thank you for being so nice. (They hug.)
Ross: No thank you for Thank you.
[Scene: Monica and Rachel's, the gang is about ready to leave for Atlantic City.]
Ross: Okay, let's go!
Chandler: Atlantic City!
Phoebe: Atlantic City, baby! Let's roll some bones! Hey Joey, high-five for rolling bones!
(They high-five and howl, but Phoebe suddenly stops and the guys gasp and retreat in shock.)
Joey: Uh, Pheebs, you're leaking?
Monica: Oh my God! You're water broke!
The Guys: Ohh!
Phoebe: All right. Well, don't worry, I call shotgun! (She starts out the door.)
All: Whoa-whoa-whoa-whoa! Wait-wait!
Chandler: Pheebs! We have to take you to the hospital now!
Ross: Pheebs, Pheebs, the babies are coming now.
Rachel: High-five, the babies are coming! (They all high-five.)
Phoebe: Wait, wait, remember when my water broke? (They all high-five again.)
Ending Credits
[Scene: The hallway between the apartments, they are taking Phoebe to the hospital but Chandler and Monica hold back.]
Monica: I can't believe Phoebe's gonna have her babies!
Chandler: I know, it's beautiful. Amazing.
(They both kiss.)
Chandler: Y'know what else I can't believe?
Monica: Do you know anything about women?
Chandler: No.
Monica: That's all right.
Chandler: Okay. (They kiss again.)
End


We queried Google.com, Google.fr, Google.co.uk, Google.it (in incognito mode) for the following queries.
For each query we collected the first 1000 images.
Add titleWe qualified and tagged all the images accordingly to their contents and excluding from the corpus images not concerned with CS (i.e. cesarean section on animals, images of Porto Cesareo a well known seaside town in south Italy). Each image can belong to more than one group (e.g. a photo of nurse helping during a childbirth will belong to “HC PROVIDERS;BODY; and CHILDBIRTH” categories). The following categories were used:
Finally we computed the dominant color of each image.
The images have been organized by language and by category through an elastic list. The visualization allows to observe the quantity of images extracted for each language and each category, by dynamically reorganizing the lists after a selection. By selecting a specific category it is possible to switch between pictures and dominant colors (sorted according to the page rank algorithm) to see the composition of each category.
Moritz Stefaner and Boris Müller. "Elastic lists for facet browsers." Proceedings of DEXA ‘07 18th International Conference on Database and Expert Systems Applications, 2007. FIND07, International Workshop on Dynamic Taxonomies and Faceted Search, Regensburg, Germany. pp. 217-221. 2007 Moritz Stefaner, Thomas Urban and Marc Seefelder. "Elastic lists for facet browsing and resource analysis in the enterprise." DEXA Workshops, pp. 397-401. IEEE Computer Society. 2008.


Home
Interests
Favorite Sites
Future Plans
Surprise
Weather
Click to show weather
Weather (Spanish Fork, UT)


---
title: Postdoc-Student Symposium 2023
layout: standalone
css : PSS23
---
Venue: LH-1
|
April 12 (Wednesday) |
April 13 (Thursday) |
| Session | Time |
Chair |
Speaker |
Chair |
Speaker |
| I | 10:00-10:45 |
Shraddha Srivastava |
|
Mihir Sheth |
|
| 10:45-11:30 |
|
|
| 11:30-11:45 |
Coffee |
Coffee |
| 11:45-12:30 |
|
|
| | 12:30-2:00 |
Lunch |
| II | 2:00-2:45 |
Nishu Kumari |
|
Aakanksha Jain |
|
| 2:45-3:30 |
|
|
| 3:30-3:45 |
Coffee |
Coffee |
| 3:45-4:30 |
|
|
| Click on the speaker's name to navigate to their title and abstract. |
| Some tips for giving good math talks are placed at the end of this page. |
Titles & Abstracts (listed in alphabetical order)
Anita Arora
The monopole-dimer model on Cartesian products of plane graphs
Abstract. I will discuss the monopole-dimer model for planar graphs introduced by Arvind Ayyer, an extension of it to Cartesian products and show that the partition function of this model can be expressed as a determinant of a generalised signed adjacency matrix. We then show that the partition function is independent of the orientations of the planar graphs as long as the orientations are Pfaffian. When these planar graphs are bipartite, we show that the computation of the partition function becomes especially simple. We then give an explicit product formula for the partition function of three-dimensional grid graphs which turns out to be fourth power of a polynomial when all grid lengths are even. Finally, we generalise this product formula to $d$ dimensions.
This talk is based on the joint work with Prof. Arvind Ayyer.
Arpita Mal
Preservation of geometric properties of operators under Bishop-Phelps-Bollobás type approximation
Abstract. We discuss a version of BPB-type approximation of bounded operators between Banach spaces from a geometric point of view. We show that for sufficiently small positive values of $\epsilon,$ many geometric properties like smoothness, norm attainment and extremality of operators are preserved under such approximation. We present examples of pairs of Banach spaces satisfying non-trivial norm preserving uniform $\epsilon-$BPB approximation property in the global sense. Finally, we explore these concepts in case of bounded operators between Hilbert spaces.
Dharmendra Kumar
Borderline regularity results for Dirichlet problem in nondivergence form
Abstract. In this seminar, I will present the boundary differentiability of solutions to the elliptic partial differential equations in convex domains in the borderline case.
Geethika Sebastian
A multiplicative Kowalski-Słodkowski Theorem for $C^\star$-algebras
Abstract. Linear preserver problems deal with the question of characterizing those linear transformations on an algebra which leave invariant a certain subset, function or relation defined on the underlying algebra. The study of such transformations began with Frobenius in 1897, who characterized the linear maps on matrix algebras preserving the determinant. One of the renowned results in the theory of linear preservers is the Gleason-Kahane-Żelazko theorem, which states that a unital linear functional $\phi$ defined on a complex, unital Banach algebra $A$ is multiplicative if it preserves invertibility.
Without assuming linearity, one needs to impose stronger preservation properties on $\phi$ to arrive at the same conclusion. Kowalski and Słodkowski proved that every functional $\phi$ on a Banach algebra $A$ (no linearity assumed on $\phi$) with $\phi(0)= 0$ such that the difference of the value of any two elements is contained in the spectrum of the difference of those two elements, is linear and multiplicative. Thus, we may replace the linearity assumption and the invertibility-preserving property by a single weaker assumption and still arrive at the same conclusion.
We consider a multiplicative version of the classical Kowalski-Słodkowski Theorem. In particular, we prove: If $A$ is a $C^\star$-algebra, and if $\phi:A\to\mathbb C $ is a function satisfying $ \phi(x)\phi(y) \in \sigma(xy) $ for all $x,y\in A$ (where $\sigma $ denotes the spectrum), then either $\phi$ is a character of $A$ or $-\phi$ is a character of $A$, if and only if $\phi$ is continuous.
This is joint work with Cheick Touré and Rudi Brits, University of Johannesburg.
Gobinda Sau
Existence of a harmonic map from $\mathbb{C}$ to $\mathbb{H}^2$ with prescribed Hopf differential
Abstract. This is an expository article on the existence of a harmonic map from $\mathbb{C}$ to $\mathbb{H}^2$ with a prescribed Hopf differential, focusing on Riemannian Geometry aspects. Assuming the existence of a solution to a certain vortex equation, we construct a spacelike immersion in $\mathbb{R}^{2,1}$ whose Gauss map is our desired map.
Jnaneshwar Baslingker
When do Hadamard powers of a matrix preserve positive semi-definiteness?
Abstract. Consider the set of scalars $\alpha$ for which the $\alpha$-th Hadamard power (entrywise power) of any $n\times n$ positive semi-definite (p.s.d.) matrix with non-negative entries is p.s.d. We study the question "what is the possible form of the set of such $\alpha$?". We also study this question for random Wishart matrix $A_n := X_n (X_n)^t$ , where $X_n$ is $n \times n$ matrix with i.i.d. Gaussians, as $n\to \infty$.
Mainak Bhowmik
Hankel operator on the Hardy space of the symmetrized bidisc
Abstract. The famous Nehari's theorem says that, a symbol $\varphi$ in the Hardy space of the open unit disc, $H^2$ induces a bounded Hankel operator on $H^2$ if and only if $\varphi $ is a (Szegö) projection of some $\eta \in L^\infty(\mathbb{T})$ on $H^2$. The Nehari-type theorem has been studied on Hardy spaces as well as Bergman spaces on various domains like bidisc, Euclidean ball etc. In this talk, we shall discuss about Hankel operators (mostly, small Hankel operator) on the Hardy space of the symmetrized bidisc, $H^2(b\Gamma)$. We shall characterize all the those symbols that defines bounded small Hankel operator on $H^2(b\Gamma)$. If time permits, we will see the failure of Nehari-type theorem for big Hankel operator in this case.
Manoj Kumar
Pego theorem on compact groups
Abstract. The Pego theorem characterizes the precompact subsets of the square-integrable functions on $ R^n $ via the Fourier transform. We discuss the analogue of the Pego theorem on compact groups (not necessarily abelian).
Pintu Bhunia
Numerical radius inequalities with applications
Abstract. Let $A$ be a bounded linear operator on a complex Hilbert Space $\mathcal{H}$. We develop several bounds for the numerical radius $w(A)$ of $A$, which improve the classical bound $\frac{1}{2} \Vert A \Vert \leq w(A) \leq \Vert A \Vert$. Among other bounds, we prove that
$$ w(A) \geq \frac{1}{2} \Vert A \Vert + \frac{1}{2} \bigg\vert\Vert \text{Re}(A) \Vert - \Vert \text{Im}(A) \Vert\bigg\vert,$$
$$ w(A) \leq \frac{1}{2} \Vert A \Vert^{\frac{1}{2}} \Vert \vert A \vert^{t} + \vert A^{\ast} \vert^{1-t} \Vert \quad\forall t \in [0,1].$$
Here $\text{Re}(A) = \frac{1}{2}(A + A^{\ast}), \text{Im}(A) = \frac{1}{2i}(A - A^{\ast})$ and $\vert A \vert = (A^{\ast} A)^{1/2}.$ We characterize the numerical range of an operator for which $w(A) = \frac{1}{2} \Vert A \Vert$ or $w^2(A) = \frac{1}{4} \Vert A^{\ast} A + A A^{\ast} \Vert$.
Further, we present an upper bound for the numerical radius of $n \times n$ block matrices. Finally, by applying the numerical radius bounds, we derive an estimation for the zeros of a complex polynomial.
Pratibha Shakya
Finite element methods for state and control-constrained elliptic optimal control problems
Abstract. We discuss the existence, uniqueness, and regularity results of the elliptic distributed optimal control problem with integral state and control constraints. Therein, using the state equation, we reduce the state-control constrained minimization problem to a pure state-constrained minimization problem. To discretize the minimization problem, a bubble-enriched nonconforming finite element method is utilized. We have derived the a priori error estimates for the state variable in the $H^2$-type
energy norm. Numerical results are performed to validate the theoretical findings.
Rajas Sompurkar
Existence of Higher Extremal Kähler Metrics on a Minimal Ruled Surface
Abstract. In this talk we will first see the definitions of ‘higher extremal Kähler metric’
and ‘higher constant scalar curvature Kähler (hcscK) metric’, both of which are analogous
to the definitions of ‘extremal Kähler metric’ and ‘constant scalar curvature Kähler (cscK)
metric’ respectively.  We will then prove that
on a special type of minimal ruled surface, which is an example of a ‘pseudo-Hirzebruch
surface’, every Kähler class admits a higher extremal Kähler metric which is constructed
by using the ‘momentum construction method’ involving the ‘Calabi ansatz procedure’. We
will then check that this specific higher extremal Kähler metric cannot be an hcscK metric.
By doing a certain set of computations involving the ‘top Bando-Futaki invariant’ we will
finally conclude that hcscK metrics do not exist in any Kähler class on this Kähler surface.
If time permits we will see the motivation for studying this problem and its analogy with
an other related and previously well-studied problem.
Renjith Thazhathethil
Homogenization of Partial Differential equations on oscillating boundary domain
Abstract. In this talk we will discuss the homogenization of PDE on oscillating boundary domains. We will briefly go through the technique periodic unfolding method and then see how it works on homogenization problems.
Here are some highlights from these resources. Use these tips as general guidelines but develop your own style.
1. Talks are not the same as papers
(Terry Tao: https://terrytao.wordpress.com/career-advice/talks-are-not-the-same-as-papers)
One should avoid the common error of treating a talk like a paper, with all the attendant details, technicalities, and formalism.
A good talk should also be "friendly" to non-experts by devoting at least the first few minutes going over basic examples or background,
so that they are not completely lost even from the beginning. Even the experts will appreciate a review of the background material.
2. A slide talk versus a blackboard talk
(Jordan Ellenberg:
https://quomodocumque.files.wordpress.com/2010/09/talktipsheet.pdf)
For a half-hour talk, the time-saving that comes with slides usually makes them a better choice.
3. Time is of the essence, and less is more
A good rule of thumb: you should allow between 1 minute and 2 minutes per slide. Do not pack your slides with information and try to artificially achieve the goal of
1-2 minutes per slide by speaking quickly. In fact, consider having as little information on each slide as possible.
(A. Kercheval:
https://www.ams.org/journals/notices/201910/rnoti-p1650.pdf)
If you check the clock during your presentation and say, "Uh oh, I'd better speed up!" this angers the gods.
4. Do not try to impress the audience with your brilliance.
"Making the talk complicated so that your work appears profound is a great sin."
(https://montrealnumbertheory.org/qvntsspeakers)
As a corollary, do not present your proof "in all its details, paying fond attention to what happens when p=2 and when the spectral sequence fails to
degenerate after the 17-th stage." Instead, focus on your exposition by presenting the big picture which provides the background and motivation for the
mathematics that you have done.
5. Use the power of examples
(https://quomodocumque.wordpress.com/2009/11/16/what-to-do-in-talks/)
Give an example so easy that it is insulting. Then give an example that is slightly less insulting. Finally give an interesting example.
6. Practice, Practice, and Practice
The best method in helping perfect your timing is practice, practice, practice, either in front of others or by yourself. Ideas that look reasonable in notes or on
slides often don't work when said out loud. Giving voice to the written word also reveals new and better ways to frame and articulate your mathematics.
(Terry Tao:
https://terrytao.wordpress.com/career-advice/talks-are-not-the-same-as-papers/)
Note: this is the same blog-post that was referenced in Item 1
If you have to give the very first talk of your career, it may help to practice it, even to an empty room, to get a rough idea of how much time
it will take and whether anything should be put in, taken out, moved, or modified to make the talk flow better.


[demo_1d_x_external_1] producing this plot
See demo_1d_x_external.cpp for full source code.
As ever, we need a few includes to use Boost.Plot and an STL container.
Some fictional data is pushed into an STL container, here vector<double>:
vector<double> my_data; my_data.push_back(-1.6); my_data.push_back(4.2563); my_data.push_back(0.00333974); my_data.push_back(5.4); my_data.push_back(6.556); try { // try'n'catch blocks are needed to ensure error messages from any exceptions are shown. svg_1d_plot my_1d_plot; // Construct a plot with all the default constructor values. my_1d_plot.title("Demo 1D Tick Values") // Add a string title of the plot. .x_range(-5, 10) // Add a range for the X-axis. .x_label("temp (°C)"); // Add a label for the X-axis, using Unicode degree symbol.
Add the one data series, my_data
and a description, and how the data points are to be marked, a circle with
a diameter of 7 pixels.
my_1d_plot.plot(my_data, "1D Values").shape(circlet).size(7);
If the default size and color are not to your taste, set more options, like:
my_1d_plot.size(500, 150) // Change plot window from the default image size. // Change the X-axis label style: .x_axis_label_color(green) .x_label_font_family("Arial") .x_label_font_size(18) // Change the style of the X (major) ticks: .x_ticks_values_color(magenta) //.x_ticks_values_font_family("Times New Roman") .x_ticks_values_font_family("arial") .x_ticks_values_font_size(15)
The format of the tick value labels may not suit your data and its range,
so we can use the normal iostream
precision
and ioflags
to change, here to reduce the number of digits used from default precision
6 down to a more readable 2, reducing the risk of collisions between adjacent
values. If values are very close to each other (a small range on the axis),
a higher precision wil be needed to differentiate them). We could also prescribe
the use of scientific format and force a positive sign: By default, any unnecessary
spacing-wasting zeros in the exponent field are removed.
If, perversely, the full 1.123456e+012 format is required, the stripping
can be switched off with: my_1d_plot.x_ticks_values_strip_e0s(false);
// Change the format from the default "-4", "-2", "0" "2", "4" ... // (which makes a 'best guess' at the format) // to "-4.00", "-2.00", ..."+2.00", "4.00" // showing trailing zeros and a leading positive sign. .x_ticks_values_ioflags(ios_base::fixed | std::ios::showpos) .x_ticks_values_precision(1) // // One could use ios_base::scientific for e format. //.x_ticks_values_ioflags(ios_base::fixed | std::ios::showpos ) //.x_ticks_values_ioflags(std::ios::showpoint | std::ios::showpos) //.x_ticks_values_ioflags(std::ios::scientific) ;
To use all these settings, finally write the plot to file.
my_1d_plot.write("demo_1d_tick_values.svg");
If chosen settings do not have the effect that you expect, it may be helpful to display them.
(All the myriad settings can be displayed with show_1d_plot_settings(my_1d_plot)
.)
//show_1d_plot_settings(my_1d_plot); using boost::svg::detail::operator<<; cout << "my_1d_plot.size() " << my_1d_plot.size() << endl; cout << "my_1d_plot.x_size() " << my_1d_plot.x_size() << endl; cout << "my_1d_plot.y_size() " << my_1d_plot.y_size() << endl; cout << "my_1d_plot.x_axis_label_color() " << my_1d_plot.x_axis_label_color() << endl; cout << "my_1d_plot.x_label_font_family() " << my_1d_plot.x_label_font_family() << endl; cout << "my_1d_plot.x_label_font_size() " << my_1d_plot.x_label_font_size() << endl; cout << "my_1d_plot.x_ticks_values_font_family() " << my_1d_plot.x_ticks_values_font_family() << endl; cout << "my_1d_plot.x_ticks_values_font_size() " << my_1d_plot.x_ticks_values_font_size() << endl; cout << "my_1d_plot.x_ticks_values_color() " << my_1d_plot.x_ticks_values_color() << endl; cout << "my_1d_plot.x_ticks_values_precision() " << my_1d_plot.x_ticks_values_precision() << endl; cout << "my_1d_plot.x_ticks_values_ioflags() " << hex << my_1d_plot.x_ticks_values_ioflags() << endl;
See demo_1d_ticks_values.cpp for full source code.
producing this plot
See demo_1d_tick_values.cpp for full source code.
If you would like horizontal Y grid lines that go across the graph, you can
make the following call to svg_2d_plot
:
my_plot.y_major_grid_on(true) .y_minor_grid_on(true);
To style it, you could use the following calls:
my_plot.y_major_grid_color(lightgray) // Darker color for major grid. .y_minor_grid_color(whitesmoke); // Lighter color for minor grid.
This will produce the following plot image:
The source of this examples is at ../../example/2d_y_grid.cpp
Similarly you can have horizontal and/or vertical lines:
my_plot.x_major_grid_on(true) .x_minor_grid_on(true);
and color it similarly for faint blues like old fashioned graph paper:
my_plot.y_major_grid_color(svg_color(200, 220, 255)) // Darker color for major grid. .y_minor_grid_color(svg_color(240, 240, 255); // lighter color for minor grid.
and to make the major grid much wider than the minor grid:
my_plot.y_major_grid_width(4) .y_minor_grid_width(1)
When there is a call to the plot() method, define area_fill_color
multimap<double, double> my_data; svg_2d_plot my_plot; my_plot.plot(my_data, "Data", area_fill_color(red));
This produces the following images:
from source at ../../example/2d_area_fill.cpp
If you would like an interpolated curve shown over your data (rather than the default straight lines joining points), simply use the following command:
my_plot.plot(data, "Series 1", bezier_on(true);
This produces something like the following images:
| Warning | |
|---|---|
The |


qiskit.backends.aer._simulatortools module¶
Contains functions used by the simulators.
- Functions
- index2 – Takes a bitstring k and inserts bits b1 as the i1th bit and b2 as the i2th bit
Members¶
Functions¶
compute_ugate_matrix |
Compute the matrix associated with a parameterized U gate. |
einsum_matmul_index |
Return the index string for Numpy.eignsum matrix multiplication. |
index1 |
Magic index1 function. |
index2 |
Magic index1 function. |
regulate |
Return the regulated symbolic representation of theta. |
single_gate_matrix |
Get the matrix for a single qubit. |
single_gate_params |
Apply a single qubit gate to the qubit. |
Reference¶
-
qiskit.backends.aer._simulatortools.
compute_ugate_matrix
(parameters)[Quellcode]¶ Compute the matrix associated with a parameterized U gate.
Parameter: parameters (list[float]) – parameters carried by the U gate Rückgabe: the matrix associated with a parameterized U gate Rückgabetyp: sympy.Matrix
-
qiskit.backends.aer._simulatortools.
einsum_matmul_index
(gate_indices, number_of_qubits)[Quellcode]¶ Return the index string for Numpy.eignsum matrix multiplication.
The returned indices are to perform a matrix multiplication A.B where the matrix A is an M-qubit matrix, matrix B is an N-qubit matrix, and M <= N, and identity matrices are implied on the subsystems where A has no support on B.
Parameter: - gate_indices (list[int]) – the indices of the right matrix subsystems to contract with the left matrix.
- number_of_qubits (int) – the total number of qubits for the right matrix.
Rückgabe: An indices string for the Numpy.einsum function.
Rückgabetyp: str
Raises: QISKitError
– if the total number of qubits plus the number of- contracted indices is greater than 26.
-
qiskit.backends.aer._simulatortools.
index1
(b, i, k)[Quellcode]¶ Magic index1 function.
Takes a bitstring k and inserts bit b as the ith bit, shifting bits >= i over to make room.
-
qiskit.backends.aer._simulatortools.
index2
(b1, i1, b2, i2, k)[Quellcode]¶ Magic index1 function.
Takes a bitstring k and inserts bits b1 as the i1th bit and b2 as the i2th bit
-
qiskit.backends.aer._simulatortools.
regulate
(theta)[Quellcode]¶ - Return the regulated symbolic representation of theta::
- if it has a representation close enough to pi transformations,
- return that representation (for example, 3.14 -> sympy.pi).
- otherwise, return a sympified representation of theta (for example,
- 1.23 -> sympy.Float(1.23)).
See also UGateGeneric.
Parameter: theta (float or sympy.Basic) – the float value (e.g., 3.14) or the symbolic value (e.g., pi) Rückgabe: the sympy-regulated representation of theta Rückgabetyp: sympy.Basic
-
qiskit.backends.aer._simulatortools.
single_gate_matrix
(gate, params=None)[Quellcode]¶ Get the matrix for a single qubit.
Parameter: - gate (str) – the single qubit gate name
- params (list) – the operation parameters op[‚params‘]
Rückgabe: A numpy array representing the matrix
Rückgabetyp: array
-
qiskit.backends.aer._simulatortools.
single_gate_params
(gate, params=None)[Quellcode]¶ Apply a single qubit gate to the qubit.
Parameter: - gate (str) – the single qubit gate name
- params (list) – the operation parameters op[‚params‘]
Rückgabe: a tuple of U gate parameters (theta, phi, lam)
Rückgabetyp: tuple
Raises: QISKitError
– if the gate name is not valid


Home
EXPERIENCE
SKILLS
ABOUT ME
CONTACT
Robert Pitter
University Student ○ Technology Enthusiast ○ Bahamian
My Experience
My Resumè


Idaho Laws
Protected Categories : All
2016
Fully Inclusive Laws
Non-Inclusive Laws
Not Protected
actions-count :
0