Basically the question is to extend the ethereum clients to bring some capabilities of external libraries on the blockchain either by extending the ethereum client or by using inside smart contracts and solidity
This question is a continuation from: How to setup ethereum to work on gpus for complex smart contract execution?
As I tried clarifying already in the linked question but let me try to explain a bit differently:
1) The clients (Geth, Parity) are not running inside the blockchain. They only implement the blockchain functionality and provide access to the blockchain. Therefore you can't bring new functionality into the blockchain by extending your client.
2) The clients can't use external libraries for processing. There is simply no need for external libraries. The processing of transactions is the essence of clients and you basically have to write a new client if you want to change that logic. But there are not very many ways how that processing can be implemented: there's basically only one way to process the transactions.
3) Smart contracts can use libraries but those libraries are something completely different. Here's one link to libraries: https://medium.com/coinmonks/all-you-should-know-about-libraries-in-solidity-dd8bc953eae7
4) All data inside the blockchain has to be input there through a transaction. So whatever data you want to use in a smart contract has to be provided by someone in a transaction.
5) Smart contracts are very very limited in what kind of functionality they can utilize. They can only use Ethereum bytecode and nothing else. So you can't give them any traditional libraries for processing.
Mostly: you have change your thinking patterns. Ethereum is not for any typical processing of data. It can't utilize external libraries like your typical Java/whatever program can.